Submitted By: Jonathan Norman (jonathan at bluesquarelinux.co.uk) Date: 2011-05-17 Initial Package Version: 4.6.0 Origin: Upstream Upstream Status: Applied Description: This is a branch update for gcc-4.6.0, and should be rechecked periodically. This patch was made from Revision # 173825. diff -Naur gcc-4.6.0.orig/config/bootstrap-lto.mk gcc-4.6.0/config/bootstrap-lto.mk --- gcc-4.6.0.orig/config/bootstrap-lto.mk 2011-01-10 23:43:54.000000000 +0000 +++ gcc-4.6.0/config/bootstrap-lto.mk 2011-04-20 09:25:33.860374000 +0000 @@ -1,6 +1,5 @@ -# This option enables LTO for stage2 and stage3. It requires lto to -# be enabled for stage1 with --enable-stage1-languages. +# This option enables LTO for stage2 and stage3. STAGE2_CFLAGS += -flto=jobserver -frandom-seed=1 STAGE3_CFLAGS += -flto=jobserver -frandom-seed=1 -STAGEprofile_CFLAGS += -fno-lto +STAGEprofile_CFLAGS += -fno-lto diff -Naur gcc-4.6.0.orig/gcc/DATESTAMP gcc-4.6.0/gcc/DATESTAMP --- gcc-4.6.0.orig/gcc/DATESTAMP 2011-03-25 00:18:25.000000000 +0000 +++ gcc-4.6.0/gcc/DATESTAMP 2011-05-17 00:19:26.750332000 +0000 @@ -1 +1 @@ -20110325 +20110517 diff -Naur gcc-4.6.0.orig/gcc/Makefile.in gcc-4.6.0/gcc/Makefile.in --- gcc-4.6.0.orig/gcc/Makefile.in 2011-01-26 04:19:58.000000000 +0000 +++ gcc-4.6.0/gcc/Makefile.in 2011-03-26 09:20:34.263941000 +0000 @@ -3070,7 +3070,7 @@ $(TREE_H) $(TM_P_H) $(REGS_H) hard-reg-set.h $(FLAGS_H) insn-config.h \ $(RECOG_H) $(EXPR_H) $(DF_H) cselib.h $(DBGCNT_H) $(TIMEVAR_H) \ $(TREE_PASS_H) alloc-pool.h $(ALIAS_H) dse.h $(OPTABS_H) $(TARGET_H) \ - $(BITMAP_H) + $(BITMAP_H) $(PARAMS_H) fwprop.o : fwprop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) \ $(DIAGNOSTIC_CORE_H) insn-config.h $(RECOG_H) $(FLAGS_H) $(OBSTACK_H) $(BASIC_BLOCK_H) \ output.h $(DF_H) alloc-pool.h $(TIMEVAR_H) $(TREE_PASS_H) $(TARGET_H) \ diff -Naur gcc-4.6.0.orig/gcc/ada/gcc-interface/Make-lang.in gcc-4.6.0/gcc/ada/gcc-interface/Make-lang.in --- gcc-4.6.0.orig/gcc/ada/gcc-interface/Make-lang.in 2011-01-26 11:53:51.000000000 +0000 +++ gcc-4.6.0/gcc/ada/gcc-interface/Make-lang.in 2011-04-17 22:29:13.989536000 +0000 @@ -485,7 +485,7 @@ $(RM) stamp-gnatlib2-rts stamp-tools gnatbind$(exeext): ada/b_gnatb.o $(CONFIG_H) $(GNATBIND_OBJS) - $(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) $(ALL_CFLAGS) $(LIBS) $(SYSLIBS) + $(GCC_LINK) -o $@ ada/b_gnatb.o $(GNATBIND_OBJS) $(LIBS) $(SYSLIBS) $(CFLAGS) # use cross-gcc gnat-cross: force diff -Naur gcc-4.6.0.orig/gcc/ada/gcc-interface/decl.c gcc-4.6.0/gcc/ada/gcc-interface/decl.c --- gcc-4.6.0.orig/gcc/ada/gcc-interface/decl.c 2011-01-04 11:33:39.000000000 +0000 +++ gcc-4.6.0/gcc/ada/gcc-interface/decl.c 2011-05-05 16:27:03.722146000 +0000 @@ -177,7 +177,6 @@ static tree create_field_decl_from (tree, tree, tree, tree, tree, VEC(subst_pair,heap) *); static tree get_rep_part (tree); -static tree get_variant_part (tree); static tree create_variant_part_from (tree, VEC(variant_desc,heap) *, tree, tree, VEC(subst_pair,heap) *); static void copy_and_substitute_in_size (tree, tree, VEC(subst_pair,heap) *); @@ -8400,7 +8399,7 @@ /* Return the variant part of RECORD_TYPE, if any. Otherwise return NULL. */ -static tree +tree get_variant_part (tree record_type) { tree field; diff -Naur gcc-4.6.0.orig/gcc/ada/gcc-interface/gigi.h gcc-4.6.0/gcc/ada/gcc-interface/gigi.h --- gcc-4.6.0.orig/gcc/ada/gcc-interface/gigi.h 2011-02-03 13:19:38.000000000 +0000 +++ gcc-4.6.0/gcc/ada/gcc-interface/gigi.h 2011-05-05 16:27:03.722146000 +0000 @@ -151,6 +151,9 @@ extern void annotate_object (Entity_Id gnat_entity, tree gnu_type, tree size, bool by_ref, bool by_double_ref); +/* Return the variant part of RECORD_TYPE, if any. Otherwise return NULL. */ +extern tree get_variant_part (tree record_type); + /* Given a type T, a FIELD_DECL F, and a replacement value R, return a new type with all size expressions that contain F updated by replacing F with R. If F is NULL_TREE, always make a new RECORD_TYPE, even if diff -Naur gcc-4.6.0.orig/gcc/ada/gcc-interface/utils2.c gcc-4.6.0/gcc/ada/gcc-interface/utils2.c --- gcc-4.6.0.orig/gcc/ada/gcc-interface/utils2.c 2011-02-03 13:19:38.000000000 +0000 +++ gcc-4.6.0/gcc/ada/gcc-interface/utils2.c 2011-05-05 16:27:03.722146000 +0000 @@ -193,15 +193,21 @@ calling into build_binary_op), some others are really expected and we have to be careful. */ - /* We must prevent writing more than what the target may hold if this is for + /* We must avoid writing more than what the target can hold if this is for an assignment and the case of tagged types is handled in build_binary_op - so use the lhs type if it is known to be smaller, or of constant size and - the rhs type is not, whatever the modes. We also force t1 in case of + so we use the lhs type if it is known to be smaller or of constant size + and the rhs type is not, whatever the modes. We also force t1 in case of constant size equality to minimize occurrences of view conversions on the - lhs of assignments. */ + lhs of an assignment, except for the case of record types with a variant + part on the lhs but not on the rhs to make the conversion simpler. */ if (TREE_CONSTANT (TYPE_SIZE (t1)) && (!TREE_CONSTANT (TYPE_SIZE (t2)) - || !tree_int_cst_lt (TYPE_SIZE (t2), TYPE_SIZE (t1)))) + || tree_int_cst_lt (TYPE_SIZE (t1), TYPE_SIZE (t2)) + || (TYPE_SIZE (t1) == TYPE_SIZE (t2) + && !(TREE_CODE (t1) == RECORD_TYPE + && TREE_CODE (t2) == RECORD_TYPE + && get_variant_part (t1) != NULL_TREE + && get_variant_part (t2) == NULL_TREE)))) return t1; /* Otherwise, if the lhs type is non-BLKmode, use it. Note that we know diff -Naur gcc-4.6.0.orig/gcc/c-family/c-common.c gcc-4.6.0/gcc/c-family/c-common.c --- gcc-4.6.0.orig/gcc/c-family/c-common.c 2011-03-11 22:38:58.000000000 +0000 +++ gcc-4.6.0/gcc/c-family/c-common.c 2011-04-08 15:01:50.477968000 +0000 @@ -3300,6 +3300,20 @@ primop0 = get_narrower (op0, &unsignedp0); primop1 = get_narrower (op1, &unsignedp1); + /* If primopN is first sign-extended from primopN's precision to opN's + precision, then zero-extended from opN's precision to + *restype_ptr precision, shortenings might be invalid. */ + if (TYPE_PRECISION (TREE_TYPE (primop0)) < TYPE_PRECISION (TREE_TYPE (op0)) + && TYPE_PRECISION (TREE_TYPE (op0)) < TYPE_PRECISION (*restype_ptr) + && !unsignedp0 + && TYPE_UNSIGNED (TREE_TYPE (op0))) + primop0 = op0; + if (TYPE_PRECISION (TREE_TYPE (primop1)) < TYPE_PRECISION (TREE_TYPE (op1)) + && TYPE_PRECISION (TREE_TYPE (op1)) < TYPE_PRECISION (*restype_ptr) + && !unsignedp1 + && TYPE_UNSIGNED (TREE_TYPE (op1))) + primop1 = op1; + /* Handle the case that OP0 does not *contain* a conversion but it *requires* conversion to FINAL_TYPE. */ @@ -3924,16 +3938,25 @@ } CASE_CONVERT: - /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE, - since that affects how `default_conversion' will behave. */ - if (TREE_CODE (TREE_TYPE (expr)) == REFERENCE_TYPE - || TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) == REFERENCE_TYPE) - break; - /* If this is widening the argument, we can ignore it. */ - if (TYPE_PRECISION (TREE_TYPE (expr)) - >= TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (expr, 0)))) - return c_common_truthvalue_conversion (location, - TREE_OPERAND (expr, 0)); + { + tree totype = TREE_TYPE (expr); + tree fromtype = TREE_TYPE (TREE_OPERAND (expr, 0)); + + /* Don't cancel the effect of a CONVERT_EXPR from a REFERENCE_TYPE, + since that affects how `default_conversion' will behave. */ + if (TREE_CODE (totype) == REFERENCE_TYPE + || TREE_CODE (fromtype) == REFERENCE_TYPE) + break; + /* Don't strip a conversion from C++0x scoped enum, since they + don't implicitly convert to other types. */ + if (TREE_CODE (fromtype) == ENUMERAL_TYPE + && ENUM_IS_SCOPED (fromtype)) + break; + /* If this isn't narrowing the argument, we can ignore it. */ + if (TYPE_PRECISION (totype) >= TYPE_PRECISION (fromtype)) + return c_common_truthvalue_conversion (location, + TREE_OPERAND (expr, 0)); + } break; case MODIFY_EXPR: diff -Naur gcc-4.6.0.orig/gcc/c-family/c-ppoutput.c gcc-4.6.0/gcc/c-family/c-ppoutput.c --- gcc-4.6.0.orig/gcc/c-family/c-ppoutput.c 2011-01-03 20:52:22.000000000 +0000 +++ gcc-4.6.0/gcc/c-family/c-ppoutput.c 2011-04-19 09:14:05.861558000 +0000 @@ -36,6 +36,7 @@ int src_line; /* Line number currently being written. */ unsigned char printed; /* Nonzero if something output at line. */ bool first_time; /* pp_file_change hasn't been called yet. */ + const char *src_file; /* Current source file. */ } print; /* Defined and undefined macros being queued for output with -dU at @@ -153,6 +154,7 @@ print.prev = 0; print.outf = out_stream; print.first_time = 1; + print.src_file = ""; } /* Writes out the preprocessed file, handling spacing and paste @@ -312,7 +314,9 @@ print.printed = 0; } - if (src_line >= print.src_line && src_line < print.src_line + 8) + if (src_line >= print.src_line + && src_line < print.src_line + 8 + && (flag_no_line_commands || strcmp (map->to_file, print.src_file) == 0)) { while (src_line > print.src_line) { @@ -344,6 +348,7 @@ unsigned char *p; print.src_line = SOURCE_LINE (map, src_loc); + print.src_file = map->to_file; /* cpp_quote_string does not nul-terminate, so we have to do it ourselves. */ diff -Naur gcc-4.6.0.orig/gcc/c-family/c.opt gcc-4.6.0/gcc/c-family/c.opt --- gcc-4.6.0.orig/gcc/c-family/c.opt 2011-02-17 21:34:10.000000000 +0000 +++ gcc-4.6.0/gcc/c-family/c.opt 2011-03-29 14:24:42.977146000 +0000 @@ -719,6 +719,10 @@ ObjC ObjC++ Joined MissingArgError(no class name specified with %qs) -fconst-string-class= Use class for constant strings +fconstexpr-depth= +C++ ObjC++ Joined RejectNegative UInteger Var(max_constexpr_depth) Init(512) +-fconstexpr-depth= Specify maximum constexpr recursion depth + fdeduce-init-list C++ ObjC++ Var(flag_deduce_init_list) Init(1) -fno-deduce-init-list disable deduction of std::initializer_list for a template type parameter from a brace-enclosed initializer-list @@ -1133,7 +1137,11 @@ std=c++98 C++ ObjC++ -Conform to the ISO 1998 C++ standard +Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum + +std=c++03 +C++ ObjC++ Alias(std=c++98) +Conform to the ISO 1998 C++ standard revised by the 2003 technical corrigendum std=c++0x C++ ObjC++ diff -Naur gcc-4.6.0.orig/gcc/c-typeck.c gcc-4.6.0/gcc/c-typeck.c --- gcc-4.6.0.orig/gcc/c-typeck.c 2011-01-27 02:09:13.000000000 +0000 +++ gcc-4.6.0/gcc/c-typeck.c 2011-04-27 07:05:54.304227000 +0000 @@ -5773,11 +5773,13 @@ /* For int foo[] = (int [3]){1}; we need to set array size now since later on array initializer will be just the brace enclosed list of the compound literal. */ + tree etype = strip_array_types (TREE_TYPE (decl)); type = build_distinct_type_copy (TYPE_MAIN_VARIANT (type)); - TREE_TYPE (decl) = type; TYPE_DOMAIN (type) = TYPE_DOMAIN (TREE_TYPE (cldecl)); layout_type (type); layout_decl (cldecl, 0); + TREE_TYPE (decl) + = c_build_qualified_type (type, TYPE_QUALS (etype)); } } } @@ -10176,7 +10178,7 @@ warn_for_sign_compare (location, orig_op0_folded, orig_op1_folded, op0, op1, result_type, resultcode); - if (!in_late_binary_op) + if (!in_late_binary_op && !int_operands) { if (!op0_maybe_const || TREE_CODE (op0) != INTEGER_CST) op0 = c_wrap_maybe_const (op0, !op0_maybe_const); diff -Naur gcc-4.6.0.orig/gcc/cfgexpand.c gcc-4.6.0/gcc/cfgexpand.c --- gcc-4.6.0.orig/gcc/cfgexpand.c 2011-03-03 16:06:33.000000000 +0000 +++ gcc-4.6.0/gcc/cfgexpand.c 2011-04-20 11:18:50.658757000 +0000 @@ -2492,6 +2492,7 @@ || !TREE_STATIC (exp) || !DECL_NAME (exp) || DECL_HARD_REGISTER (exp) + || DECL_IN_CONSTANT_POOL (exp) || mode == VOIDmode) return NULL; diff -Naur gcc-4.6.0.orig/gcc/combine.c gcc-4.6.0/gcc/combine.c --- gcc-4.6.0.orig/gcc/combine.c 2011-02-15 19:46:26.000000000 +0000 +++ gcc-4.6.0/gcc/combine.c 2011-04-12 13:44:33.209292000 +0000 @@ -387,7 +387,7 @@ static int can_combine_p (rtx, rtx, rtx, rtx, rtx, rtx, rtx *, rtx *); static int combinable_i3pat (rtx, rtx *, rtx, rtx, rtx, int, int, rtx *); static int contains_muldiv (rtx); -static rtx try_combine (rtx, rtx, rtx, rtx, int *); +static rtx try_combine (rtx, rtx, rtx, rtx, int *, rtx); static void undo_all (void); static void undo_commit (void); static rtx *find_split_point (rtx *, rtx, bool); @@ -1159,6 +1159,7 @@ FOR_EACH_BB (this_basic_block) { + rtx last_combined_insn = NULL_RTX; optimize_this_for_speed_p = optimize_bb_for_speed_p (this_basic_block); last_call_luid = 0; mem_last_set = -1; @@ -1177,6 +1178,15 @@ next = 0; if (NONDEBUG_INSN_P (insn)) { + while (last_combined_insn + && INSN_DELETED_P (last_combined_insn)) + last_combined_insn = PREV_INSN (last_combined_insn); + if (last_combined_insn == NULL_RTX + || BARRIER_P (last_combined_insn) + || BLOCK_FOR_INSN (last_combined_insn) != this_basic_block + || DF_INSN_LUID (last_combined_insn) <= DF_INSN_LUID (insn)) + last_combined_insn = insn; + /* See if we know about function return values before this insn based upon SUBREG flags. */ check_promoted_subreg (insn, PATTERN (insn)); @@ -1190,7 +1200,8 @@ for (links = LOG_LINKS (insn); links; links = XEXP (links, 1)) if ((next = try_combine (insn, XEXP (links, 0), NULL_RTX, - NULL_RTX, &new_direct_jump_p)) != 0) + NULL_RTX, &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; /* Try each sequence of three linked insns ending with this one. */ @@ -1208,8 +1219,8 @@ nextlinks; nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, link, XEXP (nextlinks, 0), - NULL_RTX, - &new_direct_jump_p)) != 0) + NULL_RTX, &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; } @@ -1227,14 +1238,15 @@ && sets_cc0_p (PATTERN (prev))) { if ((next = try_combine (insn, prev, NULL_RTX, NULL_RTX, - &new_direct_jump_p)) != 0) + &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; for (nextlinks = LOG_LINKS (prev); nextlinks; nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, prev, XEXP (nextlinks, 0), - NULL_RTX, - &new_direct_jump_p)) != 0) + NULL_RTX, &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; } @@ -1247,14 +1259,15 @@ && reg_mentioned_p (cc0_rtx, SET_SRC (PATTERN (insn)))) { if ((next = try_combine (insn, prev, NULL_RTX, NULL_RTX, - &new_direct_jump_p)) != 0) + &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; for (nextlinks = LOG_LINKS (prev); nextlinks; nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, prev, XEXP (nextlinks, 0), - NULL_RTX, - &new_direct_jump_p)) != 0) + NULL_RTX, &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; } @@ -1269,8 +1282,8 @@ && NONJUMP_INSN_P (prev) && sets_cc0_p (PATTERN (prev)) && (next = try_combine (insn, XEXP (links, 0), - prev, NULL_RTX, - &new_direct_jump_p)) != 0) + prev, NULL_RTX, &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; #endif @@ -1281,7 +1294,8 @@ nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, XEXP (links, 0), XEXP (nextlinks, 0), NULL_RTX, - &new_direct_jump_p)) != 0) + &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; /* Try four-instruction combinations. */ @@ -1305,14 +1319,16 @@ nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, link, link1, XEXP (nextlinks, 0), - &new_direct_jump_p)) != 0) + &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; /* I0, I1 -> I2, I2 -> I3. */ for (nextlinks = XEXP (next1, 1); nextlinks; nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, link, link1, XEXP (nextlinks, 0), - &new_direct_jump_p)) != 0) + &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; } @@ -1326,14 +1342,16 @@ nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, link, link1, XEXP (nextlinks, 0), - &new_direct_jump_p)) != 0) + &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; /* I0 -> I1; I1, I2 -> I3. */ for (nextlinks = LOG_LINKS (link1); nextlinks; nextlinks = XEXP (nextlinks, 1)) if ((next = try_combine (insn, link, link1, XEXP (nextlinks, 0), - &new_direct_jump_p)) != 0) + &new_direct_jump_p, + last_combined_insn)) != 0) goto retry; } } @@ -1362,7 +1380,8 @@ i2mod_old_rhs = copy_rtx (orig); i2mod_new_rhs = copy_rtx (note); next = try_combine (insn, i2mod, NULL_RTX, NULL_RTX, - &new_direct_jump_p); + &new_direct_jump_p, + last_combined_insn); i2mod = NULL_RTX; if (next) goto retry; @@ -2421,19 +2440,21 @@ } /* Replace all the occurrences of DEST with SRC in DEBUG_INSNs between INSN - and LAST. */ + and LAST, not including INSN, but including LAST. Also stop at the end + of THIS_BASIC_BLOCK. */ static void propagate_for_debug (rtx insn, rtx last, rtx dest, rtx src) { - rtx next, loc; + rtx next, loc, end = NEXT_INSN (BB_END (this_basic_block)); struct rtx_subst_pair p; p.to = src; p.adjusted = false; next = NEXT_INSN (insn); - while (next != last) + last = NEXT_INSN (last); + while (next != last && next != end) { insn = next; next = NEXT_INSN (insn); @@ -2501,10 +2522,15 @@ resume scanning. Set NEW_DIRECT_JUMP_P to a nonzero value if try_combine creates a - new direct jump instruction. */ + new direct jump instruction. + + LAST_COMBINED_INSN is either I3, or some insn after I3 that has + been I3 passed to an earlier try_combine within the same basic + block. */ static rtx -try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p) +try_combine (rtx i3, rtx i2, rtx i1, rtx i0, int *new_direct_jump_p, + rtx last_combined_insn) { /* New patterns for I3 and I2, respectively. */ rtx newpat, newi2pat = 0; @@ -3853,7 +3879,7 @@ i2src while its original mode is temporarily restored, and then clear i2scratch so that we don't do it again later. */ - propagate_for_debug (i2, i3, reg, i2src); + propagate_for_debug (i2, last_combined_insn, reg, i2src); i2scratch = false; /* Put back the new mode. */ adjust_reg_mode (reg, new_mode); @@ -3866,13 +3892,16 @@ if (reg == i2dest) { first = i2; - last = i3; + last = last_combined_insn; } else { first = i3; last = undobuf.other_insn; gcc_assert (last); + if (DF_INSN_LUID (last) + < DF_INSN_LUID (last_combined_insn)) + last = last_combined_insn; } /* We're dealing with a reg that changed mode but not @@ -4101,14 +4130,14 @@ if (newi2pat) { if (MAY_HAVE_DEBUG_INSNS && i2scratch) - propagate_for_debug (i2, i3, i2dest, i2src); + propagate_for_debug (i2, last_combined_insn, i2dest, i2src); INSN_CODE (i2) = i2_code_number; PATTERN (i2) = newi2pat; } else { if (MAY_HAVE_DEBUG_INSNS && i2src) - propagate_for_debug (i2, i3, i2dest, i2src); + propagate_for_debug (i2, last_combined_insn, i2dest, i2src); SET_INSN_DELETED (i2); } @@ -4117,7 +4146,7 @@ LOG_LINKS (i1) = 0; REG_NOTES (i1) = 0; if (MAY_HAVE_DEBUG_INSNS) - propagate_for_debug (i1, i3, i1dest, i1src); + propagate_for_debug (i1, last_combined_insn, i1dest, i1src); SET_INSN_DELETED (i1); } @@ -4126,7 +4155,7 @@ LOG_LINKS (i0) = 0; REG_NOTES (i0) = 0; if (MAY_HAVE_DEBUG_INSNS) - propagate_for_debug (i0, i3, i0dest, i0src); + propagate_for_debug (i0, last_combined_insn, i0dest, i0src); SET_INSN_DELETED (i0); } diff -Naur gcc-4.6.0.orig/gcc/common.opt gcc-4.6.0/gcc/common.opt --- gcc-4.6.0.orig/gcc/common.opt 2011-03-06 00:38:13.000000000 +0000 +++ gcc-4.6.0/gcc/common.opt 2011-04-11 15:26:47.458600000 +0000 @@ -456,12 +456,21 @@ Tbss Driver Separate +Tbss= +Driver Joined + Tdata Driver Separate +Tdata= +Driver Joined + Ttext Driver Separate +Ttext= +Driver Joined + W Common RejectNegative Warning Alias(Wextra) This switch is deprecated; use -Wextra instead diff -Naur gcc-4.6.0.orig/gcc/config/alpha/alpha.c gcc-4.6.0/gcc/config/alpha/alpha.c --- gcc-4.6.0.orig/gcc/config/alpha/alpha.c 2010-12-01 13:46:36.000000000 +0000 +++ gcc-4.6.0/gcc/config/alpha/alpha.c 2011-03-29 18:24:02.622508000 +0000 @@ -94,10 +94,6 @@ static int alpha_function_needs_gp; -/* The alias set for prologue/epilogue register save/restore. */ - -static GTY(()) alias_set_type alpha_sr_alias_set; - /* The assembler name of the current function. */ static const char *alpha_fnname; @@ -510,9 +506,6 @@ if (align_functions <= 0) align_functions = 16; - /* Acquire a unique set number for our register saves and restores. */ - alpha_sr_alias_set = new_alias_set (); - /* Register variables and functions with the garbage collector. */ /* Set up function hooks. */ @@ -7715,8 +7708,7 @@ rtx addr, mem, insn; addr = plus_constant (base_reg, base_ofs); - mem = gen_rtx_MEM (DImode, addr); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, addr); insn = emit_move_insn (mem, value); RTX_FRAME_RELATED_P (insn) = 1; @@ -8391,9 +8383,7 @@ /* Restore registers in order, excepting a true frame pointer. */ - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, reg_offset)); - if (! eh_ofs) - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, plus_constant (sa_reg, reg_offset)); reg = gen_rtx_REG (DImode, REG_RA); emit_move_insn (reg, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); @@ -8408,8 +8398,8 @@ fp_offset = reg_offset; else { - mem = gen_rtx_MEM (DImode, plus_constant(sa_reg, reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, + plus_constant (sa_reg, reg_offset)); reg = gen_rtx_REG (DImode, i); emit_move_insn (reg, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, @@ -8421,8 +8411,7 @@ for (i = 0; i < 31; ++i) if (fmask & (1UL << i)) { - mem = gen_rtx_MEM (DFmode, plus_constant(sa_reg, reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DFmode, plus_constant (sa_reg, reg_offset)); reg = gen_rtx_REG (DFmode, i+32); emit_move_insn (reg, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); @@ -8438,9 +8427,9 @@ for (i = 9; i < 15; i++) if (imask & (1UL << i)) { - mem = gen_rtx_MEM (DImode, plus_constant(hard_frame_pointer_rtx, - reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, + plus_constant (hard_frame_pointer_rtx, + reg_offset)); reg = gen_rtx_REG (DImode, i); emit_move_insn (reg, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); @@ -8450,9 +8439,9 @@ for (i = 2; i < 10; i++) if (fmask & (1UL << i)) { - mem = gen_rtx_MEM (DFmode, plus_constant(hard_frame_pointer_rtx, - reg_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DFmode, + plus_constant (hard_frame_pointer_rtx, + reg_offset)); reg = gen_rtx_REG (DFmode, i+32); emit_move_insn (reg, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); @@ -8460,8 +8449,7 @@ } /* Restore the return address from the DSIB. */ - mem = gen_rtx_MEM (DImode, plus_constant (hard_frame_pointer_rtx, -8)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, plus_constant (hard_frame_pointer_rtx, -8)); reg = gen_rtx_REG (DImode, REG_RA); emit_move_insn (reg, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores); @@ -8524,9 +8512,8 @@ if (TARGET_ABI_UNICOSMK) { emit_insn (gen_blockage ()); - mem = gen_rtx_MEM (DImode, - plus_constant (hard_frame_pointer_rtx, -16)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, + plus_constant (hard_frame_pointer_rtx, -16)); emit_move_insn (hard_frame_pointer_rtx, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, hard_frame_pointer_rtx, cfa_restores); @@ -8534,8 +8521,7 @@ else if (fp_is_frame_pointer) { emit_insn (gen_blockage ()); - mem = gen_rtx_MEM (DImode, plus_constant (sa_reg, fp_offset)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, plus_constant (sa_reg, fp_offset)); emit_move_insn (hard_frame_pointer_rtx, mem); cfa_restores = alloc_reg_note (REG_CFA_RESTORE, hard_frame_pointer_rtx, cfa_restores); @@ -10515,15 +10501,13 @@ /* Save the return address. */ - mem = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx, 56)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, plus_constant (stack_pointer_rtx, 56)); FRP (emit_move_insn (mem, gen_rtx_REG (DImode, REG_RA))); (*imaskP) &= ~(1UL << REG_RA); /* Save the old frame pointer. */ - mem = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx, 48)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, plus_constant (stack_pointer_rtx, 48)); FRP (emit_move_insn (mem, hard_frame_pointer_rtx)); (*imaskP) &= ~(1UL << HARD_FRAME_POINTER_REGNUM); @@ -10532,8 +10516,7 @@ /* Store the SSIB pointer. */ ssib_name = ggc_strdup (unicosmk_ssib_name ()); - mem = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx, 32)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, plus_constant (stack_pointer_rtx, 32)); FRP (emit_move_insn (gen_rtx_REG (DImode, 5), gen_rtx_SYMBOL_REF (Pmode, ssib_name))); @@ -10541,8 +10524,7 @@ /* Save the CIW index. */ - mem = gen_rtx_MEM (DImode, plus_constant (stack_pointer_rtx, 24)); - set_mem_alias_set (mem, alpha_sr_alias_set); + mem = gen_frame_mem (DImode, plus_constant (stack_pointer_rtx, 24)); FRP (emit_move_insn (mem, gen_rtx_REG (DImode, 25))); emit_insn (gen_blockage ()); diff -Naur gcc-4.6.0.orig/gcc/config/alpha/osf5.h gcc-4.6.0/gcc/config/alpha/osf5.h --- gcc-4.6.0.orig/gcc/config/alpha/osf5.h 2010-11-21 00:54:14.000000000 +0000 +++ gcc-4.6.0/gcc/config/alpha/osf5.h 2011-04-11 10:42:23.126775000 +0000 @@ -1,7 +1,7 @@ /* Definitions of target machine for GNU compiler, for DEC Alpha on Tru64 UNIX V5.1. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, - 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010 + 2002, 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Richard Kenner (kenner@vlsi1.ultra.nyu.edu) @@ -223,6 +223,10 @@ #define LD_INIT_SWITCH "-init" #define LD_FINI_SWITCH "-fini" +/* From Tru64 UNIX Object File and Symbol Table Format Specification, + 2.3.5 Alignment, p.19. */ +#define MAX_OFILE_ALIGNMENT (64 * 1024 * BITS_PER_UNIT) + /* Select a format to encode pointers in exception handling data. CODE is 0 for data, 1 for code labels, 2 for function pointers. GLOBAL is true if the symbol may be affected by dynamic relocations. diff -Naur gcc-4.6.0.orig/gcc/config/arm/arm.c gcc-4.6.0/gcc/config/arm/arm.c --- gcc-4.6.0.orig/gcc/config/arm/arm.c 2011-01-29 03:20:57.000000000 +0000 +++ gcc-4.6.0/gcc/config/arm/arm.c 2011-05-05 08:39:40.220991000 +0000 @@ -19564,7 +19564,7 @@ rtx tmp1 = gen_reg_rtx (mode); rtx tmp2 = gen_reg_rtx (mode); - emit_insn (intfn (tmp1, op1, tmp2, op2)); + emit_insn (intfn (tmp1, op1, op2, tmp2)); emit_move_insn (mem, tmp1); mem = adjust_address (mem, mode, GET_MODE_SIZE (mode)); diff -Naur gcc-4.6.0.orig/gcc/config/arm/arm.md gcc-4.6.0/gcc/config/arm/arm.md --- gcc-4.6.0.orig/gcc/config/arm/arm.md 2011-03-15 19:59:25.000000000 +0000 +++ gcc-4.6.0/gcc/config/arm/arm.md 2011-04-13 07:41:08.655425000 +0000 @@ -3690,7 +3690,7 @@ ;; The constraints here are to prevent a *partial* overlap (where %Q0 == %R1). ;; The first alternative allows the common case of a *full* overlap. (define_insn "*arm_negdi2" - [(set (match_operand:DI 0 "s_register_operand" "=&r,r") + [(set (match_operand:DI 0 "s_register_operand" "=r,&r") (neg:DI (match_operand:DI 1 "s_register_operand" "0,r"))) (clobber (reg:CC CC_REGNUM))] "TARGET_ARM" diff -Naur gcc-4.6.0.orig/gcc/config/arm/neon.md gcc-4.6.0/gcc/config/arm/neon.md --- gcc-4.6.0.orig/gcc/config/arm/neon.md 2011-01-03 20:52:22.000000000 +0000 +++ gcc-4.6.0/gcc/config/arm/neon.md 2011-05-06 10:21:26.426798000 +0000 @@ -425,7 +425,7 @@ (match_operand:SI 2 "immediate_operand" "i")))] "TARGET_NEON" { - int elt = ffs ((int) INTVAL (operands[2]) - 1); + int elt = ffs ((int) INTVAL (operands[2])) - 1; if (BYTES_BIG_ENDIAN) elt = GET_MODE_NUNITS (mode) - 1 - elt; operands[2] = GEN_INT (elt); @@ -4079,13 +4079,14 @@ (define_insn "neon_vtrn_internal" [(set (match_operand:VDQW 0 "s_register_operand" "=w") - (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")] - UNSPEC_VTRN1)) - (set (match_operand:VDQW 2 "s_register_operand" "=w") - (unspec:VDQW [(match_operand:VDQW 3 "s_register_operand" "2")] - UNSPEC_VTRN2))] + (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0") + (match_operand:VDQW 2 "s_register_operand" "w")] + UNSPEC_VTRN1)) + (set (match_operand:VDQW 3 "s_register_operand" "=2") + (unspec:VDQW [(match_dup 1) (match_dup 2)] + UNSPEC_VTRN2))] "TARGET_NEON" - "vtrn.\t%0, %2" + "vtrn.\t%0, %3" [(set (attr "neon_type") (if_then_else (ne (symbol_ref "") (const_int 0)) (const_string "neon_bp_simple") @@ -4105,13 +4106,14 @@ (define_insn "neon_vzip_internal" [(set (match_operand:VDQW 0 "s_register_operand" "=w") - (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")] - UNSPEC_VZIP1)) - (set (match_operand:VDQW 2 "s_register_operand" "=w") - (unspec:VDQW [(match_operand:VDQW 3 "s_register_operand" "2")] - UNSPEC_VZIP2))] + (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0") + (match_operand:VDQW 2 "s_register_operand" "w")] + UNSPEC_VZIP1)) + (set (match_operand:VDQW 3 "s_register_operand" "=2") + (unspec:VDQW [(match_dup 1) (match_dup 2)] + UNSPEC_VZIP2))] "TARGET_NEON" - "vzip.\t%0, %2" + "vzip.\t%0, %3" [(set (attr "neon_type") (if_then_else (ne (symbol_ref "") (const_int 0)) (const_string "neon_bp_simple") @@ -4131,13 +4133,14 @@ (define_insn "neon_vuzp_internal" [(set (match_operand:VDQW 0 "s_register_operand" "=w") - (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0")] + (unspec:VDQW [(match_operand:VDQW 1 "s_register_operand" "0") + (match_operand:VDQW 2 "s_register_operand" "w")] UNSPEC_VUZP1)) - (set (match_operand:VDQW 2 "s_register_operand" "=w") - (unspec:VDQW [(match_operand:VDQW 3 "s_register_operand" "2")] - UNSPEC_VUZP2))] + (set (match_operand:VDQW 3 "s_register_operand" "=2") + (unspec:VDQW [(match_dup 1) (match_dup 2)] + UNSPEC_VUZP2))] "TARGET_NEON" - "vuzp.\t%0, %2" + "vuzp.\t%0, %3" [(set (attr "neon_type") (if_then_else (ne (symbol_ref "") (const_int 0)) (const_string "neon_bp_simple") diff -Naur gcc-4.6.0.orig/gcc/config/arm/predicates.md gcc-4.6.0/gcc/config/arm/predicates.md --- gcc-4.6.0.orig/gcc/config/arm/predicates.md 2011-01-03 20:52:22.000000000 +0000 +++ gcc-4.6.0/gcc/config/arm/predicates.md 2011-03-28 10:22:57.435118000 +0000 @@ -610,7 +610,7 @@ ;; TODO: We could check lane numbers more precisely based on the mode. (define_predicate "neon_lane_number" (and (match_code "const_int") - (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 7"))) + (match_test "INTVAL (op) >= 0 && INTVAL (op) <= 15"))) ;; Predicates for named expanders that overlap multiple ISAs. (define_predicate "cmpdi_operand" diff -Naur gcc-4.6.0.orig/gcc/config/i386/constraints.md gcc-4.6.0/gcc/config/i386/constraints.md --- gcc-4.6.0.orig/gcc/config/i386/constraints.md 2009-07-08 16:41:23.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/constraints.md 2011-05-16 20:29:20.002343000 +0000 @@ -149,7 +149,7 @@ (define_constraint "G" "Standard 80387 floating point constant." (and (match_code "const_double") - (match_test "standard_80387_constant_p (op)"))) + (match_test "standard_80387_constant_p (op) > 0"))) ;; This can theoretically be any mode's CONST0_RTX. (define_constraint "C" diff -Naur gcc-4.6.0.orig/gcc/config/i386/i386.c gcc-4.6.0/gcc/config/i386/i386.c --- gcc-4.6.0.orig/gcc/config/i386/i386.c 2011-03-04 17:56:39.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/i386.c 2011-05-16 20:29:20.002343000 +0000 @@ -9981,7 +9981,7 @@ probe that many bytes past the specified size to maintain a protection area at the botton of the stack. */ const int dope = 4 * UNITS_PER_WORD; - rtx size_rtx = GEN_INT (size); + rtx size_rtx = GEN_INT (size), last; /* See if we have a constant small number of probes to generate. If so, that's the easy case. The run-time loop is made up of 11 insns in the @@ -10021,9 +10021,9 @@ emit_stack_probe (stack_pointer_rtx); /* Adjust back to account for the additional first interval. */ - emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx, - plus_constant (stack_pointer_rtx, - PROBE_INTERVAL + dope))); + last = emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx, + plus_constant (stack_pointer_rtx, + PROBE_INTERVAL + dope))); } /* Otherwise, do the same as above, but in a loop. Note that we must be @@ -10084,15 +10084,33 @@ } /* Adjust back to account for the additional first interval. */ - emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx, - plus_constant (stack_pointer_rtx, - PROBE_INTERVAL + dope))); + last = emit_insn (gen_rtx_SET (VOIDmode, stack_pointer_rtx, + plus_constant (stack_pointer_rtx, + PROBE_INTERVAL + dope))); release_scratch_register_on_entry (&sr); } gcc_assert (cfun->machine->fs.cfa_reg != stack_pointer_rtx); - cfun->machine->fs.sp_offset += size; + + /* Even if the stack pointer isn't the CFA register, we need to correctly + describe the adjustments made to it, in particular differentiate the + frame-related ones from the frame-unrelated ones. */ + if (size > 0) + { + rtx expr = gen_rtx_SEQUENCE (VOIDmode, rtvec_alloc (2)); + XVECEXP (expr, 0, 0) + = gen_rtx_SET (VOIDmode, stack_pointer_rtx, + plus_constant (stack_pointer_rtx, -size)); + XVECEXP (expr, 0, 1) + = gen_rtx_SET (VOIDmode, stack_pointer_rtx, + plus_constant (stack_pointer_rtx, + PROBE_INTERVAL + dope + size)); + add_reg_note (last, REG_FRAME_RELATED_EXPR, expr); + RTX_FRAME_RELATED_P (last) = 1; + + cfun->machine->fs.sp_offset += size; + } /* Make sure nothing is scheduled before we are done. */ emit_insn (gen_blockage ()); @@ -10548,8 +10566,8 @@ } /* The stack has already been decremented by the instruction calling us - so we need to probe unconditionally to preserve the protection area. */ - if (flag_stack_check == STATIC_BUILTIN_STACK_CHECK) + so probe if the size is non-negative to preserve the protection area. */ + if (allocate >= 0 && flag_stack_check == STATIC_BUILTIN_STACK_CHECK) { /* We expect the registers to be saved when probes are used. */ gcc_assert (int_registers_saved); @@ -14389,17 +14407,21 @@ fprintf (file, "0x%08x", (unsigned int) l); } - /* These float cases don't actually occur as immediate operands. */ else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode) { - char dstr[30]; + REAL_VALUE_TYPE r; + long l[2]; - real_to_decimal (dstr, CONST_DOUBLE_REAL_VALUE (x), sizeof (dstr), 0, 1); - fputs (dstr, file); + REAL_VALUE_FROM_CONST_DOUBLE (r, x); + REAL_VALUE_TO_TARGET_DOUBLE (r, l); + + if (ASSEMBLER_DIALECT == ASM_ATT) + putc ('$', file); + fprintf (file, "0x%lx%08lx", l[1] & 0xffffffff, l[0] & 0xffffffff); } - else if (GET_CODE (x) == CONST_DOUBLE - && GET_MODE (x) == XFmode) + /* These float cases don't actually occur as immediate operands. */ + else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == XFmode) { char dstr[30]; @@ -17172,11 +17194,15 @@ if (req_mode == CCZmode) return false; /* FALLTHRU */ + case CCZmode: + break; + case CCAmode: case CCCmode: case CCOmode: case CCSmode: - case CCZmode: + if (set_mode != req_mode) + return false; break; default: @@ -28226,7 +28252,7 @@ zero above. We only want to wind up preferring 80387 registers if we plan on doing computation with them. */ if (TARGET_80387 - && standard_80387_constant_p (x)) + && standard_80387_constant_p (x) > 0) { /* Limit class to non-sse. */ if (regclass == FLOAT_SSE_REGS) @@ -31191,10 +31217,19 @@ break; case V2DImode: - use_vec_merge = TARGET_SSE4_1; + use_vec_merge = TARGET_SSE4_1 && TARGET_64BIT; if (use_vec_merge) break; + tmp = gen_reg_rtx (GET_MODE_INNER (mode)); + ix86_expand_vector_extract (false, tmp, target, 1 - elt); + if (elt == 0) + tmp = gen_rtx_VEC_CONCAT (mode, tmp, val); + else + tmp = gen_rtx_VEC_CONCAT (mode, val, tmp); + emit_insn (gen_rtx_SET (VOIDmode, target, tmp)); + return; + case V2DFmode: { rtx op0, op1; diff -Naur gcc-4.6.0.orig/gcc/config/i386/i386.h gcc-4.6.0/gcc/config/i386/i386.h --- gcc-4.6.0.orig/gcc/config/i386/i386.h 2011-01-14 21:03:22.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/i386.h 2011-03-30 10:43:55.372186000 +0000 @@ -1272,7 +1272,7 @@ { 0xe0000000, 0x1f }, /* MMX_REGS */ \ { 0x1fe00100,0x1fe000 }, /* FP_TOP_SSE_REG */ \ { 0x1fe00200,0x1fe000 }, /* FP_SECOND_SSE_REG */ \ -{ 0x1fe0ff00,0x3fe000 }, /* FLOAT_SSE_REGS */ \ +{ 0x1fe0ff00,0x1fe000 }, /* FLOAT_SSE_REGS */ \ { 0x1ffff, 0x1fe0 }, /* FLOAT_INT_REGS */ \ { 0x1fe100ff,0x1fffe0 }, /* INT_SSE_REGS */ \ { 0x1fe1ffff,0x1fffe0 }, /* FLOAT_INT_SSE_REGS */ \ diff -Naur gcc-4.6.0.orig/gcc/config/i386/i386.md gcc-4.6.0/gcc/config/i386/i386.md --- gcc-4.6.0.orig/gcc/config/i386/i386.md 2011-02-19 11:23:02.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/i386.md 2011-05-16 20:29:20.002343000 +0000 @@ -1974,21 +1974,15 @@ return "movdq2q\t{%1, %0|%0, %1}"; case TYPE_SSEMOV: - if (TARGET_AVX) - { - if (get_attr_mode (insn) == MODE_TI) - return "vmovdqa\t{%1, %0|%0, %1}"; - else - return "vmovq\t{%1, %0|%0, %1}"; - } - if (get_attr_mode (insn) == MODE_TI) - return "movdqa\t{%1, %0|%0, %1}"; - /* FALLTHRU */ + return "%vmovdqa\t{%1, %0|%0, %1}"; + /* Handle broken assemblers that require movd instead of movq. */ + if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])) + return "%vmovd\t{%1, %0|%0, %1}"; + return "%vmovq\t{%1, %0|%0, %1}"; case TYPE_MMXMOV: - /* Moves from and into integer register is done using movd - opcode with REX prefix. */ + /* Handle broken assemblers that require movd instead of movq. */ if (GENERAL_REG_P (operands[0]) || GENERAL_REG_P (operands[1])) return "movd\t{%1, %0|%0, %1}"; return "movq\t{%1, %0|%0, %1}"; @@ -2108,7 +2102,7 @@ [(set_attr "type" "*,*,mmx,mmxmov,mmxmov,sselog1,ssemov,ssemov,ssemov,sselog1,ssemov,ssemov,ssemov") (set (attr "prefix") (if_then_else (eq_attr "alternative" "5,6,7,8") - (const_string "vex") + (const_string "maybe_vex") (const_string "orig"))) (set_attr "mode" "DI,DI,DI,DI,DI,TI,DI,TI,DI,V4SF,V2SF,V4SF,V2SF")]) @@ -2408,6 +2402,9 @@ { if (TARGET_PARTIAL_REG_STALL && optimize_function_for_speed_p (cfun)) FAIL; + if (GET_CODE (operands[0]) == SUBREG + && GET_MODE_CLASS (GET_MODE (SUBREG_REG (operands[0]))) != MODE_INT) + FAIL; /* Don't generate memory->memory moves, go through a register */ if (MEM_P (operands[0]) && MEM_P (operands[1])) operands[1] = force_reg (mode, operands[1]); @@ -2839,6 +2836,7 @@ "optimize_function_for_speed_p (cfun) && !(MEM_P (operands[0]) && MEM_P (operands[1])) && (reload_in_progress || reload_completed + || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || GET_CODE (operands[1]) != CONST_DOUBLE || memory_operand (operands[0], XFmode))" { @@ -2868,7 +2866,8 @@ "optimize_function_for_size_p (cfun) && !(MEM_P (operands[0]) && MEM_P (operands[1])) && (reload_in_progress || reload_completed - || standard_80387_constant_p (operands[1]) + || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) + || standard_80387_constant_p (operands[1]) > 0 || GET_CODE (operands[1]) != CONST_DOUBLE || memory_operand (operands[0], XFmode))" { @@ -2906,15 +2905,15 @@ (define_insn "*movdf_internal_rex64" [(set (match_operand:DF 0 "nonimmediate_operand" - "=f,m,f,r ,m ,Y2*x,Y2*x,Y2*x,m ,Yi,r ") + "=f,m,f,r ,m,!r,!m,Y2*x,Y2*x,Y2*x,m ,Yi,r ") (match_operand:DF 1 "general_operand" - "fm,f,G,rmF,Fr,C ,Y2*x,m ,Y2*x,r ,Yi"))] + "fm,f,G,rm,r,F ,F ,C ,Y2*x,m ,Y2*x,r ,Yi"))] "TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1])) && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || (!(TARGET_SSE2 && TARGET_SSE_MATH) && optimize_function_for_size_p (cfun) - && standard_80387_constant_p (operands[1])) + && standard_80387_constant_p (operands[1]) > 0) || GET_CODE (operands[1]) != CONST_DOUBLE || memory_operand (operands[0], DFmode))" { @@ -2929,9 +2928,15 @@ case 3: case 4: - return "#"; + return "mov{q}\t{%1, %0|%0, %1}"; case 5: + return "movabs{q}\t{%1, %0|%0, %1}"; + + case 6: + return "#"; + + case 7: switch (get_attr_mode (insn)) { case MODE_V4SF: @@ -2949,9 +2954,9 @@ default: gcc_unreachable (); } - case 6: - case 7: case 8: + case 9: + case 10: switch (get_attr_mode (insn)) { case MODE_V4SF: @@ -2986,17 +2991,28 @@ gcc_unreachable (); } - case 9: - case 10: - return "%vmovd\t{%1, %0|%0, %1}"; + case 11: + case 12: + /* Handle broken assemblers that require movd instead of movq. */ + return "%vmovd\t{%1, %0|%0, %1}"; default: gcc_unreachable(); } } - [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov") + [(set_attr "type" "fmov,fmov,fmov,imov,imov,imov,multi,sselog1,ssemov,ssemov,ssemov,ssemov,ssemov") + (set (attr "modrm") + (if_then_else + (and (eq_attr "alternative" "5") (eq_attr "type" "imov")) + (const_string "0") + (const_string "*"))) + (set (attr "length_immediate") + (if_then_else + (and (eq_attr "alternative" "5") (eq_attr "type" "imov")) + (const_string "8") + (const_string "*"))) (set (attr "prefix") - (if_then_else (eq_attr "alternative" "0,1,2,3,4") + (if_then_else (eq_attr "alternative" "0,1,2,3,4,5,6") (const_string "orig") (const_string "maybe_vex"))) (set (attr "prefix_data16") @@ -3006,18 +3022,18 @@ (set (attr "mode") (cond [(eq_attr "alternative" "0,1,2") (const_string "DF") - (eq_attr "alternative" "3,4,9,10") + (eq_attr "alternative" "3,4,5,6,11,12") (const_string "DI") /* For SSE1, we have many fewer alternatives. */ (eq (symbol_ref "TARGET_SSE2") (const_int 0)) - (cond [(eq_attr "alternative" "5,6") + (cond [(eq_attr "alternative" "7,8") (const_string "V4SF") ] (const_string "V2SF")) /* xorps is one byte shorter. */ - (eq_attr "alternative" "5") + (eq_attr "alternative" "7") (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0)) (const_string "V4SF") @@ -3032,7 +3048,7 @@ chains, otherwise use short move to avoid extra work. movaps encodes one byte shorter. */ - (eq_attr "alternative" "6") + (eq_attr "alternative" "8") (cond [(ne (symbol_ref "optimize_function_for_size_p (cfun)") (const_int 0)) @@ -3045,7 +3061,7 @@ /* For architectures resolving dependencies on register parts we may avoid extra work to zero out upper part of register. */ - (eq_attr "alternative" "7") + (eq_attr "alternative" "9") (if_then_else (ne (symbol_ref "TARGET_SSE_SPLIT_REGS") (const_int 0)) @@ -3059,14 +3075,11 @@ "=f,m,f,r ,o ,Y2*x,Y2*x,Y2*x,m ") (match_operand:DF 1 "general_operand" "fm,f,G,roF,Fr,C ,Y2*x,m ,Y2*x"))] - "!(MEM_P (operands[0]) && MEM_P (operands[1])) + "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1])) && optimize_function_for_speed_p (cfun) && TARGET_INTEGER_DFMODE_MOVES && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) - || (!(TARGET_SSE2 && TARGET_SSE_MATH) - && optimize_function_for_size_p (cfun) - && standard_80387_constant_p (operands[1])) || GET_CODE (operands[1]) != CONST_DOUBLE || memory_operand (operands[0], DFmode))" { @@ -3087,17 +3100,17 @@ switch (get_attr_mode (insn)) { case MODE_V4SF: - return "xorps\t%0, %0"; + return "%vxorps\t%0, %d0"; case MODE_V2DF: if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) - return "xorps\t%0, %0"; + return "%vxorps\t%0, %d0"; else - return "xorpd\t%0, %0"; + return "%vxorpd\t%0, %d0"; case MODE_TI: if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) - return "xorps\t%0, %0"; + return "%vxorps\t%0, %d0"; else - return "pxor\t%0, %0"; + return "%vpxor\t%0, %d0"; default: gcc_unreachable (); } @@ -3107,34 +3120,62 @@ switch (get_attr_mode (insn)) { case MODE_V4SF: - return "movaps\t{%1, %0|%0, %1}"; + return "%vmovaps\t{%1, %0|%0, %1}"; case MODE_V2DF: if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) - return "movaps\t{%1, %0|%0, %1}"; + return "%vmovaps\t{%1, %0|%0, %1}"; else - return "movapd\t{%1, %0|%0, %1}"; + return "%vmovapd\t{%1, %0|%0, %1}"; case MODE_TI: if (TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL) - return "movaps\t{%1, %0|%0, %1}"; + return "%vmovaps\t{%1, %0|%0, %1}"; else - return "movdqa\t{%1, %0|%0, %1}"; + return "%vmovdqa\t{%1, %0|%0, %1}"; case MODE_DI: - return "movq\t{%1, %0|%0, %1}"; + return "%vmovq\t{%1, %0|%0, %1}"; case MODE_DF: - return "movsd\t{%1, %0|%0, %1}"; + if (TARGET_AVX) + { + if (REG_P (operands[0]) && REG_P (operands[1])) + return "vmovsd\t{%1, %0, %0|%0, %0, %1}"; + else + return "vmovsd\t{%1, %0|%0, %1}"; + } + else + return "movsd\t{%1, %0|%0, %1}"; case MODE_V1DF: - return "movlpd\t{%1, %0|%0, %1}"; + if (TARGET_AVX) + { + if (REG_P (operands[0])) + return "vmovlpd\t{%1, %0, %0|%0, %0, %1}"; + else + return "vmovlpd\t{%1, %0|%0, %1}"; + } + else + return "movlpd\t{%1, %0|%0, %1}"; case MODE_V2SF: - return "movlps\t{%1, %0|%0, %1}"; + if (TARGET_AVX) + { + if (REG_P (operands[0])) + return "vmovlps\t{%1, %0, %0|%0, %0, %1}"; + else + return "vmovlps\t{%1, %0|%0, %1}"; + } + else + return "movlps\t{%1, %0|%0, %1}"; default: gcc_unreachable (); } default: - gcc_unreachable(); + gcc_unreachable (); } } [(set_attr "type" "fmov,fmov,fmov,multi,multi,sselog1,ssemov,ssemov,ssemov") + (set (attr "prefix") + (if_then_else (eq_attr "alternative" "0,1,2,3,4") + (const_string "orig") + (const_string "maybe_vex"))) (set (attr "prefix_data16") (if_then_else (eq_attr "mode" "V1DF") (const_string "1") @@ -3198,20 +3239,19 @@ [(set (match_operand:DF 0 "nonimmediate_operand" "=f,m,f,*r ,o ,Y2*x,Y2*x,Y2*x ,m ") (match_operand:DF 1 "general_operand" - "fm,f,G,*roF,*Fr,C ,Y2*x,mY2*x,Y2*x"))] - "!(MEM_P (operands[0]) && MEM_P (operands[1])) - && ((optimize_function_for_size_p (cfun) - || !TARGET_INTEGER_DFMODE_MOVES) && !TARGET_64BIT) + "fm,f,G,*roF,F*r,C ,Y2*x,mY2*x,Y2*x"))] + "!TARGET_64BIT && !(MEM_P (operands[0]) && MEM_P (operands[1])) + && (optimize_function_for_size_p (cfun) + || !TARGET_INTEGER_DFMODE_MOVES) && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || (!(TARGET_SSE2 && TARGET_SSE_MATH) && optimize_function_for_size_p (cfun) && !memory_operand (operands[0], DFmode) - && standard_80387_constant_p (operands[1])) + && standard_80387_constant_p (operands[1]) > 0) || GET_CODE (operands[1]) != CONST_DOUBLE || ((optimize_function_for_size_p (cfun) - || !TARGET_MEMORY_MISMATCH_STALL - || reload_in_progress || reload_completed) + || !TARGET_MEMORY_MISMATCH_STALL) && memory_operand (operands[0], DFmode)))" { switch (which_alternative) @@ -3385,7 +3425,7 @@ && (reload_in_progress || reload_completed || (ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_LARGE) || (!TARGET_SSE_MATH && optimize_function_for_size_p (cfun) - && standard_80387_constant_p (operands[1])) + && standard_80387_constant_p (operands[1]) > 0) || GET_CODE (operands[1]) != CONST_DOUBLE || memory_operand (operands[0], SFmode))" { @@ -3422,12 +3462,13 @@ case 9: case 10: case 14: case 15: return "movd\t{%1, %0|%0, %1}"; - case 12: case 13: - return "%vmovd\t{%1, %0|%0, %1}"; case 11: return "movq\t{%1, %0|%0, %1}"; + case 12: case 13: + return "%vmovd\t{%1, %0|%0, %1}"; + default: gcc_unreachable (); } @@ -3497,7 +3538,7 @@ } else if (FP_REG_P (r)) { - if (!standard_80387_constant_p (c)) + if (standard_80387_constant_p (c) < 1) FAIL; } else if (MMX_REG_P (r)) @@ -3529,7 +3570,7 @@ } else if (FP_REG_P (r)) { - if (!standard_80387_constant_p (c)) + if (standard_80387_constant_p (c) < 1) FAIL; } else if (MMX_REG_P (r)) diff -Naur gcc-4.6.0.orig/gcc/config/i386/mmx.md gcc-4.6.0/gcc/config/i386/mmx.md --- gcc-4.6.0.orig/gcc/config/i386/mmx.md 2011-01-03 20:52:22.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/mmx.md 2011-05-04 17:01:43.174413000 +0000 @@ -63,6 +63,7 @@ DONE; }) +;; movd instead of movq is required to handle broken assemblers. (define_insn "*mov_internal_rex64" [(set (match_operand:MMXMODEI8 0 "nonimmediate_operand" "=rm,r,!?y,!y,!?y,m ,!y ,*Y2,x,x ,m,r ,Yi") @@ -196,6 +197,7 @@ (const_string "orig"))) (set_attr "mode" "DI,DI,DI,DI,DI,DI,DI,DI,V4SF,V4SF,V2SF,V2SF,DI,DI")]) +;; movd instead of movq is required to handle broken assemblers. (define_insn "*movv2sf_internal_rex64" [(set (match_operand:V2SF 0 "nonimmediate_operand" "=rm,r,!?y,!y,!?y,m ,!y ,*Y2,x,x,x,m,r ,Yi") diff -Naur gcc-4.6.0.orig/gcc/config/i386/predicates.md gcc-4.6.0/gcc/config/i386/predicates.md --- gcc-4.6.0.orig/gcc/config/i386/predicates.md 2011-01-03 20:52:22.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/predicates.md 2011-04-07 20:46:50.015612000 +0000 @@ -969,13 +969,8 @@ ;; Return true if OP is a comparison that can be used in the CMPSS/CMPPS insns. ;; The first set are supported directly; the second set can't be done with ;; full IEEE support, i.e. NaNs. -;; -;; ??? It would seem that we have a lot of uses of this predicate that pass -;; it the wrong mode. We got away with this because the old function didn't -;; check the mode at all. Mirror that for now by calling this a special -;; predicate. -(define_special_predicate "sse_comparison_operator" +(define_predicate "sse_comparison_operator" (match_code "eq,lt,le,unordered,ne,unge,ungt,ordered")) ;; Return true if OP is a comparison operator that can be issued by diff -Naur gcc-4.6.0.orig/gcc/config/i386/sse.md gcc-4.6.0/gcc/config/i386/sse.md --- gcc-4.6.0.orig/gcc/config/i386/sse.md 2011-03-03 19:56:56.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/sse.md 2011-05-04 17:01:43.174413000 +0000 @@ -1,5 +1,5 @@ ;; GCC machine description for SSE instructions -;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 ;; Free Software Foundation, Inc. ;; ;; This file is part of GCC. @@ -1557,7 +1557,7 @@ (set_attr "mode" "")]) (define_insn "avx_cmp3" - [(set (match_operand:SSEMODEF2P 0 "register_operand" "") + [(set (match_operand:SSEMODEF2P 0 "register_operand" "=x") (vec_merge:SSEMODEF2P (unspec:SSEMODEF2P [(match_operand:SSEMODEF2P 1 "register_operand" "x") @@ -2715,6 +2715,7 @@ (set_attr "prefix" "maybe_vex") (set_attr "mode" "TI") (set_attr "amdfam10_decode" "double") + (set_attr "athlon_decode" "vector") (set_attr "bdver1_decode" "double")]) (define_insn "avx_cvttpd2dq256" @@ -2746,6 +2747,7 @@ (set_attr "prefix" "maybe_vex") (set_attr "mode" "TI") (set_attr "amdfam10_decode" "double") + (set_attr "athlon_decode" "vector") (set_attr "bdver1_decode" "double")]) (define_insn "*avx_cvtsd2ss" @@ -2806,6 +2808,7 @@ "cvtss2sd\t{%2, %0|%0, %2}" [(set_attr "type" "ssecvt") (set_attr "amdfam10_decode" "vector,double") + (set_attr "athlon_decode" "direct,direct") (set_attr "bdver1_decode" "direct,direct") (set_attr "mode" "DF")]) @@ -2842,6 +2845,7 @@ (set_attr "prefix" "maybe_vex") (set_attr "mode" "V4SF") (set_attr "amdfam10_decode" "double") + (set_attr "athlon_decode" "vector") (set_attr "bdver1_decode" "double")]) (define_insn "avx_cvtps2pd256" @@ -2879,6 +2883,7 @@ (set_attr "mode" "V2DF") (set_attr "prefix_data16" "0") (set_attr "amdfam10_decode" "direct") + (set_attr "athlon_decode" "double") (set_attr "bdver1_decode" "double")]) (define_expand "vec_unpacks_hi_v4sf" @@ -3841,7 +3846,7 @@ (define_insn "*vec_concatv2sf_avx" [(set (match_operand:V2SF 0 "register_operand" "=x,x,x,*y ,*y") (vec_concat:V2SF - (match_operand:SF 1 "nonimmediate_operand" " x,x,m, x , m") + (match_operand:SF 1 "nonimmediate_operand" " x,x,m, 0 , m") (match_operand:SF 2 "vector_move_operand" " x,m,C,*ym, C")))] "TARGET_AVX" "@ @@ -3930,13 +3935,15 @@ DONE; }) +;; Avoid combining registers from different units in a single alternative, +;; see comment above inline_secondary_memory_needed function in i386.c (define_insn "*vec_set_0_avx" - [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x,x, x,x, x,m") + [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x,x, x,x, x,m, m,m") (vec_merge:SSEMODE4S (vec_duplicate:SSEMODE4S (match_operand: 2 - "general_operand" " x,m,*r,x,*rm,x*rfF")) - (match_operand:SSEMODE4S 1 "vector_move_operand" " C,C, C,x, x,0") + "general_operand" " x,m,*r,x,*rm,x,*r,fF")) + (match_operand:SSEMODE4S 1 "vector_move_operand" " C,C, C,x, x,0, 0,0") (const_int 1)))] "TARGET_AVX" "@ @@ -3945,20 +3952,24 @@ vmovd\t{%2, %0|%0, %2} vmovss\t{%2, %1, %0|%0, %1, %2} vpinsrd\t{$0, %2, %1, %0|%0, %1, %2, 0} + # + # #" - [(set_attr "type" "sselog,ssemov,ssemov,ssemov,sselog,*") - (set_attr "prefix_extra" "*,*,*,*,1,*") - (set_attr "length_immediate" "*,*,*,*,1,*") + [(set_attr "type" "sselog,ssemov,ssemov,ssemov,sselog,*,*,*") + (set_attr "prefix_extra" "*,*,*,*,1,*,*,*") + (set_attr "length_immediate" "*,*,*,*,1,*,*,*") (set_attr "prefix" "vex") - (set_attr "mode" "SF,,SI,SF,TI,*")]) + (set_attr "mode" "SF,,SI,SF,TI,*,*,*")]) +;; Avoid combining registers from different units in a single alternative, +;; see comment above inline_secondary_memory_needed function in i386.c (define_insn "*vec_set_0_sse4_1" - [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x,x, x,x, x,m") + [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x,x, x,x, x, m,m") (vec_merge:SSEMODE4S (vec_duplicate:SSEMODE4S (match_operand: 2 - "general_operand" " x,m,*r,x,*rm,*rfF")) - (match_operand:SSEMODE4S 1 "vector_move_operand" " C,C, C,0, 0,0") + "general_operand" " x,m,*r,x,*rm,*r,fF")) + (match_operand:SSEMODE4S 1 "vector_move_operand" " C,C, C,0, 0, 0,0") (const_int 1)))] "TARGET_SSE4_1" "@ @@ -3967,44 +3978,53 @@ movd\t{%2, %0|%0, %2} movss\t{%2, %0|%0, %2} pinsrd\t{$0, %2, %0|%0, %2, 0} + # #" - [(set_attr "type" "sselog,ssemov,ssemov,ssemov,sselog,*") - (set_attr "prefix_extra" "*,*,*,*,1,*") - (set_attr "length_immediate" "*,*,*,*,1,*") - (set_attr "mode" "SF,,SI,SF,TI,*")]) + [(set_attr "type" "sselog,ssemov,ssemov,ssemov,sselog,*,*") + (set_attr "prefix_extra" "*,*,*,*,1,*,*") + (set_attr "length_immediate" "*,*,*,*,1,*,*") + (set_attr "mode" "SF,,SI,SF,TI,*,*")]) +;; Avoid combining registers from different units in a single alternative, +;; see comment above inline_secondary_memory_needed function in i386.c (define_insn "*vec_set_0_sse2" - [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x, x,x,m") + [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x, x,x,m, m,m") (vec_merge:SSEMODE4S (vec_duplicate:SSEMODE4S (match_operand: 2 - "general_operand" " m,*r,x,x*rfF")) - (match_operand:SSEMODE4S 1 "vector_move_operand" " C, C,0,0") + "general_operand" " m,*r,x,x,*r,fF")) + (match_operand:SSEMODE4S 1 "vector_move_operand" " C, C,0,0, 0,0") (const_int 1)))] "TARGET_SSE2" "@ mov\t{%2, %0|%0, %2} movd\t{%2, %0|%0, %2} movss\t{%2, %0|%0, %2} + # + # #" [(set_attr "type" "ssemov") - (set_attr "mode" ",SI,SF,*")]) + (set_attr "mode" ",SI,SF,*,*,*")]) +;; Avoid combining registers from different units in a single alternative, +;; see comment above inline_secondary_memory_needed function in i386.c (define_insn "vec_set_0" - [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x,x,m") + [(set (match_operand:SSEMODE4S 0 "nonimmediate_operand" "=x,x,m, m,m") (vec_merge:SSEMODE4S (vec_duplicate:SSEMODE4S (match_operand: 2 - "general_operand" " m,x,x*rfF")) - (match_operand:SSEMODE4S 1 "vector_move_operand" " C,0,0") + "general_operand" " m,x,x,*r,fF")) + (match_operand:SSEMODE4S 1 "vector_move_operand" " C,0,0, 0,0") (const_int 1)))] "TARGET_SSE" "@ movss\t{%2, %0|%0, %2} movss\t{%2, %0|%0, %2} + # + # #" [(set_attr "type" "ssemov") - (set_attr "mode" "SF,SF,*")]) + (set_attr "mode" "SF,SF,*,*,*")]) ;; A subset is vec_setv4sf. (define_insn "*vec_setv4sf_avx" @@ -4050,7 +4070,16 @@ (match_operand:SI 3 "const_0_to_255_operand" "n")] UNSPEC_INSERTPS))] "TARGET_AVX" - "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}"; +{ + if (MEM_P (operands[2])) + { + unsigned count_s = INTVAL (operands[3]) >> 6; + if (count_s) + operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f); + operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4); + } + return "vinsertps\t{%3, %2, %1, %0|%0, %1, %2, %3}"; +} [(set_attr "type" "sselog") (set_attr "prefix" "vex") (set_attr "prefix_extra" "1") @@ -4059,12 +4088,21 @@ (define_insn "sse4_1_insertps" [(set (match_operand:V4SF 0 "register_operand" "=x") - (unspec:V4SF [(match_operand:V4SF 2 "register_operand" "x") + (unspec:V4SF [(match_operand:V4SF 2 "nonimmediate_operand" "xm") (match_operand:V4SF 1 "register_operand" "0") (match_operand:SI 3 "const_0_to_255_operand" "n")] UNSPEC_INSERTPS))] "TARGET_SSE4_1" - "insertps\t{%3, %2, %0|%0, %2, %3}"; +{ + if (MEM_P (operands[2])) + { + unsigned count_s = INTVAL (operands[3]) >> 6; + if (count_s) + operands[3] = GEN_INT (INTVAL (operands[3]) & 0x3f); + operands[2] = adjust_address_nv (operands[2], SFmode, count_s * 4); + } + return "insertps\t{%3, %2, %0|%0, %2, %3}"; +} [(set_attr "type" "sselog") (set_attr "prefix_data16" "1") (set_attr "prefix_extra" "1") @@ -4806,6 +4844,8 @@ (set_attr "prefix" "vex") (set_attr "mode" "V1DF,V2DF,DF,DF,DF")]) +;; Avoid combining registers from different units in a single alternative, +;; see comment above inline_secondary_memory_needed function in i386.c (define_insn "sse2_storehpd" [(set (match_operand:DF 0 "nonimmediate_operand" "=m,x,x,*f,r") (vec_select:DF @@ -4907,6 +4947,8 @@ (set_attr "prefix" "vex") (set_attr "mode" "V1DF,V2DF,DF,DF,DF")]) +;; Avoid combining registers from different units in a single alternative, +;; see comment above inline_secondary_memory_needed function in i386.c (define_insn "sse2_loadhpd" [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,x,o,o,o") (vec_concat:V2DF @@ -4978,6 +5020,8 @@ (set_attr "prefix" "vex") (set_attr "mode" "DF,V1DF,V1DF,V1DF,DF,DF,DF")]) +;; Avoid combining registers from different units in a single alternative, +;; see comment above inline_secondary_memory_needed function in i386.c (define_insn "sse2_loadlpd" [(set (match_operand:V2DF 0 "nonimmediate_operand" "=x,x,x,x,x,m,m,m") (vec_concat:V2DF @@ -7390,9 +7434,8 @@ "@ # # - %vmov{q}\t{%1, %0|%0, %1}" + mov{q}\t{%1, %0|%0, %1}" [(set_attr "type" "*,*,imov") - (set_attr "prefix" "*,*,maybe_vex") (set_attr "mode" "*,*,DI")]) (define_insn "*sse2_storeq" @@ -7428,11 +7471,11 @@ vmovhps\t{%1, %0|%0, %1} vpsrldq\t{$8, %1, %0|%0, %1, 8} vmovq\t{%H1, %0|%0, %H1} - vmov{q}\t{%H1, %0|%0, %H1}" + mov{q}\t{%H1, %0|%0, %H1}" [(set_attr "type" "ssemov,sseishft1,ssemov,imov") (set_attr "length_immediate" "*,1,*,*") (set_attr "memory" "*,none,*,*") - (set_attr "prefix" "vex") + (set_attr "prefix" "vex,vex,vex,orig") (set_attr "mode" "V2SF,TI,TI,DI")]) (define_insn "*vec_extractv2di_1_rex64" @@ -7710,6 +7753,7 @@ (const_string "vex"))) (set_attr "mode" "TI,TI,TI,TI,TI,V2SF")]) +;; movd instead of movq is required to handle broken assemblers. (define_insn "*vec_concatv2di_rex64_sse4_1" [(set (match_operand:V2DI 0 "register_operand" "=x ,x ,Yi,!x,x,x,x") (vec_concat:V2DI @@ -7730,6 +7774,7 @@ (set_attr "length_immediate" "1,*,*,*,*,*,*") (set_attr "mode" "TI,TI,TI,TI,TI,V4SF,V2SF")]) +;; movd instead of movq is required to handle broken assemblers. (define_insn "*vec_concatv2di_rex64_sse" [(set (match_operand:V2DI 0 "register_operand" "=Y2 ,Yi,!Y2,Y2,x,x") (vec_concat:V2DI diff -Naur gcc-4.6.0.orig/gcc/config/i386/sync.md gcc-4.6.0/gcc/config/i386/sync.md --- gcc-4.6.0.orig/gcc/config/i386/sync.md 2010-05-17 20:28:56.000000000 +0000 +++ gcc-4.6.0/gcc/config/i386/sync.md 2011-05-17 07:42:30.110077000 +0000 @@ -1,5 +1,5 @@ ;; GCC machine description for i386 synchronization instructions. -;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 +;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 ;; Free Software Foundation, Inc. ;; ;; This file is part of GCC. @@ -164,13 +164,16 @@ "!TARGET_64BIT && TARGET_CMPXCHG8B && flag_pic" "xchg{l}\t%%ebx, %3\;lock{%;} cmpxchg8b\t%1\;xchg{l}\t%%ebx, %3") +;; For operand 2 nonmemory_operand predicate is used instead of +;; register_operand to allow combiner to better optimize atomic +;; additions of constants. (define_insn "sync_old_add" [(set (match_operand:SWI 0 "register_operand" "=") (unspec_volatile:SWI [(match_operand:SWI 1 "memory_operand" "+m")] UNSPECV_XCHG)) (set (match_dup 1) (plus:SWI (match_dup 1) - (match_operand:SWI 2 "register_operand" "0"))) + (match_operand:SWI 2 "nonmemory_operand" "0"))) (clobber (reg:CC FLAGS_REG))] "TARGET_XADD" "lock{%;} xadd{}\t{%0, %1|%1, %0}") diff -Naur gcc-4.6.0.orig/gcc/config/pa/pa-protos.h gcc-4.6.0/gcc/config/pa/pa-protos.h --- gcc-4.6.0.orig/gcc/config/pa/pa-protos.h 2010-10-09 14:21:10.000000000 +0000 +++ gcc-4.6.0/gcc/config/pa/pa-protos.h 2011-04-20 23:36:20.127349000 +0000 @@ -80,7 +80,6 @@ extern int prefetch_cc_operand (rtx, enum machine_mode); extern int prefetch_nocc_operand (rtx, enum machine_mode); extern int and_operand (rtx, enum machine_mode); -extern int ior_operand (rtx, enum machine_mode); extern int arith32_operand (rtx, enum machine_mode); extern int uint32_operand (rtx, enum machine_mode); extern int reg_before_reload_operand (rtx, enum machine_mode); @@ -95,7 +94,6 @@ extern int fmpyaddoperands (rtx *); extern int fmpysuboperands (rtx *); extern int call_operand_address (rtx, enum machine_mode); -extern int ior_operand (rtx, enum machine_mode); extern void emit_bcond_fp (rtx[]); extern int emit_move_sequence (rtx *, enum machine_mode, rtx); extern int emit_hpdiv_const (rtx *, int); diff -Naur gcc-4.6.0.orig/gcc/config/pa/pa.c gcc-4.6.0/gcc/config/pa/pa.c --- gcc-4.6.0.orig/gcc/config/pa/pa.c 2011-01-18 21:53:47.000000000 +0000 +++ gcc-4.6.0/gcc/config/pa/pa.c 2011-04-13 22:36:59.547676000 +0000 @@ -1467,6 +1467,8 @@ { if (from == SHIFT_REGS) return 0x100; + else if (to == SHIFT_REGS && FP_REG_CLASS_P (from)) + return 18; else if ((FP_REG_CLASS_P (from) && ! FP_REG_CLASS_P (to)) || (FP_REG_CLASS_P (to) && ! FP_REG_CLASS_P (from))) return 16; @@ -1810,15 +1812,12 @@ return 1; } /* Handle secondary reloads for SAR. These occur when trying to load - the SAR from memory, FP register, or with a constant. */ + the SAR from memory or a constant. */ else if (scratch_reg && GET_CODE (operand0) == REG && REGNO (operand0) < FIRST_PSEUDO_REGISTER && REGNO_REG_CLASS (REGNO (operand0)) == SHIFT_REGS - && (GET_CODE (operand1) == MEM - || GET_CODE (operand1) == CONST_INT - || (GET_CODE (operand1) == REG - && FP_REG_CLASS_P (REGNO_REG_CLASS (REGNO (operand1)))))) + && (GET_CODE (operand1) == MEM || GET_CODE (operand1) == CONST_INT)) { /* D might not fit in 14 bits either; for such cases load D into scratch reg. */ @@ -5883,6 +5882,10 @@ fputc ('\n', asm_out_file); } +/* Inform reload about cases where moving X with a mode MODE to a register in + RCLASS requires an extra scratch or immediate register. Return the class + needed for the immediate register. */ + static reg_class_t pa_secondary_reload (bool in_p, rtx x, reg_class_t rclass_i, enum machine_mode mode, secondary_reload_info *sri) @@ -5985,24 +5988,29 @@ return NO_REGS; } - /* We need a secondary register (GPR) for copies between the SAR - and anything other than a general register. */ - if (rclass == SHIFT_REGS && (regno <= 0 || regno >= 32)) - { - sri->icode = (in_p - ? direct_optab_handler (reload_in_optab, mode) - : direct_optab_handler (reload_out_optab, mode)); - return NO_REGS; + /* A SAR<->FP register copy requires an intermediate general register + and secondary memory. We need a secondary reload with a general + scratch register for spills. */ + if (rclass == SHIFT_REGS) + { + /* Handle spill. */ + if (regno >= FIRST_PSEUDO_REGISTER || regno < 0) + { + sri->icode = (in_p + ? direct_optab_handler (reload_in_optab, mode) + : direct_optab_handler (reload_out_optab, mode)); + return NO_REGS; + } + + /* Handle FP copy. */ + if (FP_REG_CLASS_P (REGNO_REG_CLASS (regno))) + return GENERAL_REGS; } - /* A SAR<->FP register copy requires a secondary register (GPR) as - well as secondary memory. */ if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER - && (REGNO_REG_CLASS (regno) == SHIFT_REGS - && FP_REG_CLASS_P (rclass))) - sri->icode = (in_p - ? direct_optab_handler (reload_in_optab, mode) - : direct_optab_handler (reload_out_optab, mode)); + && REGNO_REG_CLASS (regno) == SHIFT_REGS + && FP_REG_CLASS_P (rclass)) + return GENERAL_REGS; return NO_REGS; } diff -Naur gcc-4.6.0.orig/gcc/config/pa/pa.md gcc-4.6.0/gcc/config/pa/pa.md --- gcc-4.6.0.orig/gcc/config/pa/pa.md 2011-03-03 21:56:58.000000000 +0000 +++ gcc-4.6.0/gcc/config/pa/pa.md 2011-04-20 23:36:20.127349000 +0000 @@ -5686,7 +5686,7 @@ (define_expand "iordi3" [(set (match_operand:DI 0 "register_operand" "") (ior:DI (match_operand:DI 1 "register_operand" "") - (match_operand:DI 2 "ior_operand" "")))] + (match_operand:DI 2 "reg_or_cint_ior_operand" "")))] "" " { @@ -5707,7 +5707,7 @@ (define_insn "" [(set (match_operand:DI 0 "register_operand" "=r,r") (ior:DI (match_operand:DI 1 "register_operand" "0,0") - (match_operand:DI 2 "ior_operand" "M,i")))] + (match_operand:DI 2 "cint_ior_operand" "M,i")))] "TARGET_64BIT" "* return output_64bit_ior (operands); " [(set_attr "type" "binary,shift") @@ -5726,19 +5726,14 @@ (define_expand "iorsi3" [(set (match_operand:SI 0 "register_operand" "") (ior:SI (match_operand:SI 1 "register_operand" "") - (match_operand:SI 2 "arith32_operand" "")))] + (match_operand:SI 2 "reg_or_cint_ior_operand" "")))] "" - " -{ - if (! (ior_operand (operands[2], SImode) - || register_operand (operands[2], SImode))) - operands[2] = force_reg (SImode, operands[2]); -}") + "") (define_insn "" [(set (match_operand:SI 0 "register_operand" "=r,r") (ior:SI (match_operand:SI 1 "register_operand" "0,0") - (match_operand:SI 2 "ior_operand" "M,i")))] + (match_operand:SI 2 "cint_ior_operand" "M,i")))] "" "* return output_ior (operands); " [(set_attr "type" "binary,shift") diff -Naur gcc-4.6.0.orig/gcc/config/pa/pa32-regs.h gcc-4.6.0/gcc/config/pa/pa32-regs.h --- gcc-4.6.0.orig/gcc/config/pa/pa32-regs.h 2010-11-22 01:57:50.000000000 +0000 +++ gcc-4.6.0/gcc/config/pa/pa32-regs.h 2011-04-13 22:36:59.547676000 +0000 @@ -209,6 +209,7 @@ registers. */ #define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((REGNO) == 0 ? (MODE) == CCmode || (MODE) == CCFPmode \ + : (REGNO) == 88 ? SCALAR_INT_MODE_P (MODE) \ : !TARGET_PA_11 && FP_REGNO_P (REGNO) \ ? (VALID_FP_MODE_P (MODE) \ && (GET_MODE_SIZE (MODE) <= 8 \ diff -Naur gcc-4.6.0.orig/gcc/config/pa/pa64-regs.h gcc-4.6.0/gcc/config/pa/pa64-regs.h --- gcc-4.6.0.orig/gcc/config/pa/pa64-regs.h 2010-11-22 01:57:50.000000000 +0000 +++ gcc-4.6.0/gcc/config/pa/pa64-regs.h 2011-04-13 22:36:59.547676000 +0000 @@ -149,10 +149,11 @@ /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE. On the HP-PA, the cpu registers can hold any mode. We - force this to be an even register is it cannot hold the full mode. */ + force this to be an even register if it cannot hold the full mode. */ #define HARD_REGNO_MODE_OK(REGNO, MODE) \ ((REGNO) == 0 \ ? (MODE) == CCmode || (MODE) == CCFPmode \ + : (REGNO) == 60 ? SCALAR_INT_MODE_P (MODE) \ /* Make wide modes be in aligned registers. */ \ : FP_REGNO_P (REGNO) \ ? (VALID_FP_MODE_P (MODE) \ diff -Naur gcc-4.6.0.orig/gcc/config/pa/predicates.md gcc-4.6.0/gcc/config/pa/predicates.md --- gcc-4.6.0.orig/gcc/config/pa/predicates.md 2011-01-03 20:52:22.000000000 +0000 +++ gcc-4.6.0/gcc/config/pa/predicates.md 2011-04-20 23:36:20.127349000 +0000 @@ -411,11 +411,15 @@ ;; True iff depi can be used to compute (reg | OP). -(define_predicate "ior_operand" - (match_code "const_int") -{ - return (GET_CODE (op) == CONST_INT && ior_mask_p (INTVAL (op))); -}) +(define_predicate "cint_ior_operand" + (and (match_code "const_int") + (match_test "ior_mask_p (INTVAL (op))"))) + +;; True iff OP can be used to compute (reg | OP). + +(define_predicate "reg_or_cint_ior_operand" + (ior (match_operand 0 "register_operand") + (match_operand 0 "cint_ior_operand"))) ;; True iff OP is a CONST_INT of the forms 0...0xxxx or ;; 0...01...1xxxx. Such values can be the left hand side x in (x << diff -Naur gcc-4.6.0.orig/gcc/config/rs6000/altivec.md gcc-4.6.0/gcc/config/rs6000/altivec.md --- gcc-4.6.0.orig/gcc/config/rs6000/altivec.md 2011-02-03 05:42:19.000000000 +0000 +++ gcc-4.6.0/gcc/config/rs6000/altivec.md 2011-04-28 22:39:59.485927000 +0000 @@ -2430,7 +2430,7 @@ (define_expand "vec_extract_evenv4si" [(set (match_operand:V4SI 0 "register_operand" "") - (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "") + (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "") (match_operand:V4SI 2 "register_operand" "")] UNSPEC_EXTEVEN_V4SI))] "TARGET_ALTIVEC" @@ -2463,7 +2463,7 @@ (define_expand "vec_extract_evenv4sf" [(set (match_operand:V4SF 0 "register_operand" "") - (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "") + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "") (match_operand:V4SF 2 "register_operand" "")] UNSPEC_EXTEVEN_V4SF))] "TARGET_ALTIVEC" @@ -2495,7 +2495,7 @@ }") (define_expand "vec_extract_evenv8hi" - [(set (match_operand:V4SI 0 "register_operand" "") + [(set (match_operand:V8HI 0 "register_operand" "") (unspec:V8HI [(match_operand:V8HI 1 "register_operand" "") (match_operand:V8HI 2 "register_operand" "")] UNSPEC_EXTEVEN_V8HI))] @@ -2528,9 +2528,9 @@ }") (define_expand "vec_extract_evenv16qi" - [(set (match_operand:V4SI 0 "register_operand" "") - (unspec:V8HI [(match_operand:V16QI 1 "register_operand" "") - (match_operand:V16QI 2 "register_operand" "")] + [(set (match_operand:V16QI 0 "register_operand" "") + (unspec:V16QI [(match_operand:V16QI 1 "register_operand" "") + (match_operand:V16QI 2 "register_operand" "")] UNSPEC_EXTEVEN_V16QI))] "TARGET_ALTIVEC" " @@ -2562,7 +2562,7 @@ (define_expand "vec_extract_oddv4si" [(set (match_operand:V4SI 0 "register_operand" "") - (unspec:V8HI [(match_operand:V4SI 1 "register_operand" "") + (unspec:V4SI [(match_operand:V4SI 1 "register_operand" "") (match_operand:V4SI 2 "register_operand" "")] UNSPEC_EXTODD_V4SI))] "TARGET_ALTIVEC" @@ -2595,7 +2595,7 @@ (define_expand "vec_extract_oddv4sf" [(set (match_operand:V4SF 0 "register_operand" "") - (unspec:V8HI [(match_operand:V4SF 1 "register_operand" "") + (unspec:V4SF [(match_operand:V4SF 1 "register_operand" "") (match_operand:V4SF 2 "register_operand" "")] UNSPEC_EXTODD_V4SF))] "TARGET_ALTIVEC" diff -Naur gcc-4.6.0.orig/gcc/config/rs6000/rs6000.c gcc-4.6.0/gcc/config/rs6000/rs6000.c --- gcc-4.6.0.orig/gcc/config/rs6000/rs6000.c 2011-03-15 12:57:37.000000000 +0000 +++ gcc-4.6.0/gcc/config/rs6000/rs6000.c 2011-05-10 19:59:20.426663000 +0000 @@ -4630,6 +4630,7 @@ target_flags_explicit |= MASK_SOFT_FLOAT; rs6000_single_float = rs6000_double_float = 0; } + break; case OPT_mrecip: rs6000_recip_name = (value) ? "default" : "none"; @@ -6544,10 +6545,11 @@ if (model == TLS_MODEL_GLOBAL_DYNAMIC) { - r3 = gen_rtx_REG (Pmode, 3); tga = rs6000_tls_get_addr (); - emit_library_call_value (tga, dest, LCT_CONST, Pmode, 1, r3, Pmode); + emit_library_call_value (tga, dest, LCT_CONST, Pmode, + 1, const0_rtx, Pmode); + r3 = gen_rtx_REG (Pmode, 3); if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT) insn = gen_tls_gd_aix64 (r3, got, addr, tga, const0_rtx); else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT) @@ -6564,11 +6566,12 @@ } else if (model == TLS_MODEL_LOCAL_DYNAMIC) { - r3 = gen_rtx_REG (Pmode, 3); tga = rs6000_tls_get_addr (); tmp1 = gen_reg_rtx (Pmode); - emit_library_call_value (tga, tmp1, LCT_CONST, Pmode, 1, r3, Pmode); + emit_library_call_value (tga, tmp1, LCT_CONST, Pmode, + 1, const0_rtx, Pmode); + r3 = gen_rtx_REG (Pmode, 3); if (DEFAULT_ABI == ABI_AIX && TARGET_64BIT) insn = gen_tls_ld_aix64 (r3, got, tga, const0_rtx); else if (DEFAULT_ABI == ABI_AIX && !TARGET_64BIT) @@ -7888,7 +7891,7 @@ /* Nonzero if we can use an AltiVec register to pass this arg. */ #define USE_ALTIVEC_FOR_ARG_P(CUM,MODE,TYPE,NAMED) \ - ((ALTIVEC_VECTOR_MODE (MODE) || VSX_VECTOR_MODE (MODE)) \ + (ALTIVEC_OR_VSX_VECTOR_MODE (MODE) \ && (CUM)->vregno <= ALTIVEC_ARG_MAX_REG \ && TARGET_ALTIVEC_ABI \ && (NAMED)) @@ -8088,8 +8091,7 @@ } if (SCALAR_FLOAT_MODE_P (return_mode)) rs6000_passes_float = true; - else if (ALTIVEC_VECTOR_MODE (return_mode) - || VSX_VECTOR_MODE (return_mode) + else if (ALTIVEC_OR_VSX_VECTOR_MODE (return_mode) || SPE_VECTOR_MODE (return_mode)) rs6000_passes_vector = true; } @@ -8187,7 +8189,7 @@ existing library interfaces. Doubleword align SPE vectors. - Quadword align Altivec vectors. + Quadword align Altivec/VSX vectors. Quadword align large synthetic vector types. */ static unsigned int @@ -8204,7 +8206,7 @@ && int_size_in_bytes (type) >= 8 && int_size_in_bytes (type) < 16)) return 64; - else if ((ALTIVEC_VECTOR_MODE (mode) || VSX_VECTOR_MODE (mode)) + else if (ALTIVEC_OR_VSX_VECTOR_MODE (mode) || (type && TREE_CODE (type) == VECTOR_TYPE && int_size_in_bytes (type) >= 16)) return 128; @@ -8424,7 +8426,7 @@ { if (SCALAR_FLOAT_MODE_P (mode)) rs6000_passes_float = true; - else if (named && (ALTIVEC_VECTOR_MODE (mode) || VSX_VECTOR_MODE (mode))) + else if (named && ALTIVEC_OR_VSX_VECTOR_MODE (mode)) rs6000_passes_vector = true; else if (SPE_VECTOR_MODE (mode) && !cum->stdarg @@ -8434,8 +8436,7 @@ #endif if (TARGET_ALTIVEC_ABI - && (ALTIVEC_VECTOR_MODE (mode) - || VSX_VECTOR_MODE (mode) + && (ALTIVEC_OR_VSX_VECTOR_MODE (mode) || (type && TREE_CODE (type) == VECTOR_TYPE && int_size_in_bytes (type) == 16))) { @@ -9053,8 +9054,7 @@ else return gen_rtx_REG (mode, cum->vregno); else if (TARGET_ALTIVEC_ABI - && (ALTIVEC_VECTOR_MODE (mode) - || VSX_VECTOR_MODE (mode) + && (ALTIVEC_OR_VSX_VECTOR_MODE (mode) || (type && TREE_CODE (type) == VECTOR_TYPE && int_size_in_bytes (type) == 16))) { @@ -19980,7 +19980,7 @@ /* Some cases that need register indexed addressing. */ if ((TARGET_ALTIVEC_ABI && ALTIVEC_VECTOR_MODE (mode)) - || (TARGET_VSX && VSX_VECTOR_MODE (mode)) + || (TARGET_VSX && ALTIVEC_OR_VSX_VECTOR_MODE (mode)) || (TARGET_E500_DOUBLE && mode == DFmode) || (TARGET_SPE_ABI && SPE_VECTOR_MODE (mode) @@ -27263,13 +27263,12 @@ else if (TREE_CODE (valtype) == COMPLEX_TYPE && targetm.calls.split_complex_arg) return rs6000_complex_function_value (mode); + /* VSX is a superset of Altivec and adds V2DImode/V2DFmode. Since the same + return register is used in both cases, and we won't see V2DImode/V2DFmode + for pure altivec, combine the two cases. */ else if (TREE_CODE (valtype) == VECTOR_TYPE && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI - && ALTIVEC_VECTOR_MODE (mode)) - regno = ALTIVEC_ARG_RETURN; - else if (TREE_CODE (valtype) == VECTOR_TYPE - && TARGET_VSX && TARGET_ALTIVEC_ABI - && VSX_VECTOR_MODE (mode)) + && ALTIVEC_OR_VSX_VECTOR_MODE (mode)) regno = ALTIVEC_ARG_RETURN; else if (TARGET_E500_DOUBLE && TARGET_HARD_FLOAT && (mode == DFmode || mode == DCmode @@ -27309,12 +27308,12 @@ && TARGET_HARD_FLOAT && TARGET_FPRS && ((TARGET_SINGLE_FLOAT && mode == SFmode) || TARGET_DOUBLE_FLOAT)) regno = FP_ARG_RETURN; - else if (ALTIVEC_VECTOR_MODE (mode) + /* VSX is a superset of Altivec and adds V2DImode/V2DFmode. Since the same + return register is used in both cases, and we won't see V2DImode/V2DFmode + for pure altivec, combine the two cases. */ + else if (ALTIVEC_OR_VSX_VECTOR_MODE (mode) && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI) regno = ALTIVEC_ARG_RETURN; - else if (VSX_VECTOR_MODE (mode) - && TARGET_VSX && TARGET_ALTIVEC_ABI) - regno = ALTIVEC_ARG_RETURN; else if (COMPLEX_MODE_P (mode) && targetm.calls.split_complex_arg) return rs6000_complex_function_value (mode); else if (TARGET_E500_DOUBLE && TARGET_HARD_FLOAT diff -Naur gcc-4.6.0.orig/gcc/config/rs6000/rs6000.h gcc-4.6.0/gcc/config/rs6000/rs6000.h --- gcc-4.6.0.orig/gcc/config/rs6000/rs6000.h 2011-03-07 19:27:09.000000000 +0000 +++ gcc-4.6.0/gcc/config/rs6000/rs6000.h 2011-05-10 19:59:20.426663000 +0000 @@ -1007,10 +1007,9 @@ /* When setting up caller-save slots (MODE == VOIDmode) ensure we allocate enough space to account for vectors in FP regs. */ -#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ - (TARGET_VSX \ - && ((MODE) == VOIDmode || VSX_VECTOR_MODE (MODE) \ - || ALTIVEC_VECTOR_MODE (MODE)) \ +#define HARD_REGNO_CALLER_SAVE_MODE(REGNO, NREGS, MODE) \ + (TARGET_VSX \ + && ((MODE) == VOIDmode || ALTIVEC_OR_VSX_VECTOR_MODE (MODE)) \ && FP_REGNO_P (REGNO) \ ? V2DFmode \ : choose_hard_reg_mode ((REGNO), (NREGS), false)) @@ -1026,25 +1025,16 @@ ((MODE) == V4SFmode \ || (MODE) == V2DFmode) \ -#define VSX_SCALAR_MODE(MODE) \ - ((MODE) == DFmode) - -#define VSX_MODE(MODE) \ - (VSX_VECTOR_MODE (MODE) \ - || VSX_SCALAR_MODE (MODE)) - -#define VSX_MOVE_MODE(MODE) \ - (VSX_VECTOR_MODE (MODE) \ - || VSX_SCALAR_MODE (MODE) \ - || ALTIVEC_VECTOR_MODE (MODE) \ - || (MODE) == TImode) - #define ALTIVEC_VECTOR_MODE(MODE) \ ((MODE) == V16QImode \ || (MODE) == V8HImode \ || (MODE) == V4SFmode \ || (MODE) == V4SImode) +#define ALTIVEC_OR_VSX_VECTOR_MODE(MODE) \ + (ALTIVEC_VECTOR_MODE (MODE) || VSX_VECTOR_MODE (MODE) \ + || (MODE) == V2DImode) + #define SPE_VECTOR_MODE(MODE) \ ((MODE) == V4HImode \ || (MODE) == V2SFmode \ @@ -1080,10 +1070,10 @@ ? ALTIVEC_VECTOR_MODE (MODE2) \ : ALTIVEC_VECTOR_MODE (MODE2) \ ? ALTIVEC_VECTOR_MODE (MODE1) \ - : VSX_VECTOR_MODE (MODE1) \ - ? VSX_VECTOR_MODE (MODE2) \ - : VSX_VECTOR_MODE (MODE2) \ - ? VSX_VECTOR_MODE (MODE1) \ + : ALTIVEC_OR_VSX_VECTOR_MODE (MODE1) \ + ? ALTIVEC_OR_VSX_VECTOR_MODE (MODE2) \ + : ALTIVEC_OR_VSX_VECTOR_MODE (MODE2) \ + ? ALTIVEC_OR_VSX_VECTOR_MODE (MODE1) \ : 1) /* Post-reload, we can't use any new AltiVec registers, as we already diff -Naur gcc-4.6.0.orig/gcc/config/rs6000/vector.md gcc-4.6.0/gcc/config/rs6000/vector.md --- gcc-4.6.0.orig/gcc/config/rs6000/vector.md 2011-02-03 05:42:19.000000000 +0000 +++ gcc-4.6.0/gcc/config/rs6000/vector.md 2011-04-28 22:39:59.485927000 +0000 @@ -872,8 +872,8 @@ ;; Under VSX, vectors of 4/8 byte alignments do not need to be aligned ;; since the load already handles it. (define_expand "movmisalign" - [(set (match_operand:VEC_N 0 "vfloat_operand" "") - (match_operand:VEC_N 1 "vfloat_operand" ""))] + [(set (match_operand:VEC_N 0 "nonimmediate_operand" "") + (match_operand:VEC_N 1 "any_operand" ""))] "VECTOR_MEM_VSX_P (mode) && TARGET_ALLOW_MOVMISALIGN" "") diff -Naur gcc-4.6.0.orig/gcc/config/rx/predicates.md gcc-4.6.0/gcc/config/rx/predicates.md --- gcc-4.6.0.orig/gcc/config/rx/predicates.md 2011-02-10 16:03:48.000000000 +0000 +++ gcc-4.6.0/gcc/config/rx/predicates.md 2011-03-29 12:27:07.579849000 +0000 @@ -284,7 +284,7 @@ ) (define_predicate "rx_zs_comparison_operator" - (match_code "eq,ne,lt,ge") + (match_code "eq,ne") ) ;; GT and LE omitted due to operand swap required. diff -Naur gcc-4.6.0.orig/gcc/config/rx/rx-protos.h gcc-4.6.0/gcc/config/rx/rx-protos.h --- gcc-4.6.0.orig/gcc/config/rx/rx-protos.h 2011-02-14 21:31:41.000000000 +0000 +++ gcc-4.6.0/gcc/config/rx/rx-protos.h 2011-05-10 10:34:44.270243000 +0000 @@ -30,16 +30,17 @@ extern int rx_initial_elimination_offset (int, int); #ifdef RTX_CODE +extern int rx_align_for_label (rtx, int); extern void rx_emit_stack_popm (rtx *, bool); extern void rx_emit_stack_pushm (rtx *); extern void rx_expand_epilogue (bool); extern char * rx_gen_move_template (rtx *, bool); extern bool rx_is_legitimate_constant (rtx); extern bool rx_is_restricted_memory_address (rtx, Mmode); -extern void rx_notice_update_cc (rtx body, rtx insn); +extern bool rx_match_ccmode (rtx, Mmode); +extern void rx_notice_update_cc (rtx, rtx); extern void rx_split_cbranch (Mmode, Rcode, rtx, rtx, rtx); extern Mmode rx_select_cc_mode (Rcode, rtx, rtx); -extern bool rx_match_ccmode (rtx, Mmode); #endif #endif /* GCC_RX_PROTOS_H */ diff -Naur gcc-4.6.0.orig/gcc/config/rx/rx.c gcc-4.6.0/gcc/config/rx/rx.c --- gcc-4.6.0.orig/gcc/config/rx/rx.c 2011-02-14 21:31:41.000000000 +0000 +++ gcc-4.6.0/gcc/config/rx/rx.c 2011-05-17 08:59:10.966263000 +0000 @@ -57,7 +57,7 @@ #define CC_FLAG_Z (1 << 1) #define CC_FLAG_O (1 << 2) #define CC_FLAG_C (1 << 3) -#define CC_FLAG_FP (1 << 4) /* fake, to differentiate CC_Fmode */ +#define CC_FLAG_FP (1 << 4) /* Fake, to differentiate CC_Fmode. */ static unsigned int flags_from_mode (enum machine_mode mode); static unsigned int flags_from_code (enum rtx_code code); @@ -85,7 +85,9 @@ /* Register Indirect. */ return true; - if (GET_MODE_SIZE (mode) == 4 + if ((GET_MODE_SIZE (mode) == 4 + || GET_MODE_SIZE (mode) == 2 + || GET_MODE_SIZE (mode) == 1) && (GET_CODE (x) == PRE_DEC || GET_CODE (x) == POST_INC)) /* Pre-decrement Register Indirect or Post-increment Register Indirect. */ @@ -187,7 +189,10 @@ base = XEXP (mem, 0); index = XEXP (mem, 1); - return RX_REG_P (base) && CONST_INT_P (index); + if (! RX_REG_P (base) || ! CONST_INT_P (index)) + return false; + + return IN_RANGE (INTVAL (index), 0, (0x10000 * GET_MODE_SIZE (mode)) - 1); case SYMBOL_REF: /* Can happen when small data is being supported. @@ -386,11 +391,14 @@ %L Print low part of a DImode register, integer or address. %N Print the negation of the immediate value. %Q If the operand is a MEM, then correctly generate - register indirect or register relative addressing. */ + register indirect or register relative addressing. + %R Like %Q but for zero-extending loads. */ static void rx_print_operand (FILE * file, rtx op, int letter) { + bool unsigned_load = false; + switch (letter) { case 'A': @@ -450,6 +458,7 @@ else { unsigned int flags = flags_from_mode (mode); + switch (code) { case LT: @@ -588,10 +597,15 @@ rx_print_integer (file, - INTVAL (op)); break; + case 'R': + gcc_assert (GET_MODE_SIZE (GET_MODE (op)) < 4); + unsigned_load = true; + /* Fall through. */ case 'Q': if (MEM_P (op)) { HOST_WIDE_INT offset; + rtx mem = op; op = XEXP (op, 0); @@ -626,22 +640,24 @@ rx_print_operand (file, op, 0); fprintf (file, "]."); - switch (GET_MODE_SIZE (GET_MODE (op))) + switch (GET_MODE_SIZE (GET_MODE (mem))) { case 1: - gcc_assert (offset < 65535 * 1); - fprintf (file, "B"); + gcc_assert (offset <= 65535 * 1); + fprintf (file, unsigned_load ? "UB" : "B"); break; case 2: gcc_assert (offset % 2 == 0); - gcc_assert (offset < 65535 * 2); - fprintf (file, "W"); + gcc_assert (offset <= 65535 * 2); + fprintf (file, unsigned_load ? "UW" : "W"); break; - default: + case 4: gcc_assert (offset % 4 == 0); - gcc_assert (offset < 65535 * 4); + gcc_assert (offset <= 65535 * 4); fprintf (file, "L"); break; + default: + gcc_unreachable (); } break; } @@ -2336,6 +2352,13 @@ flag_strict_volatile_bitfields = 1; rx_override_options_after_change (); + + if (align_jumps == 0 && ! optimize_size) + align_jumps = 3; + if (align_loops == 0 && ! optimize_size) + align_loops = 3; + if (align_labels == 0 && ! optimize_size) + align_labels = 3; } /* Implement TARGET_OPTION_OPTIMIZATION_TABLE. */ @@ -2428,8 +2451,7 @@ default: /* FIXME: Can this ever happen ? */ - abort (); - return false; + gcc_unreachable (); } break; @@ -2570,9 +2592,11 @@ } static int -rx_memory_move_cost (enum machine_mode mode, reg_class_t regclass, bool in) +rx_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, + reg_class_t regclass ATTRIBUTE_UNUSED, + bool in) { - return 2 + memory_move_secondary_cost (mode, regclass, in); + return (in ? 2 : 0) + REGISTER_MOVE_COST (mode, regclass, regclass); } /* Convert a CC_MODE to the set of flags that it represents. */ @@ -2728,6 +2752,52 @@ } +int +rx_align_for_label (rtx lab, int uses_threshold) +{ + /* This is a simple heuristic to guess when an alignment would not be useful + because the delay due to the inserted NOPs would be greater than the delay + due to the misaligned branch. If uses_threshold is zero then the alignment + is always useful. */ + if (LABEL_P (lab) && LABEL_NUSES (lab) < uses_threshold) + return 0; + + return optimize_size ? 1 : 3; +} + +static int +rx_max_skip_for_label (rtx lab) +{ + int opsize; + rtx op; + + if (lab == NULL_RTX) + return 0; + op = lab; + do + { + op = next_nonnote_nondebug_insn (op); + } + while (op && (LABEL_P (op) + || (INSN_P (op) && GET_CODE (PATTERN (op)) == USE))); + if (!op) + return 0; + + opsize = get_attr_length (op); + if (opsize >= 0 && opsize < 8) + return opsize - 1; + return 0; +} + +#undef TARGET_ASM_JUMP_ALIGN_MAX_SKIP +#define TARGET_ASM_JUMP_ALIGN_MAX_SKIP rx_max_skip_for_label +#undef TARGET_ASM_LOOP_ALIGN_MAX_SKIP +#define TARGET_ASM_LOOP_ALIGN_MAX_SKIP rx_max_skip_for_label +#undef TARGET_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP +#define TARGET_LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP rx_max_skip_for_label +#undef TARGET_ASM_LABEL_ALIGN_MAX_SKIP +#define TARGET_ASM_LABEL_ALIGN_MAX_SKIP rx_max_skip_for_label + #undef TARGET_FUNCTION_VALUE #define TARGET_FUNCTION_VALUE rx_function_value diff -Naur gcc-4.6.0.orig/gcc/config/rx/rx.h gcc-4.6.0/gcc/config/rx/rx.h --- gcc-4.6.0.orig/gcc/config/rx/rx.h 2011-02-17 17:51:02.000000000 +0000 +++ gcc-4.6.0/gcc/config/rx/rx.h 2011-05-12 09:44:14.691413000 +0000 @@ -155,7 +155,7 @@ #define LEGITIMATE_CONSTANT_P(X) rx_is_legitimate_constant (X) -#define HAVE_PRE_DECCREMENT 1 +#define HAVE_PRE_DECREMENT 1 #define HAVE_POST_INCREMENT 1 #define MOVE_RATIO(SPEED) ((SPEED) ? 4 : 2) @@ -615,4 +615,29 @@ #define BRANCH_COST(SPEED,PREDICT) 1 #define REGISTER_MOVE_COST(MODE,FROM,TO) 2 -#define SELECT_CC_MODE(OP,X,Y) rx_select_cc_mode(OP, X, Y) +#define SELECT_CC_MODE(OP,X,Y) rx_select_cc_mode((OP), (X), (Y)) + +/* Compute the alignment needed for label X in various situations. + If the user has specified an alignment then honour that, otherwise + use rx_align_for_label. */ +#define JUMP_ALIGN(x) (align_jumps ? align_jumps : rx_align_for_label (x, 0)) +#define LABEL_ALIGN(x) (align_labels ? align_labels : rx_align_for_label (x, 3)) +#define LOOP_ALIGN(x) (align_loops ? align_loops : rx_align_for_label (x, 2)) +#define LABEL_ALIGN_AFTER_BARRIER(x) rx_align_for_label (x, 0) + +#define ASM_OUTPUT_MAX_SKIP_ALIGN(STREAM, LOG, MAX_SKIP) \ + do \ + { \ + if ((LOG) == 0 || (MAX_SKIP) == 0) \ + break; \ + if (TARGET_AS100_SYNTAX) \ + { \ + if ((LOG) >= 2) \ + fprintf (STREAM, "\t.ALIGN 4\t; %d alignment actually requested\n", 1 << (LOG)); \ + else \ + fprintf (STREAM, "\t.ALIGN 2\n"); \ + } \ + else \ + fprintf (STREAM, "\t.balign %d,3,%d\n", 1 << (LOG), (MAX_SKIP)); \ + } \ + while (0) diff -Naur gcc-4.6.0.orig/gcc/config/rx/rx.md gcc-4.6.0/gcc/config/rx/rx.md --- gcc-4.6.0.orig/gcc/config/rx/rx.md 2011-03-10 11:30:33.000000000 +0000 +++ gcc-4.6.0/gcc/config/rx/rx.md 2011-05-17 08:46:51.876914000 +0000 @@ -904,6 +904,39 @@ (set_attr "length" "3,4,5,6,7,6")] ) +;; Peepholes to match: +;; (set (reg A) (reg B)) +;; (set (CC) (compare:CC (reg A/reg B) (const_int 0))) +;; and replace them with the addsi3_flags pattern, using an add +;; of zero to copy the register and set the condition code bits. +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (match_operand:SI 1 "register_operand")) + (set (reg:CC CC_REG) + (compare:CC (match_dup 0) + (const_int 0)))] + "" + [(parallel [(set (match_dup 0) + (plus:SI (match_dup 1) (const_int 0))) + (set (reg:CC_ZSC CC_REG) + (compare:CC_ZSC (plus:SI (match_dup 1) (const_int 0)) + (const_int 0)))])] +) + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (match_operand:SI 1 "register_operand")) + (set (reg:CC CC_REG) + (compare:CC (match_dup 1) + (const_int 0)))] + "" + [(parallel [(set (match_dup 0) + (plus:SI (match_dup 1) (const_int 0))) + (set (reg:CC_ZSC CC_REG) + (compare:CC_ZSC (plus:SI (match_dup 1) (const_int 0)) + (const_int 0)))])] +) + (define_expand "adddi3" [(set (match_operand:DI 0 "register_operand") (plus:DI (match_operand:DI 1 "register_operand") @@ -1545,6 +1578,168 @@ (set_attr "length" "3,4,5,6,7,6")] ) +;; A set of peepholes to catch extending loads followed by arithmetic operations. +;; We use iterators where possible to reduce the amount of typing and hence the +;; possibilities for typos. + +(define_code_iterator extend_types [(zero_extend "") (sign_extend "")]) +(define_code_attr letter [(zero_extend "R") (sign_extend "Q")]) + +(define_code_iterator memex_commutative [(plus "") (and "") (ior "") (xor "")]) +(define_code_iterator memex_noncomm [(div "") (udiv "") (minus "")]) +(define_code_iterator memex_nocc [(smax "") (smin "") (mult "")]) + +(define_code_attr op [(plus "add") (and "and") (div "div") (udiv "divu") (smax "max") (smin "min") (mult "mul") (ior "or") (minus "sub") (xor "xor")]) + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand"))) + (parallel [(set (match_operand:SI 2 "register_operand") + (memex_commutative:SI (match_dup 0) + (match_dup 2))) + (clobber (reg:CC CC_REG))])] + "peep2_regno_dead_p (2, REGNO (operands[0]))" + [(parallel [(set:SI (match_dup 2) + (memex_commutative:SI (match_dup 2) + (extend_types:SI (match_dup 1)))) + (clobber (reg:CC CC_REG))])] +) + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand"))) + (parallel [(set (match_operand:SI 2 "register_operand") + (memex_commutative:SI (match_dup 2) + (match_dup 0))) + (clobber (reg:CC CC_REG))])] + "peep2_regno_dead_p (2, REGNO (operands[0]))" + [(parallel [(set:SI (match_dup 2) + (memex_commutative:SI (match_dup 2) + (extend_types:SI (match_dup 1)))) + (clobber (reg:CC CC_REG))])] +) + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand"))) + (parallel [(set (match_operand:SI 2 "register_operand") + (memex_noncomm:SI (match_dup 2) + (match_dup 0))) + (clobber (reg:CC CC_REG))])] + "peep2_regno_dead_p (2, REGNO (operands[0]))" + [(parallel [(set:SI (match_dup 2) + (memex_noncomm:SI (match_dup 2) + (extend_types:SI (match_dup 1)))) + (clobber (reg:CC CC_REG))])] +) + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand"))) + (set (match_operand:SI 2 "register_operand") + (memex_nocc:SI (match_dup 0) + (match_dup 2)))] + "peep2_regno_dead_p (2, REGNO (operands[0]))" + [(set:SI (match_dup 2) + (memex_nocc:SI (match_dup 2) + (extend_types:SI (match_dup 1))))] +) + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand"))) + (set (match_operand:SI 2 "register_operand") + (memex_nocc:SI (match_dup 2) + (match_dup 0)))] + "peep2_regno_dead_p (2, REGNO (operands[0]))" + [(set:SI (match_dup 2) + (memex_nocc:SI (match_dup 2) + (extend_types:SI (match_dup 1))))] +) + +(define_insn "*si3_" + [(set (match_operand:SI 0 "register_operand" "=r") + (memex_commutative:SI (match_operand:SI 1 "register_operand" "%0") + (extend_types:SI (match_operand:small_int_modes 2 "rx_restricted_mem_operand" "Q")))) + (clobber (reg:CC CC_REG))] + "" + "\t%2, %0" + [(set_attr "timings" "33") + (set_attr "length" "5")] ;; Worst case sceanario. FIXME: If we defined separate patterns +) ;; rather than using iterators we could specify exact sizes. + +(define_insn "*si3_" + [(set (match_operand:SI 0 "register_operand" "=r") + (memex_noncomm:SI (match_operand:SI 1 "register_operand" "0") + (extend_types:SI (match_operand:small_int_modes 2 "rx_restricted_mem_operand" "Q")))) + (clobber (reg:CC CC_REG))] + "" + "\t%2, %0" + [(set_attr "timings" "33") + (set_attr "length" "5")] ;; Worst case sceanario. FIXME: If we defined separate patterns +) ;; rather than using iterators we could specify exact sizes. + +(define_insn "*si3_" + [(set (match_operand:SI 0 "register_operand" "=r") + (memex_nocc:SI (match_operand:SI 1 "register_operand" "%0") + (extend_types:SI (match_operand:small_int_modes 2 "rx_restricted_mem_operand" "Q"))))] + "" + "\t%2, %0" + [(set_attr "timings" "33") + (set_attr "length" "5")] ;; Worst case sceanario. FIXME: If we defined separate patterns +) ;; rather than using iterators we could specify exact sizes. + +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand"))) + (set (reg:CC CC_REG) + (compare:CC (match_operand:SI 2 "register_operand") + (match_dup 0)))] + "peep2_regno_dead_p (2, REGNO (operands[0]))" + [(set (reg:CC CC_REG) + (compare:CC (match_dup 2) + (extend_types:SI (match_dup 1))))] +) + +;; Convert: +;; (set (reg1) (sign_extend (mem)) +;; (set (reg2) (zero_extend (reg1)) +;; into +;; (set (reg2) (zero_extend (mem))) +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (sign_extend:SI (match_operand:small_int_modes 1 "memory_operand"))) + (set (match_operand:SI 2 "register_operand") + (zero_extend:SI (match_operand:small_int_modes 3 "register_operand")))] + "REGNO (operands[0]) == REGNO (operands[3]) + && (REGNO (operands[0]) == REGNO (operands[2]) + || peep2_regno_dead_p (2, REGNO (operands[0])))" + [(set (match_dup 2) + (zero_extend:SI (match_dup 1)))] +) + +;; Remove the redundant sign extension from: +;; (set (reg) (extend (mem))) +;; (set (reg) (extend (reg))) +(define_peephole2 + [(set (match_operand:SI 0 "register_operand") + (extend_types:SI (match_operand:small_int_modes 1 "memory_operand"))) + (set (match_dup 0) + (extend_types:SI (match_operand:small_int_modes 2 "register_operand")))] + "REGNO (operands[0]) == REGNO (operands[2])" + [(set (match_dup 0) (extend_types:SI (match_dup 1)))] +) + +(define_insn "*comparesi3_" + [(set (reg:CC CC_REG) + (compare:CC (match_operand:SI 0 "register_operand" "=r") + (extend_types:SI (match_operand:small_int_modes 1 "rx_restricted_mem_operand" "Q"))))] + "" + "cmp\t%1, %0" + [(set_attr "timings" "33") + (set_attr "length" "5")] ;; Worst case sceanario. FIXME: If we defined separate patterns +) ;; rather than using iterators we could specify exact sizes. + ;; Floating Point Instructions (define_insn "addsf3" @@ -1636,7 +1831,7 @@ ) (define_insn "*bitset_in_memory" - [(set (match_operand:QI 0 "memory_operand" "+Q") + [(set (match_operand:QI 0 "rx_restricted_mem_operand" "+Q") (ior:QI (ashift:QI (const_int 1) (match_operand:QI 1 "nonmemory_operand" "ri")) (match_dup 0)))] @@ -1657,7 +1852,7 @@ ) (define_insn "*bitinvert_in_memory" - [(set (match_operand:QI 0 "memory_operand" "+Q") + [(set (match_operand:QI 0 "rx_restricted_mem_operand" "+Q") (xor:QI (ashift:QI (const_int 1) (match_operand:QI 1 "nonmemory_operand" "ri")) (match_dup 0)))] @@ -1680,7 +1875,7 @@ ) (define_insn "*bitclr_in_memory" - [(set (match_operand:QI 0 "memory_operand" "+Q") + [(set (match_operand:QI 0 "rx_restricted_mem_operand" "+Q") (and:QI (not:QI (ashift:QI (const_int 1) diff -Naur gcc-4.6.0.orig/gcc/config/s390/s390.c gcc-4.6.0/gcc/config/s390/s390.c --- gcc-4.6.0.orig/gcc/config/s390/s390.c 2011-03-21 09:27:28.000000000 +0000 +++ gcc-4.6.0/gcc/config/s390/s390.c 2011-05-06 11:10:13.285425000 +0000 @@ -3011,14 +3011,20 @@ it is most likely being used as an address, so prefer ADDR_REGS. If 'class' is not a superset of ADDR_REGS, e.g. FP_REGS, reject this reload. */ - case PLUS: case LABEL_REF: case SYMBOL_REF: case CONST: - if (reg_class_subset_p (ADDR_REGS, rclass)) + if (reg_class_subset_p (ADDR_REGS, rclass) + && legitimate_reload_constant_p (op)) return ADDR_REGS; else return NO_REGS; + case PLUS: + /* load address will be used for this reload. */ + if (reg_class_subset_p (ADDR_REGS, rclass)) + return ADDR_REGS; + else + return NO_REGS; default: break; @@ -3134,12 +3140,16 @@ if (TARGET_Z10) { + HOST_WIDE_INT offset; + rtx symref; + /* On z10 several optimizer steps may generate larl operands with an odd addend. */ if (in_p - && s390_symref_operand_p (x, NULL, NULL) + && s390_symref_operand_p (x, &symref, &offset) && mode == Pmode - && !s390_check_symref_alignment (x, 2)) + && !SYMBOL_REF_ALIGN1_P (symref) + && (offset & 1) == 1) sri->icode = ((mode == DImode) ? CODE_FOR_reloaddi_larl_odd_addend_z10 : CODE_FOR_reloadsi_larl_odd_addend_z10); @@ -9271,16 +9281,16 @@ if (TARGET_64BIT) { - output_asm_insn ("basr\t%1,0", op); - output_asm_insn ("lmg\t%0,%1,14(%1)", op); - output_asm_insn ("br\t%1", op); + output_asm_insn ("basr\t%1,0", op); /* 2 byte */ + output_asm_insn ("lmg\t%0,%1,14(%1)", op); /* 6 byte */ + output_asm_insn ("br\t%1", op); /* 2 byte */ ASM_OUTPUT_SKIP (file, (HOST_WIDE_INT)(TRAMPOLINE_SIZE - 10)); } else { - output_asm_insn ("basr\t%1,0", op); - output_asm_insn ("lm\t%0,%1,6(%1)", op); - output_asm_insn ("br\t%1", op); + output_asm_insn ("basr\t%1,0", op); /* 2 byte */ + output_asm_insn ("lm\t%0,%1,6(%1)", op); /* 4 byte */ + output_asm_insn ("br\t%1", op); /* 2 byte */ ASM_OUTPUT_SKIP (file, (HOST_WIDE_INT)(TRAMPOLINE_SIZE - 8)); } } @@ -9296,11 +9306,11 @@ rtx mem; emit_block_move (m_tramp, assemble_trampoline_template (), - GEN_INT (2*UNITS_PER_WORD), BLOCK_OP_NORMAL); + GEN_INT (2 * UNITS_PER_LONG), BLOCK_OP_NORMAL); - mem = adjust_address (m_tramp, Pmode, 2*UNITS_PER_WORD); + mem = adjust_address (m_tramp, Pmode, 2 * UNITS_PER_LONG); emit_move_insn (mem, cxt); - mem = adjust_address (m_tramp, Pmode, 3*UNITS_PER_WORD); + mem = adjust_address (m_tramp, Pmode, 3 * UNITS_PER_LONG); emit_move_insn (mem, fnaddr); } diff -Naur gcc-4.6.0.orig/gcc/config/s390/s390.md gcc-4.6.0/gcc/config/s390/s390.md --- gcc-4.6.0.orig/gcc/config/s390/s390.md 2010-12-09 08:41:21.000000000 +0000 +++ gcc-4.6.0/gcc/config/s390/s390.md 2011-05-09 14:38:22.695745000 +0000 @@ -2026,6 +2026,7 @@ [(set (match_dup 0) (match_dup 1))] { rtx addr = operand_subword (operands[0], 1, 0, mode); + addr = gen_lowpart (Pmode, addr); s390_load_address (addr, XEXP (operands[1], 0)); operands[1] = replace_equiv_address (operands[1], addr); }) @@ -9330,7 +9331,7 @@ (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2))) (clobber (reg:CC CC_REGNUM))]) ; sllg op2, op0, 16 - (set (match_operand:DI 2 "register_operand" "") + (set (match_dup 2) (ashift:DI (match_dup 0) (const_int 16))) ; agr op0, op2 (parallel [(set (match_dup 0) (plus:DI (match_dup 0) (match_dup 2))) @@ -9352,7 +9353,7 @@ UNSPEC_POPCNT)) (clobber (reg:CC CC_REGNUM))]) ; sllk op2, op0, 16 - (set (match_operand:SI 2 "register_operand" "") + (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 16))) ; ar op0, op2 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2))) @@ -9374,7 +9375,7 @@ UNSPEC_POPCNT)) (clobber (reg:CC CC_REGNUM))]) ; sllk op2, op0, 8 - (set (match_operand:SI 2 "register_operand" "") + (set (match_dup 2) (ashift:SI (match_dup 0) (const_int 8))) ; ar op0, op2 (parallel [(set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2))) diff -Naur gcc-4.6.0.orig/gcc/config/sparc/freebsd.h gcc-4.6.0/gcc/config/sparc/freebsd.h --- gcc-4.6.0.orig/gcc/config/sparc/freebsd.h 2011-02-06 18:23:06.000000000 +0000 +++ gcc-4.6.0/gcc/config/sparc/freebsd.h 2011-04-17 21:34:29.443887000 +0000 @@ -24,11 +24,19 @@ { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } /* FreeBSD needs the platform name (sparc64) defined. - Emacs needs to know if the arch is 64 or 32-bits. */ + Emacs etc needs to know if the arch is 64 or 32-bits. + This also selects which targets are available via -mcpu. */ -#undef CPP_CPU64_DEFAULT_SPEC -#define CPP_CPU64_DEFAULT_SPEC \ - "-D__sparc64__ -D__sparc_v9__ -D__sparcv9 -D__arch64__" +#undef FBSD_TARGET_CPU_CPP_BUILTINS +#define FBSD_TARGET_CPU_CPP_BUILTINS() \ + do \ + { \ + builtin_define ("__sparc64__"); \ + builtin_define ("__sparc__"); \ + builtin_define ("__sparc_v9__"); \ + builtin_define ("__sparcv9"); \ + } \ + while (0) #undef ASM_SPEC #define ASM_SPEC "%{fpic|fPIC|fpie|fPIE:-K PIC} %(asm_cpu)" @@ -152,6 +160,13 @@ /* #define DWARF_OFFSET_SIZE PTR_SIZE */ +#ifdef HAVE_AS_TLS +#undef TARGET_SUN_TLS +#undef TARGET_GNU_TLS +#define TARGET_SUN_TLS 0 +#define TARGET_GNU_TLS 1 +#endif + #undef ENDFILE_SPEC #define ENDFILE_SPEC \ "%{ffast-math|funsafe-math-optimizations:crtfastmath.o%s} " \ diff -Naur gcc-4.6.0.orig/gcc/config/spu/t-spu-elf gcc-4.6.0/gcc/config/spu/t-spu-elf --- gcc-4.6.0.orig/gcc/config/spu/t-spu-elf 2010-12-17 14:10:02.000000000 +0000 +++ gcc-4.6.0/gcc/config/spu/t-spu-elf 2011-04-01 17:17:59.394038000 +0000 @@ -1,4 +1,5 @@ -# Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 +# Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free @@ -55,7 +56,7 @@ DPBIT = dp-bit.c dp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/spu/t-spu-elf - cat $(srcdir)/config/fp-bit.c >> dp-bit.c + cat $(srcdir)/config/fp-bit.c > dp-bit.c fp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/spu/t-spu-elf echo '#define FLOAT' > fp-bit.c diff -Naur gcc-4.6.0.orig/gcc/config/v850/v850.c gcc-4.6.0/gcc/config/v850/v850.c --- gcc-4.6.0.orig/gcc/config/v850/v850.c 2010-12-01 13:46:36.000000000 +0000 +++ gcc-4.6.0/gcc/config/v850/v850.c 2011-04-12 11:33:07.800058000 +0000 @@ -1686,7 +1686,7 @@ /* Save/setup global registers for interrupt functions right now. */ if (interrupt_handler) { - if (! TARGET_DISABLE_CALLT) + if (! TARGET_DISABLE_CALLT && (TARGET_V850E || TARGET_V850E2_ALL)) emit_insn (gen_callt_save_interrupt ()); else emit_insn (gen_save_interrupt ()); @@ -1768,7 +1768,7 @@ /* Special case interrupt functions that save all registers for a call. */ if (interrupt_handler && ((1L << LINK_POINTER_REGNUM) & reg_saved) != 0) { - if (! TARGET_DISABLE_CALLT) + if (! TARGET_DISABLE_CALLT && (TARGET_V850E || TARGET_V850E2_ALL)) emit_insn (gen_callt_save_all_interrupt ()); else emit_insn (gen_save_all_interrupt ()); @@ -2019,7 +2019,7 @@ /* And return or use reti for interrupt handlers. */ if (interrupt_handler) { - if (! TARGET_DISABLE_CALLT) + if (! TARGET_DISABLE_CALLT && (TARGET_V850E || TARGET_V850E2_ALL)) emit_insn (gen_callt_return_interrupt ()); else emit_jump_insn (gen_return_interrupt ()); diff -Naur gcc-4.6.0.orig/gcc/config.gcc gcc-4.6.0/gcc/config.gcc --- gcc-4.6.0.orig/gcc/config.gcc 2011-03-14 06:05:29.000000000 +0000 +++ gcc-4.6.0/gcc/config.gcc 2011-04-08 21:41:35.738880000 +0000 @@ -1212,6 +1212,7 @@ ;; i[34567]86-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/freebsd.h" + tmake_file="${tmake_file} i386/t-crtstuff" ;; x86_64-*-freebsd*) tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h" diff -Naur gcc-4.6.0.orig/gcc/cp/call.c gcc-4.6.0/gcc/cp/call.c --- gcc-4.6.0.orig/gcc/cp/call.c 2011-03-16 20:03:01.000000000 +0000 +++ gcc-4.6.0/gcc/cp/call.c 2011-04-26 23:42:50.605125000 +0000 @@ -801,6 +801,53 @@ return c; } +/* Represent a conversion from CTOR, a braced-init-list, to TYPE, an + array type, if such a conversion is possible. */ + +static conversion * +build_array_conv (tree type, tree ctor, int flags) +{ + conversion *c; + unsigned HOST_WIDE_INT len = CONSTRUCTOR_NELTS (ctor); + tree elttype = TREE_TYPE (type); + unsigned i; + tree val; + bool bad = false; + bool user = false; + enum conversion_rank rank = cr_exact; + + if (TYPE_DOMAIN (type)) + { + unsigned HOST_WIDE_INT alen = tree_low_cst (array_type_nelts_top (type), 1); + if (alen < len) + return NULL; + } + + FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (ctor), i, val) + { + conversion *sub + = implicit_conversion (elttype, TREE_TYPE (val), val, + false, flags); + if (sub == NULL) + return NULL; + + if (sub->rank > rank) + rank = sub->rank; + if (sub->user_conv_p) + user = true; + if (sub->bad_p) + bad = true; + } + + c = alloc_conversion (ck_aggr); + c->type = type; + c->rank = rank; + c->user_conv_p = user; + c->bad_p = bad; + c->u.next = NULL; + return c; +} + /* Build a representation of the identity conversion from EXPR to itself. The TYPE should match the type of EXPR, if EXPR is non-NULL. */ @@ -1429,7 +1476,9 @@ || (((CP_TYPE_CONST_NON_VOLATILE_P (to) && !(flags & LOOKUP_NO_TEMP_BIND)) || TYPE_REF_IS_RVALUE (rto)) - && (CLASS_TYPE_P (from) || (expr && lvalue_p (expr)))))) + && (CLASS_TYPE_P (from) + || TREE_CODE (from) == ARRAY_TYPE + || (expr && lvalue_p (expr)))))) { /* [dcl.init.ref] @@ -1621,6 +1670,8 @@ return conv; } } + else if (TREE_CODE (to) == ARRAY_TYPE) + return build_array_conv (to, expr, flags); } if (expr != NULL_TREE @@ -5430,6 +5481,8 @@ if (!BRACE_ENCLOSED_INITIALIZER_P (val)) check_narrowing (TREE_TYPE (sub), val); CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_ctor), NULL_TREE, sub); + if (!TREE_CONSTANT (sub)) + TREE_CONSTANT (new_ctor) = false; } /* Build up the array. */ elttype = cp_build_qualified_type diff -Naur gcc-4.6.0.orig/gcc/cp/class.c gcc-4.6.0/gcc/cp/class.c --- gcc-4.6.0.orig/gcc/cp/class.c 2011-02-28 21:41:21.000000000 +0000 +++ gcc-4.6.0/gcc/cp/class.c 2011-05-09 12:34:19.714405000 +0000 @@ -4547,6 +4547,8 @@ static void finalize_literal_type_property (tree t) { + tree fn; + if (cxx_dialect < cxx0x || TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t) /* FIXME These constraints seem unnecessary; remove from standard. @@ -4557,18 +4559,10 @@ && !TYPE_HAS_CONSTEXPR_CTOR (t)) CLASSTYPE_LITERAL_P (t) = false; - if (!CLASSTYPE_LITERAL_P (t) && !CLASSTYPE_TEMPLATE_INSTANTIATION (t)) - { - tree fn; - for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) - if (DECL_DECLARED_CONSTEXPR_P (fn) - && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn) - && !DECL_CONSTRUCTOR_P (fn)) - { - error ("enclosing class of %q+D is not a literal type", fn); - DECL_DECLARED_CONSTEXPR_P (fn) = false; - } - } + for (fn = TYPE_METHODS (t); fn; fn = DECL_CHAIN (fn)) + if (DECL_DECLARED_CONSTEXPR_P (fn) + && TREE_CODE (fn) != TEMPLATE_DECL) + validate_constexpr_fundecl (fn); } /* Check the validity of the bases and members declared in T. Add any @@ -5943,6 +5937,7 @@ itself. */ if (TREE_CODE (instance) == VAR_DECL && DECL_INITIAL (instance) + && !type_dependent_expression_p_push (DECL_INITIAL (instance)) && !htab_find (ht, instance)) { tree type; @@ -5983,7 +5978,17 @@ { tree t = TREE_TYPE (instance); int cdtorp = 0; - tree fixed = fixed_type_or_null (instance, nonnull, &cdtorp); + tree fixed; + + if (processing_template_decl) + { + /* In a template we only care about the type of the result. */ + if (nonnull) + *nonnull = true; + return true; + } + + fixed = fixed_type_or_null (instance, nonnull, &cdtorp); if (fixed == NULL_TREE) return 0; if (POINTER_TYPE_P (t)) diff -Naur gcc-4.6.0.orig/gcc/cp/cp-tree.h gcc-4.6.0/gcc/cp/cp-tree.h --- gcc-4.6.0.orig/gcc/cp/cp-tree.h 2011-03-03 02:49:19.000000000 +0000 +++ gcc-4.6.0/gcc/cp/cp-tree.h 2011-05-06 21:58:30.234668000 +0000 @@ -4958,6 +4958,7 @@ extern tree build_new (VEC(tree,gc) **, tree, tree, VEC(tree,gc) **, int, tsubst_flags_t); +extern tree get_temp_regvar (tree, tree); extern tree build_vec_init (tree, tree, tree, bool, int, tsubst_flags_t); extern tree build_delete (tree, tree, @@ -5344,7 +5345,7 @@ extern void finish_static_assert (tree, tree, location_t, bool); extern tree describable_type (tree); -extern tree finish_decltype_type (tree, bool); +extern tree finish_decltype_type (tree, bool, tsubst_flags_t); extern tree finish_trait_expr (enum cp_trait_kind, tree, tree); extern tree build_lambda_expr (void); extern tree build_lambda_object (tree); @@ -5409,6 +5410,7 @@ extern tree get_first_fn (tree); extern tree ovl_cons (tree, tree); extern tree build_overload (tree, tree); +extern bool non_static_member_function_p (tree); extern const char *cxx_printable_name (tree, int); extern const char *cxx_printable_name_translate (tree, int); extern tree build_exception_variant (tree, tree); diff -Naur gcc-4.6.0.orig/gcc/cp/cvt.c gcc-4.6.0/gcc/cp/cvt.c --- gcc-4.6.0.orig/gcc/cp/cvt.c 2011-02-17 20:44:14.000000000 +0000 +++ gcc-4.6.0/gcc/cp/cvt.c 2011-04-12 00:20:32.250766000 +0000 @@ -727,7 +727,13 @@ return error_mark_node; } if (code == BOOLEAN_TYPE) - return cp_truthvalue_conversion (e); + { + /* We can't implicitly convert a scoped enum to bool, so convert + to the underlying type first. */ + if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC)) + e = build_nop (ENUM_UNDERLYING_TYPE (intype), e); + return cp_truthvalue_conversion (e); + } converted = fold_if_not_in_template (convert_to_integer (type, e)); diff -Naur gcc-4.6.0.orig/gcc/cp/decl.c gcc-4.6.0/gcc/cp/decl.c --- gcc-4.6.0.orig/gcc/cp/decl.c 2011-03-16 20:03:12.000000000 +0000 +++ gcc-4.6.0/gcc/cp/decl.c 2011-05-06 21:58:30.234668000 +0000 @@ -4904,6 +4904,8 @@ return error_mark_node; CONSTRUCTOR_APPEND_ELT (CONSTRUCTOR_ELTS (new_init), size_int (index), elt_init); + if (!TREE_CONSTANT (elt_init)) + TREE_CONSTANT (new_init) = false; } return new_init; @@ -5793,7 +5795,10 @@ } } - if (TREE_CODE (decl) == FUNCTION_DECL) + if (TREE_CODE (decl) == FUNCTION_DECL + /* For members, defer until finalize_literal_type_property. */ + && (!DECL_CLASS_SCOPE_P (decl) + || !TYPE_BEING_DEFINED (DECL_CONTEXT (decl)))) validate_constexpr_fundecl (decl); else if (!ensure_literal_type_for_constexpr_object (decl)) @@ -5859,11 +5864,9 @@ then it can be used in future constant expressions, so its value must be available. */ if (!(init - && DECL_CLASS_SCOPE_P (decl) - /* We just set TREE_CONSTANT appropriately; see above. */ - && TREE_CONSTANT (decl) + && init_const_expr_p && !type_dependent_p - /* FIXME non-value-dependent constant expression */ + && decl_maybe_constant_var_p (decl) && !value_dependent_init_p (init))) { if (init) @@ -5875,6 +5878,14 @@ goto finish_end; } + if (!DECL_CLASS_SCOPE_P (decl)) + { + tree init_code = check_initializer (decl, init, flags, &cleanup); + if (init_code) + DECL_INITIAL (decl) = init; + goto finish_end; + } + if (TREE_CODE (init) == TREE_LIST) { /* If the parenthesized-initializer form was used (e.g., @@ -7488,6 +7499,39 @@ return 0; } +/* *expr_p is part of the TYPE_SIZE of a variably-sized array. If any + SAVE_EXPRs in *expr_p wrap expressions with side-effects, break those + expressions out into temporary variables so that walk_tree doesn't + step into them (c++/15764). */ + +static tree +stabilize_save_expr_r (tree *expr_p, int *walk_subtrees, void *data) +{ + struct pointer_set_t *pset = (struct pointer_set_t *)data; + tree expr = *expr_p; + if (TREE_CODE (expr) == SAVE_EXPR) + { + tree op = TREE_OPERAND (expr, 0); + cp_walk_tree (&op, stabilize_save_expr_r, data, pset); + if (TREE_SIDE_EFFECTS (op)) + TREE_OPERAND (expr, 0) = get_temp_regvar (TREE_TYPE (op), op); + *walk_subtrees = 0; + } + else if (!EXPR_P (expr) || !TREE_SIDE_EFFECTS (expr)) + *walk_subtrees = 0; + return NULL; +} + +/* Entry point for the above. */ + +static void +stabilize_vla_size (tree size) +{ + struct pointer_set_t *pset = pointer_set_create (); + /* Break out any function calls into temporary variables. */ + cp_walk_tree (&size, stabilize_save_expr_r, pset, pset); +} + /* Given the SIZE (i.e., number of elements) in an array, compute an appropriate index type for the array. If non-NULL, NAME is the name of the thing being declared. */ @@ -8940,7 +8984,12 @@ && (decl_context == NORMAL || decl_context == FIELD) && at_function_scope_p () && variably_modified_type_p (type, NULL_TREE)) - finish_expr_stmt (TYPE_SIZE (type)); + { + /* First break out any side-effects. */ + stabilize_vla_size (TYPE_SIZE (type)); + /* And then force evaluation of the SAVE_EXPR. */ + finish_expr_stmt (TYPE_SIZE (type)); + } if (declarator->kind == cdk_reference) { @@ -9015,6 +9064,14 @@ } } + /* We need to stabilize side-effects in VLA sizes for regular array + declarations too, not just pointers to arrays. */ + if (type != error_mark_node && !TYPE_NAME (type) + && (decl_context == NORMAL || decl_context == FIELD) + && at_function_scope_p () + && variably_modified_type_p (type, NULL_TREE)) + stabilize_vla_size (TYPE_SIZE (type)); + /* A `constexpr' specifier used in an object declaration declares the object as `const'. */ if (constexpr_p && innermost_code != cdk_function) @@ -13339,10 +13396,14 @@ void revert_static_member_fn (tree decl) { - TREE_TYPE (decl) = static_fn_type (decl); + tree stype = static_fn_type (decl); - if (cp_type_quals (TREE_TYPE (decl)) != TYPE_UNQUALIFIED) - error ("static member function %q#D declared with type qualifiers", decl); + if (type_memfn_quals (stype) != TYPE_UNQUALIFIED) + { + error ("static member function %q#D declared with type qualifiers", decl); + stype = apply_memfn_quals (stype, TYPE_UNQUALIFIED); + } + TREE_TYPE (decl) = stype; if (DECL_ARGUMENTS (decl)) DECL_ARGUMENTS (decl) = DECL_CHAIN (DECL_ARGUMENTS (decl)); diff -Naur gcc-4.6.0.orig/gcc/cp/decl2.c gcc-4.6.0/gcc/cp/decl2.c --- gcc-4.6.0.orig/gcc/cp/decl2.c 2011-03-01 22:44:26.000000000 +0000 +++ gcc-4.6.0/gcc/cp/decl2.c 2011-04-21 03:03:08.760178000 +0000 @@ -1264,6 +1264,25 @@ return cp_build_qualified_type (outer, cp_type_quals (type)); } +/* Replaces any constexpr expression that may be into the attributes + arguments with their reduced value. */ + +static void +cp_check_const_attributes (tree attributes) +{ + tree attr; + for (attr = attributes; attr; attr = TREE_CHAIN (attr)) + { + tree arg; + for (arg = TREE_VALUE (attr); arg; arg = TREE_CHAIN (arg)) + { + tree expr = TREE_VALUE (arg); + if (EXPR_P (expr)) + TREE_VALUE (arg) = maybe_constant_value (expr); + } + } +} + /* Like decl_attributes, but handle C++ complexity. */ void @@ -1284,6 +1303,8 @@ return; } + cp_check_const_attributes (attributes); + if (TREE_CODE (*decl) == TEMPLATE_DECL) decl = &DECL_TEMPLATE_RESULT (*decl); @@ -4059,9 +4080,12 @@ because we depend on the form of FN. */ make_args_non_dependent (*args); object = build_non_dependent_expr (object); - if (TREE_CODE (fn) == DOTSTAR_EXPR) - object = cp_build_addr_expr (object, tf_warning_or_error); - VEC_safe_insert (tree, gc, *args, 0, object); + if (TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) + { + if (TREE_CODE (fn) == DOTSTAR_EXPR) + object = cp_build_addr_expr (object, tf_warning_or_error); + VEC_safe_insert (tree, gc, *args, 0, object); + } /* Now that the arguments are done, transform FN. */ fn = build_non_dependent_expr (fn); } @@ -4080,7 +4104,10 @@ VEC_safe_insert (tree, gc, *args, 0, object_addr); } - expr = cp_build_function_call_vec (fn, args, tf_warning_or_error); + if (CLASS_TYPE_P (TREE_TYPE (fn))) + expr = build_op_call (fn, args, tf_warning_or_error); + else + expr = cp_build_function_call_vec (fn, args, tf_warning_or_error); if (processing_template_decl && expr != error_mark_node) expr = build_min_non_dep_call_vec (expr, orig_fn, orig_args); diff -Naur gcc-4.6.0.orig/gcc/cp/except.c gcc-4.6.0/gcc/cp/except.c --- gcc-4.6.0.orig/gcc/cp/except.c 2010-11-30 11:41:24.000000000 +0000 +++ gcc-4.6.0/gcc/cp/except.c 2011-04-08 15:02:16.658686000 +0000 @@ -1125,6 +1125,9 @@ { tree fn; + if (expr == error_mark_node) + return error_mark_node; + if (processing_template_decl) return build_min (NOEXCEPT_EXPR, boolean_type_node, expr); @@ -1203,15 +1206,17 @@ it until instantiation. */ if (!processing_template_decl) { - expr = cxx_constant_value (expr); expr = perform_implicit_conversion_flags (boolean_type_node, expr, complain, LOOKUP_NORMAL); + expr = cxx_constant_value (expr); } if (expr == boolean_true_node) return noexcept_true_spec; else if (expr == boolean_false_node) return noexcept_false_spec; + else if (expr == error_mark_node) + return error_mark_node; else { gcc_assert (processing_template_decl || expr == error_mark_node); diff -Naur gcc-4.6.0.orig/gcc/cp/init.c gcc-4.6.0/gcc/cp/init.c --- gcc-4.6.0.orig/gcc/cp/init.c 2011-03-11 15:43:37.000000000 +0000 +++ gcc-4.6.0/gcc/cp/init.c 2011-05-11 06:03:38.016847000 +0000 @@ -45,7 +45,6 @@ static tree sort_mem_initializers (tree, tree); static tree initializing_context (tree); static void expand_cleanup_for_base (tree, tree); -static tree get_temp_regvar (tree, tree); static tree dfs_initialize_vtbl_ptrs (tree, void *); static tree build_dtor_call (tree, special_function_kind, int); static tree build_field_list (tree, tree, int *); @@ -343,7 +342,7 @@ build_special_member_call (NULL_TREE, complete_ctor_identifier, NULL, type, LOOKUP_NORMAL, complain)); - else if (TREE_CODE (type) != UNION_TYPE && TYPE_NEEDS_CONSTRUCTING (type)) + else if (TYPE_NEEDS_CONSTRUCTING (type)) { /* This is a class that needs constructing, but doesn't have a user-provided constructor. So we need to zero-initialize @@ -1905,6 +1904,9 @@ field_type = strip_array_types (TREE_TYPE (field)); + if (type_has_user_provided_constructor (field_type)) + continue; + if (TREE_CODE (field_type) == REFERENCE_TYPE) { ++ error_count; @@ -2871,7 +2873,7 @@ things when it comes time to do final cleanups (which take place "outside" the binding contour of the function). */ -static tree +tree get_temp_regvar (tree type, tree init) { tree decl; diff -Naur gcc-4.6.0.orig/gcc/cp/method.c gcc-4.6.0/gcc/cp/method.c --- gcc-4.6.0.orig/gcc/cp/method.c 2011-03-09 16:59:55.000000000 +0000 +++ gcc-4.6.0/gcc/cp/method.c 2011-03-31 20:33:07.952847000 +0000 @@ -1594,6 +1594,12 @@ { special_function_kind kind = sfk_none; + if (template_parm_scope_p ()) + { + error ("a template cannot be defaulted"); + return false; + } + if (DECL_CONSTRUCTOR_P (fn)) { if (FUNCTION_FIRST_USER_PARMTYPE (fn) == void_list_node) diff -Naur gcc-4.6.0.orig/gcc/cp/parser.c gcc-4.6.0/gcc/cp/parser.c --- gcc-4.6.0.orig/gcc/cp/parser.c 2011-03-11 22:47:59.000000000 +0000 +++ gcc-4.6.0/gcc/cp/parser.c 2011-04-27 15:57:06.718966000 +0000 @@ -2699,6 +2699,7 @@ location_t location) { tree decl, old_scope; + cp_parser_commit_to_tentative_parse (parser); /* Try to lookup the identifier. */ old_scope = parser->scope; parser->scope = scope; @@ -2792,7 +2793,6 @@ else gcc_unreachable (); } - cp_parser_commit_to_tentative_parse (parser); } /* Check for a common situation where a type-name should be present, @@ -3696,6 +3696,12 @@ `&A::B' might be a pointer-to-member, but `&(A::B)' is not. */ finish_parenthesized_expr (expr); + /* DR 705: Wrapping an unqualified name in parentheses + suppresses arg-dependent lookup. We want to pass back + CP_ID_KIND_QUALIFIED for suppressing vtable lookup + (c++/37862), but none of the others. */ + if (*idk != CP_ID_KIND_QUALIFIED) + *idk = CP_ID_KIND_NONE; } /* The `>' token might be the end of a template-id or template-parameter-list now. */ @@ -10457,7 +10463,8 @@ return error_mark_node; } - return finish_decltype_type (expr, id_expression_or_member_access_p); + return finish_decltype_type (expr, id_expression_or_member_access_p, + tf_warning_or_error); } /* Special member functions [gram.special] */ @@ -24631,7 +24638,8 @@ /* If decl is an iterator, preserve the operator on decl until finish_omp_for. */ if (decl - && (type_dependent_expression_p (decl) + && ((type_dependent_expression_p (decl) + && !POINTER_TYPE_P (TREE_TYPE (decl))) || CLASS_TYPE_P (TREE_TYPE (decl)))) incr = cp_parser_omp_for_incr (parser, decl); else diff -Naur gcc-4.6.0.orig/gcc/cp/pt.c gcc-4.6.0/gcc/cp/pt.c --- gcc-4.6.0.orig/gcc/cp/pt.c 2011-03-12 06:48:57.000000000 +0000 +++ gcc-4.6.0/gcc/cp/pt.c 2011-05-12 01:44:03.139018000 +0000 @@ -11025,7 +11025,7 @@ type = lambda_return_type (type); else type = finish_decltype_type - (type, DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t)); + (type, DECLTYPE_TYPE_ID_EXPR_OR_MEMBER_ACCESS_P (t), complain); return cp_build_qualified_type_real (type, cp_type_quals (t) | cp_type_quals (type), @@ -13936,7 +13936,10 @@ && TYPE_REF_IS_RVALUE (*parm) && TREE_CODE (TREE_TYPE (*parm)) == TEMPLATE_TYPE_PARM && cp_type_quals (TREE_TYPE (*parm)) == TYPE_UNQUALIFIED - && arg_expr && real_lvalue_p (arg_expr)) + && (arg_expr ? real_lvalue_p (arg_expr) + /* try_one_overload doesn't provide an arg_expr, but + functions are always lvalues. */ + : TREE_CODE (*arg) == FUNCTION_TYPE)) *arg = build_reference_type (*arg); /* [temp.deduct.call] @@ -18065,6 +18068,11 @@ if (DECL_P (expression) && type_dependent_expression_p (expression)) return true; + /* We shouldn't have gotten here for a type-dependent expression, but + let's handle it properly anyway. */ + if (TREE_TYPE (expression) == NULL_TREE) + return true; + switch (TREE_CODE (expression)) { case IDENTIFIER_NODE: @@ -18082,10 +18090,10 @@ return value_dependent_expression_p (DECL_INITIAL (expression)); case VAR_DECL: - /* A constant with integral or enumeration type and is initialized + /* A constant with literal type and is initialized with an expression that is value-dependent. */ if (DECL_INITIAL (expression) - && INTEGRAL_OR_ENUMERATION_TYPE_P (TREE_TYPE (expression)) + && decl_constant_var_p (expression) && value_dependent_expression_p (DECL_INITIAL (expression))) return true; return false; @@ -18217,6 +18225,11 @@ return false; } + case TEMPLATE_ID_EXPR: + /* If a TEMPLATE_ID_EXPR involves a dependent name, it will be + type-dependent. */ + return type_dependent_expression_p (expression); + default: /* A constant expression is value-dependent if any subexpression is value-dependent. */ @@ -18797,10 +18810,6 @@ { tree inner_expr; - /* Preserve null pointer constants so that the type of things like - "p == 0" where "p" is a pointer can be determined. */ - if (null_ptr_cst_p (expr)) - return expr; /* Preserve OVERLOADs; the functions must be available to resolve types. */ inner_expr = expr; @@ -18848,24 +18857,17 @@ TREE_OPERAND (expr, 0), build_non_dependent_expr (TREE_OPERAND (expr, 1))); + /* Keep dereferences outside the NON_DEPENDENT_EXPR so lvalue_kind + doesn't need to look inside. */ + if (TREE_CODE (expr) == INDIRECT_REF && REFERENCE_REF_P (expr)) + return convert_from_reference (build_non_dependent_expr + (TREE_OPERAND (expr, 0))); + /* If the type is unknown, it can't really be non-dependent */ gcc_assert (TREE_TYPE (expr) != unknown_type_node); - /* Otherwise, build a NON_DEPENDENT_EXPR. - - REFERENCE_TYPEs are not stripped for expressions in templates - because doing so would play havoc with mangling. Consider, for - example: - - template void f() { g(); } - - In the body of "f", the expression for "g" will have - REFERENCE_TYPE, even though the standard says that it should - not. The reason is that we must preserve the syntactic form of - the expression so that mangling (say) "f" inside the body of - "f" works out correctly. Therefore, the REFERENCE_TYPE is - stripped here. */ - return build1 (NON_DEPENDENT_EXPR, non_reference (TREE_TYPE (expr)), expr); + /* Otherwise, build a NON_DEPENDENT_EXPR. */ + return build1 (NON_DEPENDENT_EXPR, TREE_TYPE (expr), expr); } /* ARGS is a vector of expressions as arguments to a function call. diff -Naur gcc-4.6.0.orig/gcc/cp/semantics.c gcc-4.6.0/gcc/cp/semantics.c --- gcc-4.6.0.orig/gcc/cp/semantics.c 2011-03-08 05:28:13.000000000 +0000 +++ gcc-4.6.0/gcc/cp/semantics.c 2011-05-06 21:58:44.977085000 +0000 @@ -2041,7 +2041,7 @@ is not included in *ARGS even though it is considered to be part of the list of arguments. Note that this is related to CWG issues 515 and 1005. */ - || ((TREE_CODE (TREE_TYPE (fn)) == METHOD_TYPE) + || (non_static_member_function_p (fn) && current_class_ref && type_dependent_expression_p (current_class_ref))) { @@ -2150,11 +2150,14 @@ /* A call where the function is unknown. */ result = cp_build_function_call_vec (fn, args, complain); - if (processing_template_decl) + if (processing_template_decl && result != error_mark_node) { + if (TREE_CODE (result) == INDIRECT_REF) + result = TREE_OPERAND (result, 0); result = build_call_vec (TREE_TYPE (result), orig_fn, orig_args); KOENIG_LOOKUP_P (result) = koenig_p; release_tree_vector (orig_args); + result = convert_from_reference (result); } return result; @@ -2326,7 +2329,35 @@ if (TREE_CODE (type) == ARRAY_TYPE) cp_complete_array_type (&type, compound_literal, false); compound_literal = digest_init (type, compound_literal); - return get_target_expr (compound_literal); + /* Put static/constant array temporaries in static variables, but always + represent class temporaries with TARGET_EXPR so we elide copies. */ + if ((!at_function_scope_p () || CP_TYPE_CONST_P (type)) + && TREE_CODE (type) == ARRAY_TYPE + && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) + && initializer_constant_valid_p (compound_literal, type)) + { + tree decl = create_temporary_var (type); + DECL_INITIAL (decl) = compound_literal; + TREE_STATIC (decl) = 1; + if (literal_type_p (type) && CP_TYPE_CONST_NON_VOLATILE_P (type)) + { + /* 5.19 says that a constant expression can include an + lvalue-rvalue conversion applied to "a glvalue of literal type + that refers to a non-volatile temporary object initialized + with a constant expression". Rather than try to communicate + that this VAR_DECL is a temporary, just mark it constexpr. */ + DECL_DECLARED_CONSTEXPR_P (decl) = true; + DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl) = true; + TREE_CONSTANT (decl) = true; + } + cp_apply_type_quals_to_decl (cp_type_quals (type), decl); + decl = pushdecl_top_level (decl); + DECL_NAME (decl) = make_anon_name (); + SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl)); + return decl; + } + else + return get_target_expr (compound_literal); } /* Return the declaration for the function-name variable indicated by @@ -4755,7 +4786,8 @@ a full expression. */ tree -finish_decltype_type (tree expr, bool id_expression_or_member_access_p) +finish_decltype_type (tree expr, bool id_expression_or_member_access_p, + tsubst_flags_t complain) { tree orig_expr = expr; tree type = NULL_TREE; @@ -4768,7 +4800,8 @@ || (TREE_CODE (expr) == BIT_NOT_EXPR && TYPE_P (TREE_OPERAND (expr, 0)))) { - error ("argument to decltype must be an expression"); + if (complain & tf_error) + error ("argument to decltype must be an expression"); return error_mark_node; } @@ -4835,7 +4868,9 @@ if (OVL_CHAIN (expr) || TREE_CODE (OVL_FUNCTION (expr)) == TEMPLATE_DECL) { - error ("%qE refers to a set of overloaded functions", orig_expr); + if (complain & tf_error) + error ("%qE refers to a set of overloaded functions", + orig_expr); return error_mark_node; } else @@ -4887,7 +4922,8 @@ default: gcc_assert (TYPE_P (expr) || DECL_P (expr) || TREE_CODE (expr) == SCOPE_REF); - error ("argument to decltype must be an expression"); + if (complain & tf_error) + error ("argument to decltype must be an expression"); return error_mark_node; } } @@ -4982,7 +5018,8 @@ if (!type || type == unknown_type_node) { - error ("type of %qE is unknown", expr); + if (complain & tf_error) + error ("type of %qE is unknown", expr); return error_mark_node; } @@ -5387,8 +5424,8 @@ { ret = false; if (complain) - error ("invalid type for parameter %q#D of constexpr function", - parm); + error ("invalid type for parameter %d of constexpr " + "function %q+#D", DECL_PARM_INDEX (parm), fun); } if (!DECL_CONSTRUCTOR_P (fun)) @@ -5398,17 +5435,16 @@ { ret = false; if (complain) - error ("invalid return type %qT of constexpr function %qD", + error ("invalid return type %qT of constexpr function %q+D", rettype, fun); } if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) - && COMPLETE_TYPE_P (DECL_CONTEXT (fun)) - && !valid_type_in_constexpr_fundecl_p (DECL_CONTEXT (fun))) + && !CLASSTYPE_LITERAL_P (DECL_CONTEXT (fun))) { ret = false; if (complain) - error ("enclosing class of %q#D is not a literal type", fun); + error ("enclosing class of %q+#D is not a literal type", fun); } } @@ -5668,11 +5704,11 @@ body = unshare_expr (TREE_OPERAND (body, 0)); } - if (!potential_constant_expression (body)) + if (!potential_rvalue_constant_expression (body)) { DECL_DECLARED_CONSTEXPR_P (fun) = false; if (!DECL_TEMPLATE_INSTANTIATION (fun)) - require_potential_constant_expression (body); + require_potential_rvalue_constant_expression (body); return NULL; } fundef->body = body; @@ -5922,17 +5958,21 @@ /* Variables and functions to manage constexpr call expansion context. These do not need to be marked for PCH or GC. */ +/* FIXME remember and print actual constant arguments. */ static VEC(tree,heap) *call_stack = NULL; static int call_stack_tick; static int last_cx_error_tick; -static void +static bool push_cx_call_context (tree call) { ++call_stack_tick; if (!EXPR_HAS_LOCATION (call)) SET_EXPR_LOCATION (call, input_location); VEC_safe_push (tree, heap, call_stack, call); + if (VEC_length (tree, call_stack) > (unsigned) max_constexpr_depth) + return false; + return true; } static void @@ -5967,6 +6007,9 @@ tree result; constexpr_call new_call = { NULL, NULL, NULL, 0 }; constexpr_call **slot; + constexpr_call *entry; + bool depth_ok; + if (TREE_CODE (fun) != FUNCTION_DECL) { /* Might be a constexpr function pointer. */ @@ -6029,7 +6072,7 @@ if (*non_constant_p) return t; - push_cx_call_context (t); + depth_ok = push_cx_call_context (t); new_call.hash = iterative_hash_template_arg (new_call.bindings, @@ -6039,37 +6082,43 @@ maybe_initialize_constexpr_call_table (); slot = (constexpr_call **) htab_find_slot (constexpr_call_table, &new_call, INSERT); - if (*slot != NULL) - { - /* Calls which are in progress have their result set to NULL - so that we can detect circular dependencies. */ - if ((*slot)->result == NULL) - { - if (!allow_non_constant) - error ("call has circular dependency"); - (*slot)->result = result = error_mark_node; - } - else - { - result = (*slot)->result; - if (result == error_mark_node && !allow_non_constant) - /* Re-evaluate to get the error. */ - cxx_eval_constant_expression (&new_call, new_call.fundef->body, - allow_non_constant, addr, - non_constant_p); - } - } - else + entry = *slot; + if (entry == NULL) { /* We need to keep a pointer to the entry, not just the slot, as the slot can move in the call to cxx_eval_builtin_function_call. */ - constexpr_call *entry = ggc_alloc_constexpr_call (); + *slot = entry = ggc_alloc_constexpr_call (); *entry = new_call; - *slot = entry; - result - = cxx_eval_constant_expression (&new_call, new_call.fundef->body, - allow_non_constant, addr, - non_constant_p); + } + /* Calls which are in progress have their result set to NULL + so that we can detect circular dependencies. */ + else if (entry->result == NULL) + { + if (!allow_non_constant) + error ("call has circular dependency"); + *non_constant_p = true; + entry->result = result = error_mark_node; + } + + if (!depth_ok) + { + if (!allow_non_constant) + error ("constexpr evaluation depth exceeds maximum of %d (use " + "-fconstexpr-depth= to increase the maximum)", + max_constexpr_depth); + *non_constant_p = true; + entry->result = result = error_mark_node; + } + else + { + result = entry->result; + if (!result || (result == error_mark_node && !allow_non_constant)) + result = (cxx_eval_constant_expression + (&new_call, new_call.fundef->body, + allow_non_constant, addr, + non_constant_p)); + if (result == error_mark_node) + *non_constant_p = true; if (*non_constant_p) entry->result = result = error_mark_node; else @@ -6206,13 +6255,12 @@ allow_non_constant, addr, non_constant_p); VERIFY_CONSTANT (val); - if (val == boolean_true_node) - return cxx_eval_constant_expression (call, TREE_OPERAND (t, 1), + /* Don't VERIFY_CONSTANT the other operands. */ + if (integer_zerop (val)) + return cxx_eval_constant_expression (call, TREE_OPERAND (t, 2), allow_non_constant, addr, non_constant_p); - gcc_assert (val == boolean_false_node); - /* Don't VERIFY_CONSTANT here. */ - return cxx_eval_constant_expression (call, TREE_OPERAND (t, 2), + return cxx_eval_constant_expression (call, TREE_OPERAND (t, 1), allow_non_constant, addr, non_constant_p); } @@ -6231,7 +6279,8 @@ non_constant_p); tree index, oldidx; HOST_WIDE_INT i; - unsigned len; + tree elem_type; + unsigned len, elem_nchars = 1; if (*non_constant_p) return t; oldidx = TREE_OPERAND (t, 1); @@ -6243,11 +6292,27 @@ return t; else if (addr) return build4 (ARRAY_REF, TREE_TYPE (t), ary, index, NULL, NULL); - len = (TREE_CODE (ary) == CONSTRUCTOR - ? CONSTRUCTOR_NELTS (ary) - : (unsigned)TREE_STRING_LENGTH (ary)); + elem_type = TREE_TYPE (TREE_TYPE (ary)); + if (TREE_CODE (ary) == CONSTRUCTOR) + len = CONSTRUCTOR_NELTS (ary); + else + { + elem_nchars = (TYPE_PRECISION (elem_type) + / TYPE_PRECISION (char_type_node)); + len = (unsigned) TREE_STRING_LENGTH (ary) / elem_nchars; + } if (compare_tree_int (index, len) >= 0) { + if (tree_int_cst_lt (index, array_type_nelts_top (TREE_TYPE (ary)))) + { + /* If it's within the array bounds but doesn't have an explicit + initializer, it's value-initialized. */ + tree val = build_value_init (elem_type, tf_warning_or_error); + return cxx_eval_constant_expression (call, val, + allow_non_constant, addr, + non_constant_p); + } + if (!allow_non_constant) error ("array subscript out of bound"); *non_constant_p = true; @@ -6256,9 +6321,16 @@ i = tree_low_cst (index, 0); if (TREE_CODE (ary) == CONSTRUCTOR) return VEC_index (constructor_elt, CONSTRUCTOR_ELTS (ary), i)->value; - else + else if (elem_nchars == 1) return build_int_cst (cv_unqualified (TREE_TYPE (TREE_TYPE (ary))), TREE_STRING_POINTER (ary)[i]); + else + { + tree type = cv_unqualified (TREE_TYPE (TREE_TYPE (ary))); + return native_interpret_expr (type, (const unsigned char *) + TREE_STRING_POINTER (ary) + + i * elem_nchars, elem_nchars); + } /* Don't VERIFY_CONSTANT here. */ } @@ -6717,6 +6789,9 @@ tree type = TREE_TYPE (r); error ("the value of %qD is not usable in a constant " "expression", r); + /* Avoid error cascade. */ + if (DECL_INITIAL (r) == error_mark_node) + return; if (DECL_DECLARED_CONSTEXPR_P (r)) inform (DECL_SOURCE_LOCATION (r), "%qD used in its own initializer", r); @@ -6896,7 +6971,13 @@ r = cxx_eval_constant_expression (call, op0, allow_non_constant, addr, non_constant_p); else - goto binary; + { + /* Check that the LHS is constant and then discard it. */ + cxx_eval_constant_expression (call, op0, allow_non_constant, + false, non_constant_p); + r = cxx_eval_constant_expression (call, op1, allow_non_constant, + addr, non_constant_p); + } } break; @@ -6938,7 +7019,6 @@ case UNEQ_EXPR: case RANGE_EXPR: case COMPLEX_EXPR: - binary: r = cxx_eval_binary_expression (call, t, allow_non_constant, addr, non_constant_p); break; @@ -7025,6 +7105,11 @@ conversion. */ return fold (t); r = fold_build1 (TREE_CODE (t), to, op); + /* Conversion of an out-of-range value has implementation-defined + behavior; the language considers it different from arithmetic + overflow, which is undefined. */ + if (TREE_OVERFLOW_P (r) && !TREE_OVERFLOW_P (op)) + TREE_OVERFLOW (r) = false; } break; @@ -7313,6 +7398,8 @@ class member access expression, including the result of the implicit transformation in the body of the non-static member function (9.3.1); */ + /* FIXME this restriction seems pointless since the standard dropped + "potential constant expression". */ if (is_this_parameter (t)) { if (flags & tf_error) @@ -7328,51 +7415,63 @@ { tree fun = get_function_named_in_call (t); const int nargs = call_expr_nargs (t); - if (TREE_CODE (fun) != FUNCTION_DECL) - { - if (potential_constant_expression_1 (fun, rval, flags)) - /* Might end up being a constant function pointer. */ - return true; - if (flags & tf_error) - error ("%qE is not a function name", fun); - return false; - } - /* Skip initial arguments to base constructors. */ - if (DECL_BASE_CONSTRUCTOR_P (fun)) - i = num_artificial_parms_for (fun); + i = 0; + + if (is_overloaded_fn (fun)) + { + if (TREE_CODE (fun) == FUNCTION_DECL) + { + if (builtin_valid_in_constant_expr_p (fun)) + return true; + if (!DECL_DECLARED_CONSTEXPR_P (fun) + && !morally_constexpr_builtin_function_p (fun)) + { + if (flags & tf_error) + error ("%qD is not %", fun); + return false; + } + /* A call to a non-static member function takes the address + of the object as the first argument. But in a constant + expression the address will be folded away, so look + through it now. */ + if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fun) + && !DECL_CONSTRUCTOR_P (fun)) + { + tree x = get_nth_callarg (t, 0); + if (is_this_parameter (x)) + /* OK. */; + else if (!potential_constant_expression_1 (x, rval, flags)) + { + if (flags & tf_error) + error ("object argument is not a potential " + "constant expression"); + return false; + } + i = 1; + } + } + else + fun = get_first_fn (fun); + /* Skip initial arguments to base constructors. */ + if (DECL_BASE_CONSTRUCTOR_P (fun)) + i = num_artificial_parms_for (fun); + fun = DECL_ORIGIN (fun); + } else - i = 0; - fun = DECL_ORIGIN (fun); - if (builtin_valid_in_constant_expr_p (fun)) - return true; - if (!DECL_DECLARED_CONSTEXPR_P (fun) - && !morally_constexpr_builtin_function_p (fun)) { - if (flags & tf_error) - error ("%qD is not %", fun); - return false; + if (potential_constant_expression_1 (fun, rval, flags)) + /* Might end up being a constant function pointer. */; + else + { + if (flags & tf_error) + error ("%qE is not a function name", fun); + return false; + } } for (; i < nargs; ++i) { tree x = get_nth_callarg (t, i); - /* A call to a non-static member function takes the - address of the object as the first argument. - But in a constant expression the address will be folded - away, so look through it now. */ - if (i == 0 && DECL_NONSTATIC_MEMBER_P (fun) - && !DECL_CONSTRUCTOR_P (fun)) - { - if (is_this_parameter (x)) - /* OK. */; - else if (!potential_constant_expression_1 (x, rval, flags)) - { - if (flags & tf_error) - error ("object argument is not a potential constant " - "expression"); - return false; - } - } - else if (!potential_constant_expression_1 (x, rval, flags)) + if (!potential_constant_expression_1 (x, rval, flags)) { if (flags & tf_error) error ("argument in position %qP is not a " @@ -7472,7 +7571,16 @@ tree x = TREE_OPERAND (t, 0); STRIP_NOPS (x); if (is_this_parameter (x)) - return true; + { + if (DECL_CONSTRUCTOR_P (DECL_CONTEXT (x)) && want_rval) + { + if (flags & tf_error) + sorry ("use of the value of the object being constructed " + "in a constant expression"); + return false; + } + return true; + } return potential_constant_expression_1 (x, rval, flags); } @@ -7689,6 +7797,8 @@ case BIT_XOR_EXPR: case BIT_AND_EXPR: case TRUTH_XOR_EXPR: + case UNORDERED_EXPR: + case ORDERED_EXPR: case UNLT_EXPR: case UNLE_EXPR: case UNGT_EXPR: @@ -7717,12 +7827,12 @@ tmp = TREE_OPERAND (t, 0); if (!potential_constant_expression_1 (tmp, rval, flags)) return false; - else if (tmp == boolean_true_node) - return potential_constant_expression_1 (TREE_OPERAND (t, 1), - want_rval, flags); - else if (tmp == boolean_false_node) + else if (integer_zerop (tmp)) return potential_constant_expression_1 (TREE_OPERAND (t, 2), want_rval, flags); + else if (TREE_CODE (tmp) == INTEGER_CST) + return potential_constant_expression_1 (TREE_OPERAND (t, 1), + want_rval, flags); for (i = 1; i < 3; ++i) if (potential_constant_expression_1 (TREE_OPERAND (t, i), want_rval, tf_none)) diff -Naur gcc-4.6.0.orig/gcc/cp/tree.c gcc-4.6.0/gcc/cp/tree.c --- gcc-4.6.0.orig/gcc/cp/tree.c 2011-03-03 02:49:19.000000000 +0000 +++ gcc-4.6.0/gcc/cp/tree.c 2011-05-06 08:34:10.904710000 +0000 @@ -1465,6 +1465,34 @@ return ovl_cons (decl, chain); } +/* Return TRUE if FN is a non-static member function, FALSE otherwise. + This function looks into BASELINK and OVERLOAD nodes. */ + +bool +non_static_member_function_p (tree fn) +{ + if (fn == NULL_TREE) + return false; + + if (BASELINK_P (fn)) + { + tree type = TREE_TYPE (fn); + + if (type && TREE_CODE (type) == METHOD_TYPE) + return true; + else if (type && TREE_CODE (type) == FUNCTION_TYPE) + return false; + /* This is an overload. Lets look into its current value. */ + fn = get_fns (BASELINK_FUNCTIONS (fn)); + } + + if (TREE_CODE (fn) == OVERLOAD) + fn = OVL_CURRENT (fn); + + return (DECL_P (fn) + && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)); +} + #define PRINT_RING_SIZE 4 @@ -2421,7 +2449,7 @@ else if (current != current_class_type && context == nonlambda_method_basetype ()) /* In a lambda, need to go through 'this' capture. */ - decl = (cp_build_indirect_ref + decl = (build_x_indirect_ref ((lambda_expr_this_capture (CLASSTYPE_LAMBDA_EXPR (current_class_type))), RO_NULL, tf_warning_or_error)); diff -Naur gcc-4.6.0.orig/gcc/cp/typeck.c gcc-4.6.0/gcc/cp/typeck.c --- gcc-4.6.0.orig/gcc/cp/typeck.c 2011-03-16 20:03:01.000000000 +0000 +++ gcc-4.6.0/gcc/cp/typeck.c 2011-04-20 06:31:51.769604000 +0000 @@ -4354,7 +4354,11 @@ gcc_unreachable(); } } - return build2 (COMPLEX_EXPR, result_type, real, imag); + real = fold_if_not_in_template (real); + imag = fold_if_not_in_template (imag); + result = build2 (COMPLEX_EXPR, result_type, real, imag); + result = fold_if_not_in_template (result); + return result; } /* For certain operations (which identify themselves by shorten != 0) @@ -5469,6 +5473,8 @@ default: gcc_unreachable (); } + else + return error_mark_node; for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list)) expr = build_x_compound_expr (expr, TREE_VALUE (list), @@ -7760,12 +7766,19 @@ /* Under C++0x [12.8/16 class.copy], a returned lvalue is sometimes treated as an rvalue for the purposes of overload resolution to - favor move constructors over copy constructors. */ - if ((cxx_dialect != cxx98) - && named_return_value_okay_p - /* The variable must not have the `volatile' qualifier. */ - && !CP_TYPE_VOLATILE_P (TREE_TYPE (retval)) - /* The return type must be a class type. */ + favor move constructors over copy constructors. + + Note that these conditions are similar to, but not as strict as, + the conditions for the named return value optimization. */ + if ((cxx_dialect != cxx98) + && (TREE_CODE (retval) == VAR_DECL + || TREE_CODE (retval) == PARM_DECL) + && DECL_CONTEXT (retval) == current_function_decl + && !TREE_STATIC (retval) + && same_type_p ((TYPE_MAIN_VARIANT (TREE_TYPE (retval))), + (TYPE_MAIN_VARIANT + (TREE_TYPE (TREE_TYPE (current_function_decl))))) + /* This is only interesting for class type. */ && CLASS_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))) flags = flags | LOOKUP_PREFER_RVALUE; diff -Naur gcc-4.6.0.orig/gcc/cppspec.c gcc-4.6.0/gcc/cppspec.c --- gcc-4.6.0.orig/gcc/cppspec.c 2010-08-22 12:19:01.000000000 +0000 +++ gcc-4.6.0/gcc/cppspec.c 2011-05-16 21:23:14.820483000 +0000 @@ -1,5 +1,5 @@ /* Specific flags and argument handling of the C preprocessor. - Copyright (C) 1999, 2007, 2010 Free Software Foundation, Inc. + Copyright (C) 1999, 2007, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -158,7 +158,7 @@ new_decoded_options = XNEWVEC (struct cl_decoded_option, new_argc); - new_decoded_options[0] = new_decoded_options[0]; + new_decoded_options[0] = decoded_options[0]; j = 1; if (need_E) diff -Naur gcc-4.6.0.orig/gcc/df-core.c gcc-4.6.0/gcc/df-core.c --- gcc-4.6.0.orig/gcc/df-core.c 2010-12-14 00:23:40.000000000 +0000 +++ gcc-4.6.0/gcc/df-core.c 2011-03-26 09:21:34.659334000 +0000 @@ -1,6 +1,6 @@ /* Allocation for dataflow support routines. Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Originally contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz, mhayes@redhat.com) Major rewrite contributed by Danny Berlin (dberlin@dberlin.org) @@ -1400,10 +1400,9 @@ bool df_get_bb_dirty (basic_block bb) { - if (df && df_live) - return bitmap_bit_p (df_live->out_of_date_transfer_functions, bb->index); - else - return false; + return bitmap_bit_p ((df_live + ? df_live : df_lr)->out_of_date_transfer_functions, + bb->index); } diff -Naur gcc-4.6.0.orig/gcc/doc/extend.texi gcc-4.6.0/gcc/doc/extend.texi --- gcc-4.6.0.orig/gcc/doc/extend.texi 2011-03-20 00:23:51.000000000 +0000 +++ gcc-4.6.0/gcc/doc/extend.texi 2011-04-24 09:43:29.870302000 +0000 @@ -4180,42 +4180,6 @@ You can use the sequence @samp{\e} in a string or character constant to stand for the ASCII character @key{ESC}. -@node Alignment -@section Inquiring on Alignment of Types or Variables -@cindex alignment -@cindex type alignment -@cindex variable alignment - -The keyword @code{__alignof__} allows you to inquire about how an object -is aligned, or the minimum alignment usually required by a type. Its -syntax is just like @code{sizeof}. - -For example, if the target machine requires a @code{double} value to be -aligned on an 8-byte boundary, then @code{__alignof__ (double)} is 8. -This is true on many RISC machines. On more traditional machine -designs, @code{__alignof__ (double)} is 4 or even 2. - -Some machines never actually require alignment; they allow reference to any -data type even at an odd address. For these machines, @code{__alignof__} -reports the smallest alignment that GCC will give the data type, usually as -mandated by the target ABI. - -If the operand of @code{__alignof__} is an lvalue rather than a type, -its value is the required alignment for its type, taking into account -any minimum alignment specified with GCC's @code{__attribute__} -extension (@pxref{Variable Attributes}). For example, after this -declaration: - -@smallexample -struct foo @{ int x; char y; @} foo1; -@end smallexample - -@noindent -the value of @code{__alignof__ (foo1.y)} is 1, even though its actual -alignment is probably 2 or 4, the same as @code{__alignof__ (int)}. - -It is an error to ask for the alignment of an incomplete type. - @node Variable Attributes @section Specifying Attributes of Variables @cindex attribute of variables @@ -5224,6 +5188,42 @@ Language Extensions Specification. It is intended to support the @code{__vector} keyword. +@node Alignment +@section Inquiring on Alignment of Types or Variables +@cindex alignment +@cindex type alignment +@cindex variable alignment + +The keyword @code{__alignof__} allows you to inquire about how an object +is aligned, or the minimum alignment usually required by a type. Its +syntax is just like @code{sizeof}. + +For example, if the target machine requires a @code{double} value to be +aligned on an 8-byte boundary, then @code{__alignof__ (double)} is 8. +This is true on many RISC machines. On more traditional machine +designs, @code{__alignof__ (double)} is 4 or even 2. + +Some machines never actually require alignment; they allow reference to any +data type even at an odd address. For these machines, @code{__alignof__} +reports the smallest alignment that GCC will give the data type, usually as +mandated by the target ABI. + +If the operand of @code{__alignof__} is an lvalue rather than a type, +its value is the required alignment for its type, taking into account +any minimum alignment specified with GCC's @code{__attribute__} +extension (@pxref{Variable Attributes}). For example, after this +declaration: + +@smallexample +struct foo @{ int x; char y; @} foo1; +@end smallexample + +@noindent +the value of @code{__alignof__ (foo1.y)} is 1, even though its actual +alignment is probably 2 or 4, the same as @code{__alignof__ (int)}. + +It is an error to ask for the alignment of an incomplete type. + @node Inline @section An Inline Function is As Fast As a Macro @@ -14266,63 +14266,63 @@ false. Otherwise if @code{__has_trivial_assign (type)} is true then the trait is true, else if @code{type} is a cv class or union type with copy assignment operators that are known not to throw an exception then the trait is true, -else it is false. Requires: @code{type} shall be a complete type, an array -type of unknown bound, or is a @code{void} type. +else it is false. Requires: @code{type} shall be a complete type, +(possibly cv-qualified) @code{void}, or an array of unknown bound. @item __has_nothrow_copy (type) If @code{__has_trivial_copy (type)} is true then the trait is true, else if @code{type} is a cv class or union type with copy constructors that are known not to throw an exception then the trait is true, else it is false. -Requires: @code{type} shall be a complete type, an array type of -unknown bound, or is a @code{void} type. +Requires: @code{type} shall be a complete type, (possibly cv-qualified) +@code{void}, or an array of unknown bound. @item __has_nothrow_constructor (type) If @code{__has_trivial_constructor (type)} is true then the trait is true, else if @code{type} is a cv class or union type (or array thereof) with a default constructor that is known not to throw an -exception then the trait is true, else it is false. Requires: -@code{type} shall be a complete type, an array type of unknown bound, -or is a @code{void} type. +exception then the trait is true, else it is false. Requires: +@code{type} shall be a complete type, (possibly cv-qualified) +@code{void}, or an array of unknown bound. @item __has_trivial_assign (type) If @code{type} is const qualified or is a reference type then the trait is false. Otherwise if @code{__is_pod (type)} is true then the trait is true, else if @code{type} is a cv class or union type with a trivial copy assignment ([class.copy]) then the trait is true, else it is -false. Requires: @code{type} shall be a complete type, an array type -of unknown bound, or is a @code{void} type. +false. Requires: @code{type} shall be a complete type, (possibly +cv-qualified) @code{void}, or an array of unknown bound. @item __has_trivial_copy (type) If @code{__is_pod (type)} is true or @code{type} is a reference type then the trait is true, else if @code{type} is a cv class or union type with a trivial copy constructor ([class.copy]) then the trait is true, else it is false. Requires: @code{type} shall be a complete -type, an array type of unknown bound, or is a @code{void} type. +type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __has_trivial_constructor (type) If @code{__is_pod (type)} is true then the trait is true, else if @code{type} is a cv class or union type (or array thereof) with a trivial default constructor ([class.ctor]) then the trait is true, -else it is false. Requires: @code{type} shall be a complete type, an -array type of unknown bound, or is a @code{void} type. +else it is false. Requires: @code{type} shall be a complete +type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __has_trivial_destructor (type) If @code{__is_pod (type)} is true or @code{type} is a reference type then the trait is true, else if @code{type} is a cv class or union type (or array thereof) with a trivial destructor ([class.dtor]) then the trait is true, else it is false. Requires: @code{type} shall be a complete -type, an array type of unknown bound, or is a @code{void} type. +type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __has_virtual_destructor (type) If @code{type} is a class type with a virtual destructor ([class.dtor]) then the trait is true, else it is false. Requires: -@code{type} shall be a complete type, an array type of unknown bound, -or is a @code{void} type. +@code{type} shall be a complete type, (possibly cv-qualified) +@code{void}, or an array of unknown bound. @item __is_abstract (type) If @code{type} is an abstract class ([class.abstract]) then the trait is true, else it is false. Requires: @code{type} shall be a complete -type, an array type of unknown bound, or is a @code{void} type. +type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __is_base_of (base_type, derived_type) If @code{base_type} is a base class of @code{derived_type} @@ -14347,22 +14347,37 @@ members, and @code{type} has no virtual base classes, and @code{type} has no base classes @code{base_type} for which @code{__is_empty (base_type)} is false. Requires: @code{type} shall -be a complete type, an array type of unknown bound, or is a -@code{void} type. +be a complete type, (possibly cv-qualified) @code{void}, or an array +of unknown bound. @item __is_enum (type) If @code{type} is a cv enumeration type ([basic.compound]) the trait is true, else it is false. +@item __is_literal_type (type) +If @code{type} is a literal type ([basic.types]) the trait is +true, else it is false. Requires: @code{type} shall be a complete type, +(possibly cv-qualified) @code{void}, or an array of unknown bound. + @item __is_pod (type) If @code{type} is a cv POD type ([basic.types]) then the trait is true, -else it is false. Requires: @code{type} shall be a complete type, -an array type of unknown bound, or is a @code{void} type. +else it is false. Requires: @code{type} shall be a complete type, +(possibly cv-qualified) @code{void}, or an array of unknown bound. @item __is_polymorphic (type) If @code{type} is a polymorphic class ([class.virtual]) then the trait is true, else it is false. Requires: @code{type} shall be a complete -type, an array type of unknown bound, or is a @code{void} type. +type, (possibly cv-qualified) @code{void}, or an array of unknown bound. + +@item __is_standard_layout (type) +If @code{type} is a standard-layout type ([basic.types]) the trait is +true, else it is false. Requires: @code{type} shall be a complete +type, (possibly cv-qualified) @code{void}, or an array of unknown bound. + +@item __is_trivial (type) +If @code{type} is a trivial type ([basic.types]) the trait is +true, else it is false. Requires: @code{type} shall be a complete +type, (possibly cv-qualified) @code{void}, or an array of unknown bound. @item __is_union (type) If @code{type} is a cv union type ([basic.compound]) the trait is diff -Naur gcc-4.6.0.orig/gcc/doc/invoke.texi gcc-4.6.0/gcc/doc/invoke.texi --- gcc-4.6.0.orig/gcc/doc/invoke.texi 2011-03-18 14:34:52.000000000 +0000 +++ gcc-4.6.0/gcc/doc/invoke.texi 2011-03-29 14:24:42.977146000 +0000 @@ -181,7 +181,7 @@ @item C++ Language Options @xref{C++ Dialect Options,,Options Controlling C++ Dialect}. @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol --fconserve-space -ffriend-injection @gol +-fconserve-space -fconstexpr-depth=@var{n} -ffriend-injection @gol -fno-elide-constructors @gol -fno-enforce-eh-specs @gol -ffor-scope -fno-for-scope -fno-gnu-keywords @gol @@ -237,7 +237,7 @@ -Wno-attributes -Wno-builtin-macro-redefined @gol -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol -Wchar-subscripts -Wclobbered -Wcomment @gol --Wconversion -Wcoverage-mismatch -Wcpp -Wno-deprecated @gol +-Wconversion -Wcoverage-mismatch -Wno-cpp -Wno-deprecated @gol -Wno-deprecated-declarations -Wdisabled-optimization @gol -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol -Wno-endif-labels -Werror -Werror=* @gol @@ -613,6 +613,11 @@ -m32 -m64 -mlarge-data-threshold=@var{num} @gol -msse2avx -mfentry -m8bit-idiv} +@emph{i386 and x86-64 Windows Options} +@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll +-mnop-fun-dllimport -mthread @gol +-municode -mwin32 -mwindows -fno-set-stack-executable} + @emph{IA-64 Options} @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol @@ -906,11 +911,6 @@ @emph{x86-64 Options} See i386 and x86-64 Options. -@emph{i386 and x86-64 Windows Options} -@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll --mnop-fun-dllimport -mthread @gol --municode -mwin32 -mwindows -fno-set-stack-executable} - @emph{Xstormy16 Options} @gccoptlist{-msim} @@ -1881,6 +1881,13 @@ This option is no longer useful on most targets, now that support has been added for putting variables into BSS without making them common. +@item -fconstexpr-depth=@var{n} +@opindex fconstexpr-depth +Set the maximum nested evaluation depth for C++0x constexpr functions +to @var{n}. A limit is needed to detect endless recursion during +constant expression evaluation. The minimum specified by the standard +is 512. + @item -fno-deduce-init-list @opindex fno-deduce-init-list Disable deduction of a template type parameter as @@ -3045,7 +3052,7 @@ comment, or whenever a Backslash-Newline appears in a @samp{//} comment. This warning is enabled by @option{-Wall}. -@item -Wno-cpp \ +@item -Wno-cpp @r{(C, Objective-C, C++, Objective-C++ and Fortran only)} Suppress warning messages emitted by @code{#warning} directives. @@ -12815,6 +12822,78 @@ about addresses and sizes of sections. @end table +@node i386 and x86-64 Windows Options +@subsection i386 and x86-64 Windows Options +@cindex i386 and x86-64 Windows Options + +These additional options are available for Windows targets: + +@table @gcctabopt +@item -mconsole +@opindex mconsole +This option is available for Cygwin and MinGW targets. It +specifies that a console application is to be generated, by +instructing the linker to set the PE header subsystem type +required for console applications. +This is the default behavior for Cygwin and MinGW targets. + +@item -mdll +@opindex mdll +This option is available for Cygwin and MinGW targets. It +specifies that a DLL - a dynamic link library - is to be +generated, enabling the selection of the required runtime +startup object and entry point. + +@item -mnop-fun-dllimport +@opindex mnop-fun-dllimport +This option is available for Cygwin and MinGW targets. It +specifies that the dllimport attribute should be ignored. + +@item -mthread +@opindex mthread +This option is available for MinGW targets. It specifies +that MinGW-specific thread support is to be used. + +@item -municode +@opindex municode +This option is available for mingw-w64 targets. It specifies +that the UNICODE macro is getting pre-defined and that the +unicode capable runtime startup code is chosen. + +@item -mwin32 +@opindex mwin32 +This option is available for Cygwin and MinGW targets. It +specifies that the typical Windows pre-defined macros are to +be set in the pre-processor, but does not influence the choice +of runtime library/startup code. + +@item -mwindows +@opindex mwindows +This option is available for Cygwin and MinGW targets. It +specifies that a GUI application is to be generated by +instructing the linker to set the PE header subsystem type +appropriately. + +@item -fno-set-stack-executable +@opindex fno-set-stack-executable +This option is available for MinGW targets. It specifies that +the executable flag for stack used by nested functions isn't +set. This is necessary for binaries running in kernel mode of +Windows, as there the user32 API, which is used to set executable +privileges, isn't available. + +@item -mpe-aligned-commons +@opindex mpe-aligned-commons +This option is available for Cygwin and MinGW targets. It +specifies that the GNU extension to the PE file format that +permits the correct alignment of COMMON variables should be +used when generating code. It will be enabled by default if +GCC detects that the target assembler found during configuration +supports the feature. +@end table + +See also under @ref{i386 and x86-64 Options} for standard options. + @node IA-64 Options @subsection IA-64 Options @cindex IA-64 Options @@ -17541,78 +17620,6 @@ These are listed under @xref{i386 and x86-64 Options}. -@node i386 and x86-64 Windows Options -@subsection i386 and x86-64 Windows Options -@cindex i386 and x86-64 Windows Options - -These additional options are available for Windows targets: - -@table @gcctabopt -@item -mconsole -@opindex mconsole -This option is available for Cygwin and MinGW targets. It -specifies that a console application is to be generated, by -instructing the linker to set the PE header subsystem type -required for console applications. -This is the default behavior for Cygwin and MinGW targets. - -@item -mdll -@opindex mdll -This option is available for Cygwin and MinGW targets. It -specifies that a DLL - a dynamic link library - is to be -generated, enabling the selection of the required runtime -startup object and entry point. - -@item -mnop-fun-dllimport -@opindex mnop-fun-dllimport -This option is available for Cygwin and MinGW targets. It -specifies that the dllimport attribute should be ignored. - -@item -mthread -@opindex mthread -This option is available for MinGW targets. It specifies -that MinGW-specific thread support is to be used. - -@item -municode -@opindex municode -This option is available for mingw-w64 targets. It specifies -that the UNICODE macro is getting pre-defined and that the -unicode capable runtime startup code is chosen. - -@item -mwin32 -@opindex mwin32 -This option is available for Cygwin and MinGW targets. It -specifies that the typical Windows pre-defined macros are to -be set in the pre-processor, but does not influence the choice -of runtime library/startup code. - -@item -mwindows -@opindex mwindows -This option is available for Cygwin and MinGW targets. It -specifies that a GUI application is to be generated by -instructing the linker to set the PE header subsystem type -appropriately. - -@item -fno-set-stack-executable -@opindex fno-set-stack-executable -This option is available for MinGW targets. It specifies that -the executable flag for stack used by nested functions isn't -set. This is necessary for binaries running in kernel mode of -Windows, as there the user32 API, which is used to set executable -privileges, isn't available. - -@item -mpe-aligned-commons -@opindex mpe-aligned-commons -This option is available for Cygwin and MinGW targets. It -specifies that the GNU extension to the PE file format that -permits the correct alignment of COMMON variables should be -used when generating code. It will be enabled by default if -GCC detects that the target assembler found during configuration -supports the feature. -@end table - -See also under @ref{i386 and x86-64 Options} for standard options. - @node Xstormy16 Options @subsection Xstormy16 Options @cindex Xstormy16 Options diff -Naur gcc-4.6.0.orig/gcc/doc/passes.texi gcc-4.6.0/gcc/doc/passes.texi --- gcc-4.6.0.orig/gcc/doc/passes.texi 2011-01-03 20:52:22.000000000 +0000 +++ gcc-4.6.0/gcc/doc/passes.texi 2011-04-17 21:59:00.097691000 +0000 @@ -1,4 +1,4 @@ -@c markers: CROSSREF BUG TODO +@c markers: BUG TODO @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, @c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 @@ -32,7 +32,7 @@ The language front end is invoked only once, via @code{lang_hooks.parse_file}, to parse the entire input. The language front end may use any intermediate language representation deemed -appropriate. The C front end uses GENERIC trees (CROSSREF), plus +appropriate. The C front end uses GENERIC trees (@pxref{GENERIC}), plus a double handful of language specific tree codes defined in @file{c-common.def}. The Fortran front end uses a completely different private representation. @@ -46,10 +46,9 @@ At some point the front end must translate the representation used in the front end to a representation understood by the language-independent portions of the compiler. Current practice takes one of two forms. -The C front end manually invokes the gimplifier (CROSSREF) on each function, +The C front end manually invokes the gimplifier (@pxref{GIMPLE}) on each function, and uses the gimplifier callbacks to convert the language-specific tree -nodes directly to GIMPLE (CROSSREF) before passing the function off to -be compiled. +nodes directly to GIMPLE before passing the function off to be compiled. The Fortran front end converts from a private representation to GENERIC, which is later lowered to GIMPLE when the function is compiled. Which route to choose probably depends on how well GENERIC (plus extensions) @@ -111,11 +110,10 @@ @cindex GIMPLE @dfn{Gimplification} is a whimsical term for the process of converting the intermediate representation of a function into the GIMPLE language -(CROSSREF). The term stuck, and so words like ``gimplification'', +(@pxref{GIMPLE}). The term stuck, and so words like ``gimplification'', ``gimplify'', ``gimplifier'' and the like are sprinkled throughout this section of code. -@cindex GENERIC While a front end may certainly choose to generate GIMPLE directly if it chooses, this can be a moderately complex process unless the intermediate language used by the front end is already fairly simple. diff -Naur gcc-4.6.0.orig/gcc/dse.c gcc-4.6.0/gcc/dse.c --- gcc-4.6.0.orig/gcc/dse.c 2011-02-11 20:52:55.000000000 +0000 +++ gcc-4.6.0/gcc/dse.c 2011-03-26 09:20:34.263941000 +0000 @@ -1,5 +1,5 @@ /* RTL dead store elimination. - Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Richard Sandiford @@ -47,6 +47,7 @@ #include "optabs.h" #include "dbgcnt.h" #include "target.h" +#include "params.h" /* This file contains three techniques for performing Dead Store Elimination (dse). @@ -387,6 +388,7 @@ /* The linked list of stores that are under consideration in this basic block. */ static insn_info_t active_local_stores; +static int active_local_stores_len; struct bb_info { @@ -947,6 +949,7 @@ } insn_info->wild_read = true; active_local_stores = NULL; + active_local_stores_len = 0; } @@ -1530,20 +1533,21 @@ /* An insn can be deleted if every position of every one of its s_infos is zero. */ - if (any_positions_needed_p (s_info) - || ptr->cannot_delete) + if (any_positions_needed_p (s_info)) del = false; if (del) { insn_info_t insn_to_delete = ptr; + active_local_stores_len--; if (last) last->next_local_store = ptr->next_local_store; else active_local_stores = ptr->next_local_store; - delete_dead_store_insn (insn_to_delete); + if (!insn_to_delete->cannot_delete) + delete_dead_store_insn (insn_to_delete); } else last = ptr; @@ -2074,6 +2078,7 @@ if (dump_file) dump_insn_info ("removing from active", i_ptr); + active_local_stores_len--; if (last) last->next_local_store = i_ptr->next_local_store; else @@ -2163,6 +2168,7 @@ if (dump_file) dump_insn_info ("removing from active", i_ptr); + active_local_stores_len--; if (last) last->next_local_store = i_ptr->next_local_store; else @@ -2222,6 +2228,7 @@ if (dump_file) dump_insn_info ("removing from active", i_ptr); + active_local_stores_len--; if (last) last->next_local_store = i_ptr->next_local_store; else @@ -2426,6 +2433,7 @@ if (dump_file) dump_insn_info ("removing from active", i_ptr); + active_local_stores_len--; if (last) last->next_local_store = i_ptr->next_local_store; else @@ -2453,6 +2461,12 @@ fprintf (dump_file, "handling memset as BLKmode store\n"); if (mems_found == 1) { + if (active_local_stores_len++ + >= PARAM_VALUE (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES)) + { + active_local_stores_len = 1; + active_local_stores = NULL; + } insn_info->next_local_store = active_local_stores; active_local_stores = insn_info; } @@ -2496,6 +2510,12 @@ it as cannot delete. This simplifies the processing later. */ if (mems_found == 1) { + if (active_local_stores_len++ + >= PARAM_VALUE (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES)) + { + active_local_stores_len = 1; + active_local_stores = NULL; + } insn_info->next_local_store = active_local_stores; active_local_stores = insn_info; } @@ -2534,6 +2554,7 @@ if (del) { + active_local_stores_len--; if (last) last->next_local_store = insn_info->next_local_store; else @@ -2584,6 +2605,7 @@ = create_alloc_pool ("cse_store_info_pool", sizeof (struct store_info), 100); active_local_stores = NULL; + active_local_stores_len = 0; cselib_clear_table (); /* Scan the insns. */ diff -Naur gcc-4.6.0.orig/gcc/dwarf2out.c gcc-4.6.0/gcc/dwarf2out.c --- gcc-4.6.0.orig/gcc/dwarf2out.c 2011-03-18 16:22:01.000000000 +0000 +++ gcc-4.6.0/gcc/dwarf2out.c 2011-04-18 17:37:55.217925000 +0000 @@ -303,10 +303,8 @@ const char *dw_fde_end; const char *dw_fde_vms_end_prologue; const char *dw_fde_vms_begin_epilogue; - const char *dw_fde_hot_section_label; - const char *dw_fde_hot_section_end_label; - const char *dw_fde_unlikely_section_label; - const char *dw_fde_unlikely_section_end_label; + const char *dw_fde_second_begin; + const char *dw_fde_second_end; dw_cfi_ref dw_fde_cfi; dw_cfi_ref dw_fde_switch_cfi; /* Last CFI before switching sections. */ HOST_WIDE_INT stack_realignment; @@ -325,13 +323,9 @@ unsigned drap_reg_saved: 1; /* True iff dw_fde_begin label is in text_section or cold_text_section. */ unsigned in_std_section : 1; - /* True iff dw_fde_unlikely_section_label is in text_section or + /* True iff dw_fde_second_begin label is in text_section or cold_text_section. */ - unsigned cold_in_std_section : 1; - /* True iff switched sections. */ - unsigned dw_fde_switched_sections : 1; - /* True iff switching from cold to hot section. */ - unsigned dw_fde_switched_cold_to_hot : 1; + unsigned second_in_std_section : 1; } dw_fde_node; @@ -3625,28 +3619,8 @@ dw2_asm_output_offset (DWARF_OFFSET_SIZE, section_start_label, debug_frame_section, "FDE CIE offset"); - if (!fde->dw_fde_switched_sections) - { - begin = fde->dw_fde_begin; - end = fde->dw_fde_end; - } - else - { - /* For the first section, prefer dw_fde_begin over - dw_fde_{hot,cold}_section_label, as the latter - might be separated from the real start of the - function by alignment padding. */ - if (!second) - begin = fde->dw_fde_begin; - else if (fde->dw_fde_switched_cold_to_hot) - begin = fde->dw_fde_hot_section_label; - else - begin = fde->dw_fde_unlikely_section_label; - if (second ^ fde->dw_fde_switched_cold_to_hot) - end = fde->dw_fde_unlikely_section_end_label; - else - end = fde->dw_fde_hot_section_end_label; - } + begin = second ? fde->dw_fde_second_begin : fde->dw_fde_begin; + end = second ? fde->dw_fde_second_end : fde->dw_fde_end; if (for_eh) { @@ -3707,7 +3681,7 @@ /* Loop through the Call Frame Instructions associated with this FDE. */ fde->dw_fde_current_label = begin; - if (!fde->dw_fde_switched_sections) + if (fde->dw_fde_second_begin == NULL) for (cfi = fde->dw_fde_cfi; cfi != NULL; cfi = cfi->dw_cfi_next) output_cfi (cfi, fde, for_eh); else if (!second) @@ -3986,7 +3960,7 @@ if (for_eh && !fde_needed_for_eh_p (fde)) continue; - for (k = 0; k < (fde->dw_fde_switched_sections ? 2 : 1); k++) + for (k = 0; k < (fde->dw_fde_second_begin ? 2 : 1); k++) output_fde (fde, for_eh, k, section_start_label, fde_encoding, augmentation, any_lsda_needed, lsda_encoding); } @@ -4104,14 +4078,10 @@ fde = &fde_table[fde_table_in_use++]; fde->decl = current_function_decl; fde->dw_fde_begin = dup_label; - fde->dw_fde_current_label = dup_label; - fde->dw_fde_hot_section_label = NULL; - fde->dw_fde_hot_section_end_label = NULL; - fde->dw_fde_unlikely_section_label = NULL; - fde->dw_fde_unlikely_section_end_label = NULL; - fde->dw_fde_switched_sections = 0; - fde->dw_fde_switched_cold_to_hot = 0; fde->dw_fde_end = NULL; + fde->dw_fde_current_label = dup_label; + fde->dw_fde_second_begin = NULL; + fde->dw_fde_second_end = NULL; fde->dw_fde_vms_end_prologue = NULL; fde->dw_fde_vms_begin_epilogue = NULL; fde->dw_fde_cfi = NULL; @@ -4122,27 +4092,9 @@ fde->nothrow = crtl->nothrow; fde->drap_reg = INVALID_REGNUM; fde->vdrap_reg = INVALID_REGNUM; - if (flag_reorder_blocks_and_partition) - { - section *unlikelysec; - if (first_function_block_is_cold) - fde->in_std_section = 1; - else - fde->in_std_section - = (fnsec == text_section - || (cold_text_section && fnsec == cold_text_section)); - unlikelysec = unlikely_text_section (); - fde->cold_in_std_section - = (unlikelysec == text_section - || (cold_text_section && unlikelysec == cold_text_section)); - } - else - { - fde->in_std_section - = (fnsec == text_section - || (cold_text_section && fnsec == cold_text_section)); - fde->cold_in_std_section = 0; - } + fde->in_std_section = (fnsec == text_section + || (cold_text_section && fnsec == cold_text_section)); + fde->second_in_std_section = 0; args_size = old_args_size = 0; @@ -4238,7 +4190,8 @@ ASM_OUTPUT_LABEL (asm_out_file, label); fde = current_fde (); gcc_assert (fde != NULL); - fde->dw_fde_end = xstrdup (label); + if (fde->dw_fde_second_begin == NULL) + fde->dw_fde_end = xstrdup (label); } void @@ -4285,20 +4238,29 @@ cold_text_section_used = true; } +static void var_location_switch_text_section (void); + void dwarf2out_switch_text_section (void) { + section *sect; dw_fde_ref fde = current_fde (); + dw_cfi_ref cfi; - gcc_assert (cfun && fde && !fde->dw_fde_switched_sections); - - fde->dw_fde_switched_sections = 1; - fde->dw_fde_switched_cold_to_hot = !in_cold_section_p; + gcc_assert (cfun && fde && fde->dw_fde_second_begin == NULL); - fde->dw_fde_hot_section_label = crtl->subsections.hot_section_label; - fde->dw_fde_hot_section_end_label = crtl->subsections.hot_section_end_label; - fde->dw_fde_unlikely_section_label = crtl->subsections.cold_section_label; - fde->dw_fde_unlikely_section_end_label = crtl->subsections.cold_section_end_label; + if (!in_cold_section_p) + { + fde->dw_fde_end = crtl->subsections.cold_section_end_label; + fde->dw_fde_second_begin = crtl->subsections.hot_section_label; + fde->dw_fde_second_end = crtl->subsections.hot_section_end_label; + } + else + { + fde->dw_fde_end = crtl->subsections.hot_section_end_label; + fde->dw_fde_second_begin = crtl->subsections.cold_section_label; + fde->dw_fde_second_end = crtl->subsections.cold_section_end_label; + } have_multiple_function_sections = true; /* Reset the current label on switching text sections, so that we @@ -4313,7 +4275,12 @@ fprintf (asm_out_file, "\t.cfi_endproc\n"); /* Now do the real section switch. */ - switch_to_section (current_function_section ()); + sect = current_function_section (); + switch_to_section (sect); + + fde->second_in_std_section + = (sect == text_section + || (cold_text_section && sect == cold_text_section)); if (dwarf2out_do_cfi_asm ()) { @@ -4322,16 +4289,12 @@ again. */ output_cfis (fde->dw_fde_cfi, true, fde, true); } - else - { - dw_cfi_ref cfi = fde->dw_fde_cfi; - - cfi = fde->dw_fde_cfi; - if (cfi) - while (cfi->dw_cfi_next != NULL) - cfi = cfi->dw_cfi_next; - fde->dw_fde_switch_cfi = cfi; - } + cfi = fde->dw_fde_cfi; + if (cfi) + while (cfi->dw_cfi_next != NULL) + cfi = cfi->dw_cfi_next; + fde->dw_fde_switch_cfi = cfi; + var_location_switch_text_section (); } /* And now, the subset of the debugging information support code necessary @@ -6110,6 +6073,11 @@ Do not mark it for GC because it is marked through the chain. */ struct var_loc_node * GTY ((skip ("%h"))) last; + /* Pointer to the last element before section switch, + if NULL, either sections weren't switched or first + is after section switch. */ + struct var_loc_node * GTY ((skip ("%h"))) last_before_switch; + /* DECL_UID of the variable decl. */ unsigned int decl_id; }; @@ -6177,19 +6145,6 @@ defines/undefines (and file start/end markers). */ static GTY (()) VEC (macinfo_entry, gc) * macinfo_table; -/* Array of dies for which we should generate .debug_arange info. */ -static GTY((length ("arange_table_allocated"))) dw_die_ref *arange_table; - -/* Number of elements currently allocated for arange_table. */ -static GTY(()) unsigned arange_table_allocated; - -/* Number of elements in arange_table currently in use. */ -static GTY(()) unsigned arange_table_in_use; - -/* Size (in elements) of increments by which we may expand the - arange_table. */ -#define ARANGE_TABLE_INCREMENT 64 - /* Array of dies for which we should generate .debug_ranges info. */ static GTY ((length ("ranges_table_allocated"))) dw_ranges_ref ranges_table; @@ -6433,8 +6388,7 @@ static void add_pubname_string (const char *, dw_die_ref); static void add_pubtype (tree, dw_die_ref); static void output_pubnames (VEC (pubname_entry,gc) *); -static void add_arange (tree, dw_die_ref); -static void output_aranges (void); +static void output_aranges (unsigned long); static unsigned int add_ranges_num (int); static unsigned int add_ranges (const_tree); static void add_ranges_by_labels (dw_die_ref, const char *, const char *, @@ -6537,7 +6491,7 @@ static void gen_type_die (tree, dw_die_ref); static void gen_block_die (tree, dw_die_ref, int); static void decls_for_scope (tree, dw_die_ref, int); -static int is_redundant_typedef (const_tree); +static inline int is_redundant_typedef (const_tree); static bool is_naming_typedef_decl (const_tree); static inline dw_die_ref get_context_die (tree); static void gen_namespace_die (tree, dw_die_ref); @@ -10868,7 +10822,20 @@ size += 2 * DWARF2_ADDR_SIZE; if (cold_text_section_used) size += 2 * DWARF2_ADDR_SIZE; - size += 2 * DWARF2_ADDR_SIZE * arange_table_in_use; + if (have_multiple_function_sections) + { + unsigned fde_idx = 0; + + for (fde_idx = 0; fde_idx < fde_table_in_use; fde_idx++) + { + dw_fde_ref fde = &fde_table[fde_idx]; + + if (!fde->in_std_section) + size += 2 * DWARF2_ADDR_SIZE; + if (fde->dw_fde_second_begin && !fde->second_in_std_section) + size += 2 * DWARF2_ADDR_SIZE; + } + } /* Count the two zero words used to terminated the address range table. */ size += 2 * DWARF2_ADDR_SIZE; @@ -11696,35 +11663,14 @@ dw2_asm_output_data (DWARF_OFFSET_SIZE, 0, NULL); } -/* Add a new entry to .debug_aranges if appropriate. */ - -static void -add_arange (tree decl, dw_die_ref die) -{ - if (! DECL_SECTION_NAME (decl)) - return; - - if (arange_table_in_use == arange_table_allocated) - { - arange_table_allocated += ARANGE_TABLE_INCREMENT; - arange_table = GGC_RESIZEVEC (dw_die_ref, arange_table, - arange_table_allocated); - memset (arange_table + arange_table_in_use, 0, - ARANGE_TABLE_INCREMENT * sizeof (dw_die_ref)); - } - - arange_table[arange_table_in_use++] = die; -} - /* Output the information that goes into the .debug_aranges table. Namely, define the beginning and ending address range of the text section generated for this compilation unit. */ static void -output_aranges (void) +output_aranges (unsigned long aranges_length) { unsigned i; - unsigned long aranges_length = size_of_aranges (); if (DWARF_INITIAL_LENGTH_SIZE - DWARF_OFFSET_SIZE == 4) dw2_asm_output_data (4, 0xffffffff, @@ -11769,38 +11715,28 @@ cold_text_section_label, "Length"); } - for (i = 0; i < arange_table_in_use; i++) + if (have_multiple_function_sections) { - dw_die_ref die = arange_table[i]; - - /* We shouldn't see aranges for DIEs outside of the main CU. */ - gcc_assert (die->die_mark); + unsigned fde_idx = 0; - if (die->die_tag == DW_TAG_subprogram) - { - dw2_asm_output_addr (DWARF2_ADDR_SIZE, get_AT_low_pc (die), - "Address"); - dw2_asm_output_delta (DWARF2_ADDR_SIZE, get_AT_hi_pc (die), - get_AT_low_pc (die), "Length"); - } - else + for (fde_idx = 0; fde_idx < fde_table_in_use; fde_idx++) { - /* A static variable; extract the symbol from DW_AT_location. - Note that this code isn't currently hit, as we only emit - aranges for functions (jason 9/23/99). */ - dw_attr_ref a = get_AT (die, DW_AT_location); - dw_loc_descr_ref loc; - - gcc_assert (a && AT_class (a) == dw_val_class_loc); - - loc = AT_loc (a); - gcc_assert (loc->dw_loc_opc == DW_OP_addr); - - dw2_asm_output_addr_rtx (DWARF2_ADDR_SIZE, - loc->dw_loc_oprnd1.v.val_addr, "Address"); - dw2_asm_output_data (DWARF2_ADDR_SIZE, - get_AT_unsigned (die, DW_AT_byte_size), - "Length"); + dw_fde_ref fde = &fde_table[fde_idx]; + + if (!fde->in_std_section) + { + dw2_asm_output_addr (DWARF2_ADDR_SIZE, fde->dw_fde_begin, + "Address"); + dw2_asm_output_delta (DWARF2_ADDR_SIZE, fde->dw_fde_end, + fde->dw_fde_begin, "Length"); + } + if (fde->dw_fde_second_begin && !fde->second_in_std_section) + { + dw2_asm_output_addr (DWARF2_ADDR_SIZE, fde->dw_fde_second_begin, + "Address"); + dw2_asm_output_delta (DWARF2_ADDR_SIZE, fde->dw_fde_second_end, + fde->dw_fde_second_begin, "Length"); + } } } @@ -13609,7 +13545,7 @@ int base_reg = DWARF_FRAME_REGNUM ((fde && fde->drap_reg != INVALID_REGNUM) ? HARD_FRAME_POINTER_REGNUM - : STACK_POINTER_REGNUM); + : REGNO (elim)); return new_reg_loc_descr (base_reg, offset); } @@ -15210,9 +15146,23 @@ } if (descr) { + bool range_across_switch = false; + /* If section switch happens in between node->label + and node->next->label (or end of function) and + we can't emit it as a single entry list, + emit two ranges, first one ending at the end + of first partition and second one starting at the + beginning of second partition. */ + if (node == loc_list->last_before_switch + && (node != loc_list->first || loc_list->first->next) + && current_function_decl) + { + endname = current_fde ()->dw_fde_end; + range_across_switch = true; + } /* The variable has a location between NODE->LABEL and NODE->NEXT->LABEL. */ - if (node->next) + else if (node->next) endname = node->next->label; /* If the variable has a location at the last label it keeps its location until the end of function. */ @@ -15227,6 +15177,30 @@ *listp = new_loc_list (descr, node->label, endname, secname); listp = &(*listp)->dw_loc_next; + + if (range_across_switch) + { + if (GET_CODE (node->loc) == EXPR_LIST) + descr = dw_sra_loc_expr (decl, node->loc); + else + { + initialized = NOTE_VAR_LOCATION_STATUS (node->loc); + varloc = NOTE_VAR_LOCATION (node->loc); + descr = dw_loc_list_1 (decl, varloc, want_address, + initialized); + } + gcc_assert (descr); + /* The variable has a location between NODE->LABEL and + NODE->NEXT->LABEL. */ + if (node->next) + endname = node->next->label; + else + endname = current_fde ()->dw_fde_second_end; + *listp = new_loc_list (descr, + current_fde ()->dw_fde_second_begin, + endname, secname); + listp = &(*listp)->dw_loc_next; + } } } @@ -17305,33 +17279,61 @@ last_cfa = next_cfa; last_label = start_label; + if (fde->dw_fde_second_begin && fde->dw_fde_switch_cfi == NULL) + { + /* If the first partition contained no CFI adjustments, the + CIE opcodes apply to the whole first partition. */ + *list_tail = new_loc_list (build_cfa_loc (&last_cfa, offset), + fde->dw_fde_begin, fde->dw_fde_end, section); + list_tail =&(*list_tail)->dw_loc_next; + start_label = last_label = fde->dw_fde_second_begin; + } + for (cfi = fde->dw_fde_cfi; cfi; cfi = cfi->dw_cfi_next) - switch (cfi->dw_cfi_opc) - { - case DW_CFA_set_loc: - case DW_CFA_advance_loc1: - case DW_CFA_advance_loc2: - case DW_CFA_advance_loc4: - if (!cfa_equal_p (&last_cfa, &next_cfa)) - { - *list_tail = new_loc_list (build_cfa_loc (&last_cfa, offset), - start_label, last_label, section); + { + switch (cfi->dw_cfi_opc) + { + case DW_CFA_set_loc: + case DW_CFA_advance_loc1: + case DW_CFA_advance_loc2: + case DW_CFA_advance_loc4: + if (!cfa_equal_p (&last_cfa, &next_cfa)) + { + *list_tail = new_loc_list (build_cfa_loc (&last_cfa, offset), + start_label, last_label, section); - list_tail = &(*list_tail)->dw_loc_next; - last_cfa = next_cfa; - start_label = last_label; - } - last_label = cfi->dw_cfi_oprnd1.dw_cfi_addr; - break; + list_tail = &(*list_tail)->dw_loc_next; + last_cfa = next_cfa; + start_label = last_label; + } + last_label = cfi->dw_cfi_oprnd1.dw_cfi_addr; + break; - case DW_CFA_advance_loc: - /* The encoding is complex enough that we should never emit this. */ - gcc_unreachable (); + case DW_CFA_advance_loc: + /* The encoding is complex enough that we should never emit this. */ + gcc_unreachable (); - default: - lookup_cfa_1 (cfi, &next_cfa, &remember); - break; - } + default: + lookup_cfa_1 (cfi, &next_cfa, &remember); + break; + } + if (cfi == fde->dw_fde_switch_cfi) + { + if (!cfa_equal_p (&last_cfa, &next_cfa)) + { + *list_tail = new_loc_list (build_cfa_loc (&last_cfa, offset), + start_label, last_label, section); + + list_tail = &(*list_tail)->dw_loc_next; + last_cfa = next_cfa; + start_label = last_label; + } + *list_tail = new_loc_list (build_cfa_loc (&last_cfa, offset), + start_label, fde->dw_fde_end, section); + list_tail = &(*list_tail)->dw_loc_next; + start_label = last_label = fde->dw_fde_second_begin; + } + } if (!cfa_equal_p (&last_cfa, &next_cfa)) { @@ -17342,7 +17344,10 @@ } *list_tail = new_loc_list (build_cfa_loc (&next_cfa, offset), - start_label, fde->dw_fde_end, section); + start_label, + fde->dw_fde_second_begin + ? fde->dw_fde_second_end : fde->dw_fde_end, + section); if (list && list->dw_loc_next) gen_llsym (list); @@ -19213,14 +19218,13 @@ #endif add_pubname (decl, subr_die); - add_arange (decl, subr_die); } else { /* Generate pubnames entries for the split function code ranges. */ dw_fde_ref fde = &fde_table[current_funcdef_fde]; - if (fde->dw_fde_switched_sections) + if (fde->dw_fde_second_begin) { if (dwarf_version >= 3 || !dwarf_strict) { @@ -19229,28 +19233,11 @@ section, since the HOT/COLD labels might precede an alignment offset. */ bool range_list_added = false; - if (fde->in_std_section) - { - add_ranges_by_labels (subr_die, - fde->dw_fde_begin, - fde->dw_fde_end, - &range_list_added); - add_ranges_by_labels (subr_die, - fde->dw_fde_unlikely_section_label, - fde->dw_fde_unlikely_section_end_label, - &range_list_added); - } - else - { - add_ranges_by_labels (subr_die, - fde->dw_fde_begin, - fde->dw_fde_end, - &range_list_added); - add_ranges_by_labels (subr_die, - fde->dw_fde_hot_section_label, - fde->dw_fde_hot_section_end_label, - &range_list_added); - } + add_ranges_by_labels (subr_die, fde->dw_fde_begin, + fde->dw_fde_end, &range_list_added); + add_ranges_by_labels (subr_die, fde->dw_fde_second_begin, + fde->dw_fde_second_end, + &range_list_added); add_pubname (decl, subr_die); if (range_list_added) add_ranges (NULL); @@ -19275,7 +19262,6 @@ fde->dw_fde_end); /* Add it. */ add_pubname (decl, subr_die); - add_arange (decl, subr_die); /* Build a minimal DIE for the secondary section. */ seg_die = new_die (DW_TAG_subprogram, @@ -19293,30 +19279,18 @@ add_linkage_name (seg_die, decl); } - gcc_assert (name!=NULL); + gcc_assert (name != NULL); add_pure_or_virtual_attribute (seg_die, decl); if (DECL_ARTIFICIAL (decl)) add_AT_flag (seg_die, DW_AT_artificial, 1); - if (fde->in_std_section) - { - name = concat ("__cold_sect_of_", name, NULL); - add_AT_lbl_id (seg_die, DW_AT_low_pc, - fde->dw_fde_unlikely_section_label); - add_AT_lbl_id (seg_die, DW_AT_high_pc, - fde->dw_fde_unlikely_section_end_label); - } - else - { - name = concat ("__hot_sect_of_", name, NULL); - add_AT_lbl_id (seg_die, DW_AT_low_pc, - fde->dw_fde_hot_section_label); - add_AT_lbl_id (seg_die, DW_AT_high_pc, - fde->dw_fde_hot_section_end_label); - } + name = concat ("__second_sect_of_", name, NULL); + add_AT_lbl_id (seg_die, DW_AT_low_pc, + fde->dw_fde_second_begin); + add_AT_lbl_id (seg_die, DW_AT_high_pc, + fde->dw_fde_second_end); add_name_attribute (seg_die, name); add_pubname_string (name, seg_die); - add_arange (decl, seg_die); } } else @@ -19324,7 +19298,6 @@ add_AT_lbl_id (subr_die, DW_AT_low_pc, fde->dw_fde_begin); add_AT_lbl_id (subr_die, DW_AT_high_pc, fde->dw_fde_end); add_pubname (decl, subr_die); - add_arange (decl, subr_die); } } @@ -21975,6 +21948,29 @@ last_in_cold_section_p = in_cold_section_p; } +/* Note in one location list that text section has changed. */ + +static int +var_location_switch_text_section_1 (void **slot, void *data ATTRIBUTE_UNUSED) +{ + var_loc_list *list = (var_loc_list *) *slot; + if (list->first) + list->last_before_switch + = list->last->next ? list->last->next : list->last; + return 1; +} + +/* Note in all location lists that text section has changed. */ + +static void +var_location_switch_text_section (void) +{ + if (decl_loc_table == NULL) + return; + + htab_traverse (decl_loc_table, var_location_switch_text_section_1, NULL); +} + /* We need to reset the locations at the beginning of each function. We can't do this in the end_function hook, because the declarations that use the locations won't have been output when @@ -21985,7 +21981,7 @@ { if (function_section (fun) != text_section) have_multiple_function_sections = true; - else if (flag_reorder_blocks_and_partition && !cold_text_section) + if (flag_reorder_blocks_and_partition && !cold_text_section) { gcc_assert (current_function_decl == fun); cold_text_section = unlikely_text_section (); @@ -22702,11 +22698,9 @@ } /* Also set the mark on nodes referenced from the - pubname_table or arange_table. */ + pubname_table. */ FOR_EACH_VEC_ELT (pubname_entry, pubname_table, i, pub) prune_unused_types_mark (pub->die, 1); - for (i = 0; i < arange_table_in_use; i++) - prune_unused_types_mark (arange_table[i], 1); /* Mark nodes referenced from the direct call table. */ FOR_EACH_VEC_ELT (dcall_entry, dcall_table, i, dcall) @@ -23479,7 +23473,7 @@ if (text_section_used) add_ranges_by_labels (comp_unit_die (), text_section_label, text_end_label, &range_list_added); - if (flag_reorder_blocks_and_partition && cold_text_section_used) + if (cold_text_section_used) add_ranges_by_labels (comp_unit_die (), cold_text_section_label, cold_end_label, &range_list_added); @@ -23487,22 +23481,12 @@ { dw_fde_ref fde = &fde_table[fde_idx]; - if (fde->dw_fde_switched_sections) - { - if (!fde->in_std_section) - add_ranges_by_labels (comp_unit_die (), - fde->dw_fde_hot_section_label, - fde->dw_fde_hot_section_end_label, - &range_list_added); - if (!fde->cold_in_std_section) - add_ranges_by_labels (comp_unit_die (), - fde->dw_fde_unlikely_section_label, - fde->dw_fde_unlikely_section_end_label, - &range_list_added); - } - else if (!fde->in_std_section) + if (!fde->in_std_section) add_ranges_by_labels (comp_unit_die (), fde->dw_fde_begin, fde->dw_fde_end, &range_list_added); + if (fde->dw_fde_second_begin && !fde->second_in_std_section) + add_ranges_by_labels (comp_unit_die (), fde->dw_fde_second_begin, + fde->dw_fde_second_end, &range_list_added); } if (range_list_added) @@ -23614,13 +23598,21 @@ output_vcall_table (); } - /* Output the address range information. We only put functions in the arange - table, so don't write it out if we don't have any. */ - if ((text_section_used || cold_text_section_used || arange_table_in_use) - && info_section_emitted) - { - switch_to_section (debug_aranges_section); - output_aranges (); + /* Output the address range information. We only put functions in the + arange table, so don't write it out if we don't have any. */ + if (info_section_emitted) + { + unsigned long aranges_length = size_of_aranges (); + + /* Empty .debug_aranges would contain just header and + terminating 0,0. */ + if (aranges_length + != (unsigned long) (DWARF_ARANGES_HEADER_SIZE + + 2 * DWARF2_ADDR_SIZE)) + { + switch_to_section (debug_aranges_section); + output_aranges (aranges_length); + } } /* Output ranges section if necessary. */ diff -Naur gcc-4.6.0.orig/gcc/expmed.c gcc-4.6.0/gcc/expmed.c --- gcc-4.6.0.orig/gcc/expmed.c 2011-03-04 10:31:33.000000000 +0000 +++ gcc-4.6.0/gcc/expmed.c 2011-04-06 20:39:20.887184000 +0000 @@ -457,8 +457,10 @@ && bitsize == GET_MODE_BITSIZE (fieldmode) && (!MEM_P (op0) ? ((GET_MODE_SIZE (fieldmode) >= UNITS_PER_WORD - || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode)) - && byte_offset % GET_MODE_SIZE (fieldmode) == 0) + || GET_MODE_SIZE (GET_MODE (op0)) == GET_MODE_SIZE (fieldmode)) + && ((GET_MODE (op0) == fieldmode && byte_offset == 0) + || validate_subreg (fieldmode, GET_MODE (op0), op0, + byte_offset))) : (! SLOW_UNALIGNED_ACCESS (fieldmode, MEM_ALIGN (op0)) || (offset * BITS_PER_UNIT % bitsize == 0 && MEM_ALIGN (op0) % GET_MODE_BITSIZE (fieldmode) == 0)))) @@ -519,6 +521,7 @@ rtx insn; rtx start = get_last_insn (); rtx arg0 = op0; + unsigned HOST_WIDE_INT subreg_off; /* Get appropriate low part of the value being stored. */ if (CONST_INT_P (value) || REG_P (value)) @@ -542,15 +545,17 @@ arg0 = SUBREG_REG (op0); } - insn = (GEN_FCN (icode) - (gen_rtx_SUBREG (fieldmode, arg0, - (bitnum % BITS_PER_WORD) / BITS_PER_UNIT - + (offset * UNITS_PER_WORD)), - value)); - if (insn) - { - emit_insn (insn); - return true; + subreg_off = (bitnum % BITS_PER_WORD) / BITS_PER_UNIT + + (offset * UNITS_PER_WORD); + if (validate_subreg (fieldmode, GET_MODE (arg0), arg0, subreg_off)) + { + insn = (GEN_FCN (icode) (gen_rtx_SUBREG (fieldmode, arg0, + subreg_off), value)); + if (insn) + { + emit_insn (insn); + return true; + } } delete_insns_since (start); } @@ -1106,22 +1111,32 @@ if (GET_CODE (op0) == SUBREG) { int word_offset = (SUBREG_BYTE (op0) / UNITS_PER_WORD) + offset; - word = operand_subword_force (SUBREG_REG (op0), word_offset, - GET_MODE (SUBREG_REG (op0))); + enum machine_mode sub_mode = GET_MODE (SUBREG_REG (op0)); + if (sub_mode != BLKmode && GET_MODE_SIZE (sub_mode) < UNITS_PER_WORD) + word = word_offset ? const0_rtx : op0; + else + word = operand_subword_force (SUBREG_REG (op0), word_offset, + GET_MODE (SUBREG_REG (op0))); offset = 0; } else if (REG_P (op0)) { - word = operand_subword_force (op0, offset, GET_MODE (op0)); + enum machine_mode op0_mode = GET_MODE (op0); + if (op0_mode != BLKmode && GET_MODE_SIZE (op0_mode) < UNITS_PER_WORD) + word = offset ? const0_rtx : op0; + else + word = operand_subword_force (op0, offset, GET_MODE (op0)); offset = 0; } else word = op0; /* OFFSET is in UNITs, and UNIT is in bits. - store_fixed_bit_field wants offset in bytes. */ - store_fixed_bit_field (word, offset * unit / BITS_PER_UNIT, thissize, - thispos, part); + store_fixed_bit_field wants offset in bytes. If WORD is const0_rtx, + it is just an out-of-bounds access. Ignore it. */ + if (word != const0_rtx) + store_fixed_bit_field (word, offset * unit / BITS_PER_UNIT, thissize, + thispos, part); bitsdone += thissize; } } diff -Naur gcc-4.6.0.orig/gcc/expr.c gcc-4.6.0/gcc/expr.c --- gcc-4.6.0.orig/gcc/expr.c 2011-03-18 09:04:31.000000000 +0000 +++ gcc-4.6.0/gcc/expr.c 2011-04-06 20:39:20.887184000 +0000 @@ -4292,16 +4292,47 @@ /* Handle expand_expr of a complex value returning a CONCAT. */ else if (GET_CODE (to_rtx) == CONCAT) { - if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from)))) + unsigned short mode_bitsize = GET_MODE_BITSIZE (GET_MODE (to_rtx)); + if (COMPLEX_MODE_P (TYPE_MODE (TREE_TYPE (from))) + && bitpos == 0 + && bitsize == mode_bitsize) + result = store_expr (from, to_rtx, false, nontemporal); + else if (bitsize == mode_bitsize / 2 + && (bitpos == 0 || bitpos == mode_bitsize / 2)) + result = store_expr (from, XEXP (to_rtx, bitpos != 0), false, + nontemporal); + else if (bitpos + bitsize <= mode_bitsize / 2) + result = store_field (XEXP (to_rtx, 0), bitsize, bitpos, + mode1, from, TREE_TYPE (tem), + get_alias_set (to), nontemporal); + else if (bitpos >= mode_bitsize / 2) + result = store_field (XEXP (to_rtx, 1), bitsize, + bitpos - mode_bitsize / 2, mode1, from, + TREE_TYPE (tem), get_alias_set (to), + nontemporal); + else if (bitpos == 0 && bitsize == mode_bitsize) { - gcc_assert (bitpos == 0); - result = store_expr (from, to_rtx, false, nontemporal); + rtx from_rtx; + result = expand_normal (from); + from_rtx = simplify_gen_subreg (GET_MODE (to_rtx), result, + TYPE_MODE (TREE_TYPE (from)), 0); + emit_move_insn (XEXP (to_rtx, 0), + read_complex_part (from_rtx, false)); + emit_move_insn (XEXP (to_rtx, 1), + read_complex_part (from_rtx, true)); } else { - gcc_assert (bitpos == 0 || bitpos == GET_MODE_BITSIZE (mode1)); - result = store_expr (from, XEXP (to_rtx, bitpos != 0), false, - nontemporal); + rtx temp = assign_stack_temp (GET_MODE (to_rtx), + GET_MODE_SIZE (GET_MODE (to_rtx)), + 0); + write_complex_part (temp, XEXP (to_rtx, 0), false); + write_complex_part (temp, XEXP (to_rtx, 1), true); + result = store_field (temp, bitsize, bitpos, mode1, from, + TREE_TYPE (tem), get_alias_set (to), + nontemporal); + emit_move_insn (XEXP (to_rtx, 0), read_complex_part (temp, false)); + emit_move_insn (XEXP (to_rtx, 1), read_complex_part (temp, true)); } } else diff -Naur gcc-4.6.0.orig/gcc/final.c gcc-4.6.0/gcc/final.c --- gcc-4.6.0.orig/gcc/final.c 2011-02-28 18:23:25.000000000 +0000 +++ gcc-4.6.0/gcc/final.c 2011-04-28 17:01:55.275457000 +0000 @@ -2238,6 +2238,11 @@ location_t loc; expanded_location expanded; + /* Make sure we flush any queued register saves in case this + clobbers affected registers. */ + if (dwarf2out_do_frame ()) + dwarf2out_frame_debug (insn, false); + /* There's no telling what that did to the condition codes. */ CC_STATUS_INIT; diff -Naur gcc-4.6.0.orig/gcc/fold-const.c gcc-4.6.0/gcc/fold-const.c --- gcc-4.6.0.orig/gcc/fold-const.c 2011-03-08 10:43:10.000000000 +0000 +++ gcc-4.6.0/gcc/fold-const.c 2011-04-23 10:18:54.464278000 +0000 @@ -2020,8 +2020,6 @@ case VOID_TYPE: tem = fold_ignored_result (arg); - if (TREE_CODE (tem) == MODIFY_EXPR) - goto fold_convert_exit; return fold_build1_loc (loc, NOP_EXPR, type, tem); default: @@ -15554,12 +15552,17 @@ } /* *(foo *)&fooarray => fooarray[0] */ else if (TREE_CODE (optype) == ARRAY_TYPE - && type == TREE_TYPE (optype)) + && type == TREE_TYPE (optype) + && (!in_gimple_form + || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)) { tree type_domain = TYPE_DOMAIN (optype); tree min_val = size_zero_node; if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); + if (in_gimple_form + && TREE_CODE (min_val) != INTEGER_CST) + return NULL_TREE; return build4_loc (loc, ARRAY_REF, type, op, min_val, NULL_TREE, NULL_TREE); } @@ -15633,7 +15636,9 @@ /* *(foo *)fooarrptr => (*fooarrptr)[0] */ if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE - && type == TREE_TYPE (TREE_TYPE (subtype))) + && type == TREE_TYPE (TREE_TYPE (subtype)) + && (!in_gimple_form + || TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST)) { tree type_domain; tree min_val = size_zero_node; @@ -15641,6 +15646,9 @@ type_domain = TYPE_DOMAIN (TREE_TYPE (sub)); if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); + if (in_gimple_form + && TREE_CODE (min_val) != INTEGER_CST) + return NULL_TREE; return build4_loc (loc, ARRAY_REF, type, sub, min_val, NULL_TREE, NULL_TREE); } diff -Naur gcc-4.6.0.orig/gcc/fortran/class.c gcc-4.6.0/gcc/fortran/class.c --- gcc-4.6.0.orig/gcc/fortran/class.c 2011-02-16 20:51:56.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/class.c 2011-04-04 18:53:34.102550000 +0000 @@ -137,9 +137,9 @@ { char tmp[2*GFC_MAX_SYMBOL_LEN+2]; get_unique_type_string (&tmp[0], derived); - /* If string is too long, use hash value in hex representation - (allow for extra decoration, cf. gfc_build_class_symbol)*/ - if (strlen (tmp) > GFC_MAX_SYMBOL_LEN - 10) + /* If string is too long, use hash value in hex representation (allow for + extra decoration, cf. gfc_build_class_symbol & gfc_find_derived_vtab). */ + if (strlen (tmp) > GFC_MAX_SYMBOL_LEN - 11) { int h = gfc_hash_value (derived); sprintf (string, "%X", h); diff -Naur gcc-4.6.0.orig/gcc/fortran/expr.c gcc-4.6.0/gcc/fortran/expr.c --- gcc-4.6.0.orig/gcc/fortran/expr.c 2011-03-06 20:15:38.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/expr.c 2011-05-11 20:31:14.899018000 +0000 @@ -894,6 +894,9 @@ case EXPR_FUNCTION: case EXPR_PPC: case EXPR_COMPCALL: + gcc_assert (e->symtree || e->value.function.esym + || e->value.function.isym); + /* Call to intrinsic with at least one argument. */ if (e->value.function.isym && e->value.function.actual) { @@ -902,13 +905,14 @@ return 0; } - /* Make sure we have a symbol. */ - gcc_assert (e->symtree); - - sym = e->symtree->n.sym; - /* Specification functions are constant. */ /* F95, 7.1.6.2; F2003, 7.1.7 */ + sym = NULL; + if (e->symtree) + sym = e->symtree->n.sym; + if (e->value.function.esym) + sym = e->value.function.esym; + if (sym && sym->attr.function && sym->attr.pure @@ -4367,15 +4371,26 @@ gfc_try gfc_check_vardef_context (gfc_expr* e, bool pointer, const char* context) { - gfc_symbol* sym; + gfc_symbol* sym = NULL; bool is_pointer; bool check_intentin; bool ptr_component; symbol_attribute attr; gfc_ref* ref; + if (e->expr_type == EXPR_VARIABLE) + { + gcc_assert (e->symtree); + sym = e->symtree->n.sym; + } + else if (e->expr_type == EXPR_FUNCTION) + { + gcc_assert (e->symtree); + sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym; + } + if (!pointer && e->expr_type == EXPR_FUNCTION - && e->symtree->n.sym->result->attr.pointer) + && sym->result->attr.pointer) { if (!(gfc_option.allow_std & GFC_STD_F2008)) { @@ -4393,9 +4408,6 @@ return FAILURE; } - gcc_assert (e->symtree); - sym = e->symtree->n.sym; - if (!pointer && sym->attr.flavor == FL_PARAMETER) { if (context) diff -Naur gcc-4.6.0.orig/gcc/fortran/f95-lang.c gcc-4.6.0/gcc/fortran/f95-lang.c --- gcc-4.6.0.orig/gcc/fortran/f95-lang.c 2011-02-24 09:53:26.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/f95-lang.c 2011-04-05 08:13:16.302981000 +0000 @@ -695,10 +695,9 @@ type, integer_type_node, NULL_TREE); /* type (*) (void) */ fntype[3] = build_function_type_list (type, NULL_TREE); - /* type (*) (&int, type) */ - fntype[4] = build_function_type_list (type, + /* type (*) (type, &int) */ + fntype[4] = build_function_type_list (type, type, build_pointer_type (integer_type_node), - type, NULL_TREE); /* type (*) (int, type) */ fntype[5] = build_function_type_list (type, diff -Naur gcc-4.6.0.orig/gcc/fortran/gfortran.h gcc-4.6.0/gcc/fortran/gfortran.h --- gcc-4.6.0.orig/gcc/fortran/gfortran.h 2011-02-18 19:52:16.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/gfortran.h 2011-05-04 19:18:01.936955000 +0000 @@ -2190,6 +2190,7 @@ int warn_character_truncation; int warn_array_temp; int warn_align_commons; + int warn_real_q_constant; int warn_unused_dummy_argument; int max_errors; diff -Naur gcc-4.6.0.orig/gcc/fortran/gfortran.texi gcc-4.6.0/gcc/fortran/gfortran.texi --- gcc-4.6.0.orig/gcc/fortran/gfortran.texi 2011-02-07 19:19:51.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/gfortran.texi 2011-05-04 19:18:01.936955000 +0000 @@ -1237,6 +1237,7 @@ * Missing period in FORMAT specifications:: * I/O item lists:: * BOZ literal constants:: +* @code{Q} exponent-letter:: * Real array indices:: * Unary operators:: * Implicitly convert LOGICAL and INTEGER values:: @@ -1427,6 +1428,18 @@ of the @code{READ} statement, and the output item lists of the @code{WRITE} and @code{PRINT} statements, to start with a comma. +@node @code{Q} exponent-letter +@subsection @code{Q} exponent-letter +@cindex @code{Q} exponent-letter + +GNU Fortran accepts real literal constants with an exponent-letter +of @code{Q}, for example, @code{1.23Q45}. The constant is interpreted +as a @code{REAL(16)} entity on targets that suppports this type. If +the target does not support @code{REAL(16)} but has a @code{REAL(10)} +type, then the real-literal-constant will be interpreted as a +@code{REAL(10)} entity. In the absence of @code{REAL(16)} and +@code{REAL(10)}, an error will occur. + @node BOZ literal constants @subsection BOZ literal constants @cindex BOZ literal constants diff -Naur gcc-4.6.0.orig/gcc/fortran/interface.c gcc-4.6.0/gcc/fortran/interface.c --- gcc-4.6.0.orig/gcc/fortran/interface.c 2011-02-16 20:51:56.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/interface.c 2011-04-28 18:47:28.286450000 +0000 @@ -1128,6 +1128,12 @@ " or all FUNCTIONs", interface_name, &p->sym->declared_at); return 1; } + + if (p->sym->attr.proc == PROC_INTERNAL + && gfc_notify_std (GFC_STD_GNU, "Extension: Internal procedure '%s' " + "in %s at %L", p->sym->name, interface_name, + &p->sym->declared_at) == FAILURE) + return 1; } p = psave; diff -Naur gcc-4.6.0.orig/gcc/fortran/invoke.texi gcc-4.6.0/gcc/fortran/invoke.texi --- gcc-4.6.0.orig/gcc/fortran/invoke.texi 2011-03-03 04:14:29.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/invoke.texi 2011-05-04 19:18:01.936955000 +0000 @@ -692,7 +692,7 @@ This currently includes @option{-Waliasing}, @option{-Wampersand}, @option{-Wconversion}, @option{-Wsurprising}, @option{-Wintrinsics-std}, @option{-Wno-tabs}, @option{-Wintrinsic-shadow}, @option{-Wline-truncation}, -and @option{-Wunused}. +@option{-Wreal-q-constant} and @option{-Wunused}. @item -Waliasing @opindex @code{Waliasing} @@ -780,6 +780,12 @@ be used to never trigger this behavior and always link to the intrinsic regardless of the selected standard. +@item -Wreal-q-constant +@opindex @code{Wreal-q-constant} +@cindex warnings, @code{q} exponent-letter +Produce a warning if a real-literal-constant contains a @code{q} +exponent-letter. + @item -Wsurprising @opindex @code{Wsurprising} @cindex warnings, suspicious code diff -Naur gcc-4.6.0.orig/gcc/fortran/lang.opt gcc-4.6.0/gcc/fortran/lang.opt --- gcc-4.6.0.orig/gcc/fortran/lang.opt 2010-11-28 13:47:26.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/lang.opt 2011-05-04 19:18:01.936955000 +0000 @@ -238,6 +238,10 @@ Fortran Warning Warn on intrinsics not part of the selected standard +Wreal-q-constant +Fortran Warning +Warn about real-literal-constants with 'q' exponent-letter + Wreturn-type Fortran Warning ; Documented in C diff -Naur gcc-4.6.0.orig/gcc/fortran/module.c gcc-4.6.0/gcc/fortran/module.c --- gcc-4.6.0.orig/gcc/fortran/module.c 2011-03-11 14:13:49.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/module.c 2011-04-26 08:41:31.964983000 +0000 @@ -3011,6 +3011,7 @@ sym->attr.flavor = FL_PROCEDURE; sym->attr.generic = 1; e->symtree = gfc_find_symtree (gfc_current_ns->sym_root, fname); + gfc_commit_symbol (sym); } } diff -Naur gcc-4.6.0.orig/gcc/fortran/options.c gcc-4.6.0/gcc/fortran/options.c --- gcc-4.6.0.orig/gcc/fortran/options.c 2011-01-27 07:02:58.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/options.c 2011-05-04 19:18:01.936955000 +0000 @@ -107,6 +107,7 @@ gfc_option.warn_intrinsic_shadow = 0; gfc_option.warn_intrinsics_std = 0; gfc_option.warn_align_commons = 1; + gfc_option.warn_real_q_constant = 0; gfc_option.warn_unused_dummy_argument = 0; gfc_option.max_errors = 25; @@ -445,6 +446,7 @@ gfc_option.warn_intrinsic_shadow = setting; gfc_option.warn_intrinsics_std = setting; gfc_option.warn_character_truncation = setting; + gfc_option.warn_real_q_constant = setting; gfc_option.warn_unused_dummy_argument = setting; warn_unused = setting; @@ -643,6 +645,10 @@ gfc_option.warn_align_commons = value; break; + case OPT_Wreal_q_constant: + gfc_option.warn_real_q_constant = value; + break; + case OPT_Wunused_dummy_argument: gfc_option.warn_unused_dummy_argument = value; break; diff -Naur gcc-4.6.0.orig/gcc/fortran/parse.c gcc-4.6.0/gcc/fortran/parse.c --- gcc-4.6.0.orig/gcc/fortran/parse.c 2011-02-14 22:17:44.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/parse.c 2011-04-26 08:41:31.964983000 +0000 @@ -4191,6 +4191,10 @@ gfc_current_ns = gfc_global_ns_list; for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling) { + if (gfc_current_ns->proc_name + && gfc_current_ns->proc_name->attr.flavor == FL_MODULE) + continue; /* Already resolved. */ + if (gfc_current_ns->proc_name) gfc_current_locus = gfc_current_ns->proc_name->declared_at; gfc_resolve (gfc_current_ns); @@ -4231,8 +4235,28 @@ gfc_current_ns = gfc_global_ns_list; gfc_get_errors (NULL, &errors); + /* We first translate all modules to make sure that later parts + of the program can use the decl. Then we translate the nonmodules. */ + + for (; !errors && gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling) + { + if (!gfc_current_ns->proc_name + || gfc_current_ns->proc_name->attr.flavor != FL_MODULE) + continue; + + gfc_current_locus = gfc_current_ns->proc_name->declared_at; + gfc_derived_types = gfc_current_ns->derived_types; + gfc_generate_module_code (gfc_current_ns); + gfc_current_ns->translated = 1; + } + + gfc_current_ns = gfc_global_ns_list; for (; !errors && gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling) { + if (gfc_current_ns->proc_name + && gfc_current_ns->proc_name->attr.flavor == FL_MODULE) + continue; + gfc_current_locus = gfc_current_ns->proc_name->declared_at; gfc_derived_types = gfc_current_ns->derived_types; gfc_generate_code (gfc_current_ns); @@ -4243,7 +4267,16 @@ gfc_current_ns = gfc_global_ns_list; for (;gfc_current_ns;) { - gfc_namespace *ns = gfc_current_ns->sibling; + gfc_namespace *ns; + + if (gfc_current_ns->proc_name + && gfc_current_ns->proc_name->attr.flavor == FL_MODULE) + { + gfc_current_ns = gfc_current_ns->sibling; + continue; + } + + ns = gfc_current_ns->sibling; gfc_derived_types = gfc_current_ns->derived_types; gfc_done_2 (); gfc_current_ns = ns; @@ -4375,16 +4408,18 @@ if (s.state == COMP_MODULE) { gfc_dump_module (s.sym->name, errors_before == errors); - if (errors == 0) - gfc_generate_module_code (gfc_current_ns); - pop_state (); if (!gfc_option.flag_whole_file) - gfc_done_2 (); + { + if (errors == 0) + gfc_generate_module_code (gfc_current_ns); + pop_state (); + gfc_done_2 (); + } else { gfc_current_ns->derived_types = gfc_derived_types; gfc_derived_types = NULL; - gfc_current_ns = NULL; + goto prog_units; } } else @@ -4429,10 +4464,12 @@ = gfc_option.dump_fortran_original ? gfc_global_ns_list : NULL; for (; gfc_current_ns; gfc_current_ns = gfc_current_ns->sibling) - { - gfc_dump_parse_tree (gfc_current_ns, stdout); - fputs ("------------------------------------------\n\n", stdout); - } + if (!gfc_current_ns->proc_name + || gfc_current_ns->proc_name->attr.flavor != FL_MODULE) + { + gfc_dump_parse_tree (gfc_current_ns, stdout); + fputs ("------------------------------------------\n\n", stdout); + } /* Do the translation. */ translate_all_program_units (gfc_global_ns_list); diff -Naur gcc-4.6.0.orig/gcc/fortran/primary.c gcc-4.6.0/gcc/fortran/primary.c --- gcc-4.6.0.orig/gcc/fortran/primary.c 2011-02-18 22:34:34.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/primary.c 2011-05-04 19:18:01.936955000 +0000 @@ -541,6 +541,17 @@ goto done; exp_char = c; + + if (c == 'q') + { + if (gfc_notify_std (GFC_STD_GNU, "Extension: exponent-letter 'q' in " + "real-literal-constant at %C") == FAILURE) + return MATCH_ERROR; + else if (gfc_option.warn_real_q_constant) + gfc_warning("Extension: exponent-letter 'q' in real-literal-constant " + "at %C"); + } + /* Scan exponent. */ c = gfc_next_ascii_char (); count++; @@ -616,6 +627,30 @@ kind = gfc_default_double_kind; break; + case 'q': + if (kind != -2) + { + gfc_error ("Real number at %C has a 'q' exponent and an explicit " + "kind"); + goto cleanup; + } + + /* The maximum possible real kind type parameter is 16. First, try + that for the kind, then fallback to trying kind=10 (Intel 80 bit) + extended precision. If neither value works, just given up. */ + kind = 16; + if (gfc_validate_kind (BT_REAL, kind, true) < 0) + { + kind = 10; + if (gfc_validate_kind (BT_REAL, kind, true) < 0) + { + gfc_error ("Invalid exponent-letter 'q' in " + "real-literal-constant at %C"); + goto cleanup; + } + } + break; + default: if (kind == -2) kind = gfc_default_real_kind; diff -Naur gcc-4.6.0.orig/gcc/fortran/resolve.c gcc-4.6.0/gcc/fortran/resolve.c --- gcc-4.6.0.orig/gcc/fortran/resolve.c 2011-02-18 12:23:56.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/resolve.c 2011-04-29 21:26:07.931377000 +0000 @@ -315,7 +315,8 @@ shape until we know if it has the pointer or allocatable attributes. */ if (sym->as && sym->as->rank > 0 && sym->as->type == AS_DEFERRED - && !(sym->attr.pointer || sym->attr.allocatable)) + && !(sym->attr.pointer || sym->attr.allocatable) + && sym->attr.flavor != FL_PROCEDURE) { sym->as->type = AS_ASSUMED_SHAPE; for (i = 0; i < sym->as->rank; i++) @@ -2187,7 +2188,7 @@ /* F2003, 12.3.1.1 (3c); F2008, 12.4.2.2 (3c) */ if (sym->ts.type == BT_CHARACTER && sym->attr.if_source != IFSRC_IFBODY - && def_sym->ts.u.cl->length != NULL) + && def_sym->ts.type == BT_CHARACTER && def_sym->ts.u.cl->length != NULL) { gfc_charlen *cl = sym->ts.u.cl; @@ -5674,7 +5675,7 @@ /* Make sure that we have the right specific instance for the name. */ derived = get_declared_from_expr (NULL, NULL, e); - st = gfc_find_typebound_proc (derived, NULL, genname, false, &e->where); + st = gfc_find_typebound_proc (derived, NULL, genname, true, &e->where); if (st) e->value.compcall.tbp = st->n.tb; @@ -9858,6 +9859,11 @@ static gfc_try resolve_fl_var_and_proc (gfc_symbol *sym, int mp_flag) { + /* Avoid double diagnostics for function result symbols. */ + if ((sym->result || sym->attr.result) && !sym->attr.dummy + && (sym->ns != gfc_current_ns)) + return SUCCESS; + /* Constraints on deferred shape variable. */ if (sym->as == NULL || sym->as->type != AS_DEFERRED) { @@ -9885,7 +9891,7 @@ else { if (!mp_flag && !sym->attr.allocatable && !sym->attr.pointer - && !sym->attr.dummy && sym->ts.type != BT_CLASS && !sym->assoc) + && sym->ts.type != BT_CLASS && !sym->assoc) { gfc_error ("Array '%s' at %L cannot have a deferred shape", sym->name, &sym->declared_at); @@ -11946,11 +11952,6 @@ gfc_namespace *ns; gfc_component *c; - /* Avoid double resolution of function result symbols. */ - if ((sym->result || sym->attr.result) && !sym->attr.dummy - && (sym->ns != gfc_current_ns)) - return; - if (sym->attr.flavor == FL_UNKNOWN) { @@ -13505,6 +13506,10 @@ resolve_contained_functions (ns); + if (ns->proc_name && ns->proc_name->attr.flavor == FL_PROCEDURE + && ns->proc_name->attr.if_source == IFSRC_IFBODY) + resolve_formal_arglist (ns->proc_name); + gfc_traverse_ns (ns, resolve_bind_c_derived_types); for (cl = ns->cl_list; cl; cl = cl->next) diff -Naur gcc-4.6.0.orig/gcc/fortran/trans-array.c gcc-4.6.0/gcc/fortran/trans-array.c --- gcc-4.6.0.orig/gcc/fortran/trans-array.c 2011-02-23 22:38:27.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/trans-array.c 2011-04-13 18:38:17.941552000 +0000 @@ -6707,6 +6707,8 @@ tree stride; tree cond, cond1, cond3, cond4; tree tmp; + gfc_ref *ref; + if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc))) { tmp = gfc_rank_cst[dim]; @@ -6740,6 +6742,14 @@ else if (expr->expr_type == EXPR_VARIABLE) { tmp = TREE_TYPE (expr->symtree->n.sym->backend_decl); + for (ref = expr->ref; ref; ref = ref->next) + { + if (ref->type == REF_COMPONENT + && ref->u.c.component->as + && ref->next + && ref->next->u.ar.type == AR_FULL) + tmp = TREE_TYPE (ref->u.c.component->backend_decl); + } return GFC_TYPE_ARRAY_LBOUND(tmp, dim); } else if (expr->expr_type == EXPR_FUNCTION) diff -Naur gcc-4.6.0.orig/gcc/fortran/trans-expr.c gcc-4.6.0/gcc/fortran/trans-expr.c --- gcc-4.6.0.orig/gcc/fortran/trans-expr.c 2011-03-12 16:58:33.000000000 +0000 +++ gcc-4.6.0/gcc/fortran/trans-expr.c 2011-04-30 12:00:50.541680000 +0000 @@ -5444,9 +5444,12 @@ return true; /* If we have reached here with an intrinsic function, we do not - need a temporary. */ + need a temporary except in the particular case that reallocation + on assignment is active and the lhs is allocatable and a target. */ if (expr2->value.function.isym) - return false; + return (gfc_option.flag_realloc_lhs + && sym->attr.allocatable + && sym->attr.target); /* If the LHS is a dummy, we need a temporary if it is not INTENT(OUT). */ @@ -5528,23 +5531,38 @@ } +/* For Assignment to a reallocatable lhs from intrinsic functions, + replace the se.expr (ie. the result) with a temporary descriptor. + Null the data field so that the library allocates space for the + result. Free the data of the original descriptor after the function, + in case it appears in an argument expression and transfer the + result to the original descriptor. */ + static void -realloc_lhs_bounds_for_intrinsic_call (gfc_se *se, int rank) +fcncall_realloc_result (gfc_se *se, int rank) { tree desc; + tree res_desc; tree tmp; tree offset; int n; - /* Use the allocation done by the library. */ + /* Use the allocation done by the library. Substitute the lhs + descriptor with a copy, whose data field is nulled.*/ desc = build_fold_indirect_ref_loc (input_location, se->expr); - tmp = gfc_conv_descriptor_data_get (desc); - tmp = gfc_call_free (fold_convert (pvoid_type_node, tmp)); - gfc_add_expr_to_block (&se->pre, tmp); - gfc_conv_descriptor_data_set (&se->pre, desc, null_pointer_node); /* Unallocated, the descriptor does not have a dtype. */ tmp = gfc_conv_descriptor_dtype (desc); gfc_add_modify (&se->pre, tmp, gfc_get_dtype (TREE_TYPE (desc))); + res_desc = gfc_evaluate_now (desc, &se->pre); + gfc_conv_descriptor_data_set (&se->pre, res_desc, null_pointer_node); + se->expr = gfc_build_addr_expr (TREE_TYPE (se->expr), res_desc); + + /* Free the lhs after the function call and copy the result to + the lhs descriptor. */ + tmp = gfc_conv_descriptor_data_get (desc); + tmp = gfc_call_free (fold_convert (pvoid_type_node, tmp)); + gfc_add_expr_to_block (&se->post, tmp); + gfc_add_modify (&se->post, desc, res_desc); offset = gfc_index_zero_node; tmp = gfc_index_one_node; @@ -5580,7 +5598,6 @@ } - /* Try to translate array(:) = func (...), where func is a transformational array function, without using a temporary. Returns NULL if this isn't the case. */ @@ -5645,7 +5662,7 @@ ss->is_alloc_lhs = 1; } else - realloc_lhs_bounds_for_intrinsic_call (&se, expr1->rank); + fcncall_realloc_result (&se, expr1->rank); } gfc_conv_function_expr (&se, expr2); diff -Naur gcc-4.6.0.orig/gcc/gcov-io.c gcc-4.6.0/gcc/gcov-io.c --- gcc-4.6.0.orig/gcc/gcov-io.c 2009-11-25 10:55:54.000000000 +0000 +++ gcc-4.6.0/gcc/gcov-io.c 2011-04-06 16:05:18.144471000 +0000 @@ -16,8 +16,13 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see +Under Section 7 of GPL version 3, you are granted additional +permissions described in the GCC Runtime Library Exception, version +3.1, as published by the Free Software Foundation. + +You should have received a copy of the GNU General Public License and +a copy of the GCC Runtime Library Exception along with this program; +see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ /* Routines declared in gcov-io.h. This file should be #included by diff -Naur gcc-4.6.0.orig/gcc/gimple-fold.c gcc-4.6.0/gcc/gimple-fold.c --- gcc-4.6.0.orig/gcc/gimple-fold.c 2011-01-25 17:08:47.000000000 +0000 +++ gcc-4.6.0/gcc/gimple-fold.c 2011-04-18 21:58:03.570372000 +0000 @@ -1374,7 +1374,7 @@ is a thunk (other than a this adjustment which is dealt with by DELTA). */ tree -gimple_get_virt_mehtod_for_binfo (HOST_WIDE_INT token, tree known_binfo, +gimple_get_virt_method_for_binfo (HOST_WIDE_INT token, tree known_binfo, tree *delta, bool refuse_thunks) { HOST_WIDE_INT i; @@ -1393,6 +1393,10 @@ v = TREE_CHAIN (v); } + /* If BV_VCALL_INDEX is non-NULL, give up. */ + if (TREE_TYPE (v)) + return NULL_TREE; + fndecl = TREE_VALUE (v); node = cgraph_get_node_or_alias (fndecl); if (refuse_thunks diff -Naur gcc-4.6.0.orig/gcc/gimple.c gcc-4.6.0/gcc/gimple.c --- gcc-4.6.0.orig/gcc/gimple.c 2010-12-02 12:24:46.000000000 +0000 +++ gcc-4.6.0/gcc/gimple.c 2011-04-21 14:18:54.402847000 +0000 @@ -1405,7 +1405,8 @@ for (i = 0; i < gimple_call_num_args (stmt); i++) { if (wi) - wi->val_only = is_gimple_reg_type (gimple_call_arg (stmt, i)); + wi->val_only + = is_gimple_reg_type (TREE_TYPE (gimple_call_arg (stmt, i))); ret = walk_tree (gimple_call_arg_ptr (stmt, i), callback_op, wi, pset); if (ret) @@ -1417,7 +1418,8 @@ if (wi) { wi->is_lhs = true; - wi->val_only = is_gimple_reg_type (gimple_call_lhs (stmt)); + wi->val_only + = is_gimple_reg_type (TREE_TYPE (gimple_call_lhs (stmt))); } ret = walk_tree (gimple_call_lhs_ptr (stmt), callback_op, wi, pset); @@ -3742,6 +3744,9 @@ if (tree_int_cst_equal (c1, c2) != 1) goto different_types; + + if (mode == GTC_MERGE && TREE_PURPOSE (v1) != TREE_PURPOSE (v2)) + goto different_types; } /* If one enumeration has more values than the other, they diff -Naur gcc-4.6.0.orig/gcc/gimple.h gcc-4.6.0/gcc/gimple.h --- gcc-4.6.0.orig/gcc/gimple.h 2010-12-22 12:56:54.000000000 +0000 +++ gcc-4.6.0/gcc/gimple.h 2011-04-18 21:58:03.570372000 +0000 @@ -892,7 +892,7 @@ gimple gimple_alloc_stat (enum gimple_code, unsigned MEM_STAT_DECL); const char *gimple_decl_printable_name (tree, int); bool gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace); -tree gimple_get_virt_mehtod_for_binfo (HOST_WIDE_INT, tree, tree *, bool); +tree gimple_get_virt_method_for_binfo (HOST_WIDE_INT, tree, tree *, bool); void gimple_adjust_this_by_delta (gimple_stmt_iterator *, tree); /* Returns true iff T is a valid GIMPLE statement. */ extern bool is_gimple_stmt (tree); diff -Naur gcc-4.6.0.orig/gcc/gimplify.c gcc-4.6.0/gcc/gimplify.c --- gcc-4.6.0.orig/gcc/gimplify.c 2011-03-07 15:28:50.000000000 +0000 +++ gcc-4.6.0/gcc/gimplify.c 2011-04-22 14:11:44.240476000 +0000 @@ -1138,7 +1138,7 @@ struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp; /* Mark variable as local. */ - if (ctx && !is_global_var (t) + if (ctx && !DECL_EXTERNAL (t) && (! DECL_SEEN_IN_BIND_EXPR_P (t) || splay_tree_lookup (ctx->variables, (splay_tree_key) t) == NULL)) diff -Naur gcc-4.6.0.orig/gcc/ipa-cp.c gcc-4.6.0/gcc/ipa-cp.c --- gcc-4.6.0.orig/gcc/ipa-cp.c 2011-03-04 23:07:20.000000000 +0000 +++ gcc-4.6.0/gcc/ipa-cp.c 2011-04-18 21:58:03.570372000 +0000 @@ -1242,7 +1242,7 @@ { tree binfo = VEC_index (tree, info->params[param_index].types, j); tree d; - tree t = gimple_get_virt_mehtod_for_binfo (token, binfo, &d, true); + tree t = gimple_get_virt_method_for_binfo (token, binfo, &d, true); if (!t) { @@ -1516,6 +1516,8 @@ ipa_print_all_params (dump_file); ipa_print_all_jump_functions (dump_file); } + ipa_check_create_node_params (); + ipa_check_create_edge_args (); /* 2. Do the interprocedural propagation. */ ipcp_iterate_stage (); /* 3. Insert the constants found to the functions. */ @@ -1543,8 +1545,6 @@ if (dump_file) fprintf (dump_file, "\nIPA constant propagation start:\n"); - ipa_check_create_node_params (); - ipa_check_create_edge_args (); ipa_register_cgraph_hooks (); for (node = cgraph_nodes; node; node = node->next) diff -Naur gcc-4.6.0.orig/gcc/ipa-inline.c gcc-4.6.0/gcc/ipa-inline.c --- gcc-4.6.0.orig/gcc/ipa-inline.c 2011-03-11 10:04:30.000000000 +0000 +++ gcc-4.6.0/gcc/ipa-inline.c 2011-04-26 12:59:22.871525000 +0000 @@ -1337,6 +1337,9 @@ continue; } + if (!e->callee->local.inlinable) + continue; + /* We've hit cycle? It is time to give up. */ if (e->callee->aux) { @@ -2091,11 +2094,7 @@ cgraph_add_function_insertion_hook (&add_new_function, NULL); if (flag_indirect_inlining) - { - ipa_register_cgraph_hooks (); - ipa_check_create_node_params (); - ipa_check_create_edge_args (); - } + ipa_register_cgraph_hooks (); for (node = cgraph_nodes; node; node = node->next) if (node->analyzed) diff -Naur gcc-4.6.0.orig/gcc/ipa-prop.c gcc-4.6.0/gcc/ipa-prop.c --- gcc-4.6.0.orig/gcc/ipa-prop.c 2011-02-11 15:16:46.000000000 +0000 +++ gcc-4.6.0/gcc/ipa-prop.c 2011-04-18 21:58:03.570372000 +0000 @@ -1522,10 +1522,13 @@ void ipa_analyze_node (struct cgraph_node *node) { - struct ipa_node_params *info = IPA_NODE_REF (node); + struct ipa_node_params *info; struct param_analysis_info *parms_info; int i, param_count; + ipa_check_create_node_params (); + ipa_check_create_edge_args (); + info = IPA_NODE_REF (node); push_cfun (DECL_STRUCT_FUNCTION (node->decl)); current_function_decl = node->decl; ipa_initialize_node_params (node); @@ -1727,7 +1730,7 @@ type = ie->indirect_info->otr_type; binfo = get_binfo_at_offset (binfo, ie->indirect_info->anc_offset, type); if (binfo) - target = gimple_get_virt_mehtod_for_binfo (token, binfo, &delta, true); + target = gimple_get_virt_method_for_binfo (token, binfo, &delta, true); else return NULL; diff -Naur gcc-4.6.0.orig/gcc/lto/lto.c gcc-4.6.0/gcc/lto/lto.c --- gcc-4.6.0.orig/gcc/lto/lto.c 2011-02-10 08:57:24.000000000 +0000 +++ gcc-4.6.0/gcc/lto/lto.c 2011-03-31 10:00:44.444869000 +0000 @@ -1514,8 +1514,8 @@ fprintf (cgraph_dump_file, "varpool nodes:"); dump_varpool_node_set (cgraph_dump_file, vset); } - gcc_assert (cgraph_node_set_nonempty_p (set) - || varpool_node_set_nonempty_p (vset) || !i); + gcc_checking_assert (cgraph_node_set_nonempty_p (set) + || varpool_node_set_nonempty_p (vset) || !i); lto_set_current_out_file (file); diff -Naur gcc-4.6.0.orig/gcc/lto-cgraph.c gcc-4.6.0/gcc/lto-cgraph.c --- gcc-4.6.0.orig/gcc/lto-cgraph.c 2011-03-04 18:49:23.000000000 +0000 +++ gcc-4.6.0/gcc/lto-cgraph.c 2011-04-17 14:58:03.687290000 +0000 @@ -1501,7 +1501,8 @@ During LTRANS we already have values of count_materialization_scale computed, so just update them. */ for (node = cgraph_nodes; node; node = node->next) - if (node->local.lto_file_data->profile_info.runs) + if (node->local.lto_file_data + && node->local.lto_file_data->profile_info.runs) { int scale; @@ -1573,8 +1574,8 @@ VEC_free (cgraph_node_ptr, heap, nodes); VEC_free (varpool_node_ptr, heap, varpool); } + merge_profile_summaries (file_data_vec); - /* Clear out the aux field that was used to store enough state to tell which nodes should be overwritten. */ diff -Naur gcc-4.6.0.orig/gcc/lto-streamer-in.c gcc-4.6.0/gcc/lto-streamer-in.c --- gcc-4.6.0.orig/gcc/lto-streamer-in.c 2011-03-01 09:45:05.000000000 +0000 +++ gcc-4.6.0/gcc/lto-streamer-in.c 2011-05-03 10:21:44.740801000 +0000 @@ -1596,11 +1596,9 @@ if (TREE_CODE (expr) == FIELD_DECL) { - unsigned HOST_WIDE_INT off_align; DECL_PACKED (expr) = (unsigned) bp_unpack_value (bp, 1); DECL_NONADDRESSABLE_P (expr) = (unsigned) bp_unpack_value (bp, 1); - off_align = (unsigned HOST_WIDE_INT) bp_unpack_value (bp, 8); - SET_DECL_OFFSET_ALIGN (expr, off_align); + expr->decl_common.off_align = bp_unpack_value (bp, 8); } if (TREE_CODE (expr) == RESULT_DECL diff -Naur gcc-4.6.0.orig/gcc/lto-streamer-out.c gcc-4.6.0/gcc/lto-streamer-out.c --- gcc-4.6.0.orig/gcc/lto-streamer-out.c 2011-03-01 09:45:05.000000000 +0000 +++ gcc-4.6.0/gcc/lto-streamer-out.c 2011-05-03 10:21:44.740801000 +0000 @@ -414,7 +414,7 @@ { bp_pack_value (bp, DECL_PACKED (expr), 1); bp_pack_value (bp, DECL_NONADDRESSABLE_P (expr), 1); - bp_pack_value (bp, DECL_OFFSET_ALIGN (expr), 8); + bp_pack_value (bp, expr->decl_common.off_align, 8); } if (TREE_CODE (expr) == RESULT_DECL diff -Naur gcc-4.6.0.orig/gcc/omp-low.c gcc-4.6.0/gcc/omp-low.c --- gcc-4.6.0.orig/gcc/omp-low.c 2010-11-30 16:36:19.000000000 +0000 +++ gcc-4.6.0/gcc/omp-low.c 2011-04-13 15:52:17.795243000 +0000 @@ -5005,6 +5005,8 @@ return false; decl = built_in_decls[base + index + 1]; + if (decl == NULL_TREE) + return false; itype = TREE_TYPE (TREE_TYPE (decl)); if (direct_optab_handler (optab, TYPE_MODE (itype)) == CODE_FOR_nothing) @@ -5056,6 +5058,8 @@ edge e; cmpxchg = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N + index + 1]; + if (cmpxchg == NULL_TREE) + return false; type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr))); itype = TREE_TYPE (TREE_TYPE (cmpxchg)); diff -Naur gcc-4.6.0.orig/gcc/params.def gcc-4.6.0/gcc/params.def --- gcc-4.6.0.orig/gcc/params.def 2011-02-02 15:52:08.000000000 +0000 +++ gcc-4.6.0/gcc/params.def 2011-03-26 09:20:34.263941000 +0000 @@ -698,6 +698,12 @@ "The maximum number of instructions ready to be issued to be considered by the scheduler during the first scheduling pass", 100, 0, 0) +/* This is the maximum number of active local stores RTL DSE will consider. */ +DEFPARAM (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES, + "max-dse-active-local-stores", + "Maximum number of active local stores in RTL dead store elimination", + 5000, 0, 0) + /* Prefetching and cache-optimizations related parameters. Default values are usually set by machine description. */ diff -Naur gcc-4.6.0.orig/gcc/reload1.c gcc-4.6.0/gcc/reload1.c --- gcc-4.6.0.orig/gcc/reload1.c 2011-01-23 21:11:24.000000000 +0000 +++ gcc-4.6.0/gcc/reload1.c 2011-04-20 09:48:00.383759000 +0000 @@ -445,7 +445,7 @@ static void delete_output_reload (rtx, int, int, rtx); static void delete_address_reloads (rtx, rtx); static void delete_address_reloads_1 (rtx, rtx, rtx); -static rtx inc_for_reload (rtx, rtx, rtx, int); +static void inc_for_reload (rtx, rtx, rtx, int); #ifdef AUTO_INC_DEC static void add_auto_inc_notes (rtx, rtx); #endif @@ -7152,22 +7152,12 @@ old = XEXP (rl->in_reg, 0); - if (optimize && REG_P (oldequiv) - && REGNO (oldequiv) < FIRST_PSEUDO_REGISTER - && spill_reg_store[REGNO (oldequiv)] - && REG_P (old) - && (dead_or_set_p (insn, - spill_reg_stored_to[REGNO (oldequiv)]) - || rtx_equal_p (spill_reg_stored_to[REGNO (oldequiv)], - old))) - delete_output_reload (insn, j, REGNO (oldequiv), reloadreg); - /* Prevent normal processing of this reload. */ special = 1; - /* Output a special code sequence for this case. */ - new_spill_reg_store[REGNO (reloadreg)] - = inc_for_reload (reloadreg, oldequiv, rl->out, - rl->inc); + /* Output a special code sequence for this case, and forget about + spill reg information. */ + new_spill_reg_store[REGNO (reloadreg)] = NULL; + inc_for_reload (reloadreg, oldequiv, rl->out, rl->inc); } /* If we are reloading a pseudo-register that was set by the previous @@ -8981,11 +8971,9 @@ IN is either identical to VALUE, or some cheaper place to reload from. INC_AMOUNT is the number to increment or decrement by (always positive). - This cannot be deduced from VALUE. - - Return the instruction that stores into RELOADREG. */ + This cannot be deduced from VALUE. */ -static rtx +static void inc_for_reload (rtx reloadreg, rtx in, rtx value, int inc_amount) { /* REG or MEM to be copied and incremented. */ @@ -8997,7 +8985,6 @@ rtx inc; rtx add_insn; int code; - rtx store; rtx real_in = in == value ? incloc : in; /* No hard register is equivalent to this register after @@ -9045,9 +9032,8 @@ be used as an address. */ if (! post) - add_insn = emit_insn (gen_move_insn (reloadreg, incloc)); - - return add_insn; + emit_insn (gen_move_insn (reloadreg, incloc)); + return; } } delete_insns_since (last); @@ -9063,7 +9049,7 @@ if (in != reloadreg) emit_insn (gen_move_insn (reloadreg, real_in)); emit_insn (gen_add2_insn (reloadreg, inc)); - store = emit_insn (gen_move_insn (incloc, reloadreg)); + emit_insn (gen_move_insn (incloc, reloadreg)); } else { @@ -9077,14 +9063,12 @@ the original value. */ emit_insn (gen_add2_insn (reloadreg, inc)); - store = emit_insn (gen_move_insn (incloc, reloadreg)); + emit_insn (gen_move_insn (incloc, reloadreg)); if (CONST_INT_P (inc)) emit_insn (gen_add2_insn (reloadreg, GEN_INT (-INTVAL (inc)))); else emit_insn (gen_sub2_insn (reloadreg, inc)); } - - return store; } #ifdef AUTO_INC_DEC diff -Naur gcc-4.6.0.orig/gcc/sel-sched-ir.c gcc-4.6.0/gcc/sel-sched-ir.c --- gcc-4.6.0.orig/gcc/sel-sched-ir.c 2010-12-24 14:19:23.000000000 +0000 +++ gcc-4.6.0/gcc/sel-sched-ir.c 2011-04-07 12:07:24.807359000 +0000 @@ -1564,6 +1564,20 @@ *pvect = NULL; } +/* Merge vector FROM to PVECT. */ +static void +merge_history_vect (VEC (expr_history_def, heap) **pvect, + VEC (expr_history_def, heap) *from) +{ + expr_history_def *phist; + int i; + + /* We keep this vector sorted. */ + for (i = 0; VEC_iterate (expr_history_def, from, i, phist); i++) + insert_in_history_vect (pvect, phist->uid, phist->type, + phist->old_expr_vinsn, phist->new_expr_vinsn, + phist->spec_ds); +} /* Compare two vinsns as rhses if possible and as vinsns otherwise. */ bool @@ -1796,9 +1810,6 @@ void merge_expr_data (expr_t to, expr_t from, insn_t split_point) { - int i; - expr_history_def *phist; - /* For now, we just set the spec of resulting expr to be minimum of the specs of merged exprs. */ if (EXPR_SPEC (to) > EXPR_SPEC (from)) @@ -1822,20 +1833,12 @@ EXPR_ORIG_SCHED_CYCLE (to) = MIN (EXPR_ORIG_SCHED_CYCLE (to), EXPR_ORIG_SCHED_CYCLE (from)); - /* We keep this vector sorted. */ - for (i = 0; - VEC_iterate (expr_history_def, EXPR_HISTORY_OF_CHANGES (from), - i, phist); - i++) - insert_in_history_vect (&EXPR_HISTORY_OF_CHANGES (to), - phist->uid, phist->type, - phist->old_expr_vinsn, phist->new_expr_vinsn, - phist->spec_ds); - EXPR_WAS_SUBSTITUTED (to) |= EXPR_WAS_SUBSTITUTED (from); EXPR_WAS_RENAMED (to) |= EXPR_WAS_RENAMED (from); EXPR_CANT_MOVE (to) |= EXPR_CANT_MOVE (from); + merge_history_vect (&EXPR_HISTORY_OF_CHANGES (to), + EXPR_HISTORY_OF_CHANGES (from)); update_target_availability (to, from, split_point); update_speculative_bits (to, from, split_point); } @@ -2328,16 +2331,24 @@ } /* Leave in AVP only those expressions, which are present in AV, - and return it. */ + and return it, merging history expressions. */ void -av_set_intersect (av_set_t *avp, av_set_t av) +av_set_code_motion_filter (av_set_t *avp, av_set_t av) { av_set_iterator i; - expr_t expr; + expr_t expr, expr2; FOR_EACH_EXPR_1 (expr, i, avp) - if (av_set_lookup (av, EXPR_VINSN (expr)) == NULL) + if ((expr2 = av_set_lookup (av, EXPR_VINSN (expr))) == NULL) av_set_iter_remove (&i); + else + /* When updating av sets in bookkeeping blocks, we can add more insns + there which will be transformed but the upper av sets will not + reflect those transformations. We then fail to undo those + when searching for such insns. So merge the history saved + in the av set of the block we are processing. */ + merge_history_vect (&EXPR_HISTORY_OF_CHANGES (expr), + EXPR_HISTORY_OF_CHANGES (expr2)); } diff -Naur gcc-4.6.0.orig/gcc/sel-sched-ir.h gcc-4.6.0/gcc/sel-sched-ir.h --- gcc-4.6.0.orig/gcc/sel-sched-ir.h 2010-12-03 12:04:16.000000000 +0000 +++ gcc-4.6.0/gcc/sel-sched-ir.h 2011-04-07 12:07:24.807359000 +0000 @@ -1565,7 +1565,7 @@ extern expr_t av_set_element (av_set_t, int); extern void av_set_substract_cond_branches (av_set_t *); extern void av_set_split_usefulness (av_set_t, int, int); -extern void av_set_intersect (av_set_t *, av_set_t); +extern void av_set_code_motion_filter (av_set_t *, av_set_t); extern void sel_save_haifa_priorities (void); diff -Naur gcc-4.6.0.orig/gcc/sel-sched.c gcc-4.6.0/gcc/sel-sched.c --- gcc-4.6.0.orig/gcc/sel-sched.c 2011-01-26 05:59:53.000000000 +0000 +++ gcc-4.6.0/gcc/sel-sched.c 2011-04-07 12:07:24.807359000 +0000 @@ -6481,7 +6481,7 @@ /* Filter the orig_ops set. */ if (AV_SET_VALID_P (insn)) - av_set_intersect (&orig_ops, AV_SET (insn)); + av_set_code_motion_filter (&orig_ops, AV_SET (insn)); /* If no more original ops, return immediately. */ if (!orig_ops) diff -Naur gcc-4.6.0.orig/gcc/simplify-rtx.c gcc-4.6.0/gcc/simplify-rtx.c --- gcc-4.6.0.orig/gcc/simplify-rtx.c 2010-11-30 16:36:19.000000000 +0000 +++ gcc-4.6.0/gcc/simplify-rtx.c 2011-03-26 09:24:06.569126000 +0000 @@ -1526,7 +1526,8 @@ } else if (GET_CODE (op) == CONST_DOUBLE - && SCALAR_FLOAT_MODE_P (mode)) + && SCALAR_FLOAT_MODE_P (mode) + && SCALAR_FLOAT_MODE_P (GET_MODE (op))) { REAL_VALUE_TYPE d, t; REAL_VALUE_FROM_CONST_DOUBLE (d, op); @@ -1549,7 +1550,10 @@ d = real_value_truncate (mode, d); break; case FLOAT_EXTEND: - /* All this does is change the mode. */ + /* All this does is change the mode, unless changing + mode class. */ + if (GET_MODE_CLASS (mode) != GET_MODE_CLASS (GET_MODE (op))) + real_convert (&d, mode, &d); break; case FIX: real_arithmetic (&d, FIX_TRUNC_EXPR, &d, NULL); diff -Naur gcc-4.6.0.orig/gcc/stor-layout.c gcc-4.6.0/gcc/stor-layout.c --- gcc-4.6.0.orig/gcc/stor-layout.c 2011-03-10 22:37:22.000000000 +0000 +++ gcc-4.6.0/gcc/stor-layout.c 2011-04-05 14:34:51.863482000 +0000 @@ -367,7 +367,7 @@ VEC_safe_push (tree, gc, size_functions, fndecl); /* Replace the original expression with a call to the size function. */ - return build_call_expr_loc_vec (input_location, fndecl, args); + return build_call_expr_loc_vec (UNKNOWN_LOCATION, fndecl, args); } /* Take, queue and compile all the size functions. It is essential that diff -Naur gcc-4.6.0.orig/gcc/testsuite/c-c++-common/raw-string-11.c gcc-4.6.0/gcc/testsuite/c-c++-common/raw-string-11.c --- gcc-4.6.0.orig/gcc/testsuite/c-c++-common/raw-string-11.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/c-c++-common/raw-string-11.c 2011-04-23 23:33:39.473034000 +0000 @@ -0,0 +1,13 @@ +// PR preprocessor/48740 +// { dg-options "-std=gnu99 -trigraphs -save-temps" { target c } } +// { dg-options "-std=c++0x -save-temps" { target c++ } } +// { dg-do run } + +int main () +{ + return __builtin_memcmp (R"raw(foo%sbar%sfred%sbob?????)raw", + "foo%sbar%sfred%sbob?""?""?""?""?", + sizeof ("foo%sbar%sfred%sbob?""?""?""?""?")); +} + +// { dg-final { cleanup-saved-temps } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/c-c++-common/vla-1.c gcc-4.6.0/gcc/testsuite/c-c++-common/vla-1.c --- gcc-4.6.0.orig/gcc/testsuite/c-c++-common/vla-1.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/c-c++-common/vla-1.c 2011-05-06 21:58:30.234668000 +0000 @@ -0,0 +1,21 @@ +/* Test that changes to a variable are reflected in a VLA later in the + expression. */ +/* { dg-options "" } */ + +#ifdef __cplusplus +extern "C" +#endif +void abort(); + +int i = 4; +int f() +{ + return i; +} + +int main() +{ + if (i+=2, sizeof(*(int(*)[f()])0) != 6*sizeof(int)) + abort(); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/conversion/base1.C gcc-4.6.0/gcc/testsuite/g++.dg/conversion/base1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/conversion/base1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/conversion/base1.C 2011-05-05 02:51:01.604697000 +0000 @@ -0,0 +1,20 @@ +// PR c++/48749 + +struct Tuple3 +{ + float x; +}; + +struct Pos: virtual Tuple3 { }; + +struct TexCoords +{ + Pos pos; +}; + +template +void eval (const TexCoords &coords) +{ + const Pos &pos = coords.pos; + pos.x; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/auto22.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/auto22.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/auto22.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/auto22.C 2011-03-29 14:25:37.555771000 +0000 @@ -0,0 +1,21 @@ +// PR c++/47999 +// { dg-options -std=c++0x } + +int& identity(int& i) +{ + return i; +} + +// In a function template, auto type deduction works incorrectly. +template +void f() +{ + int i = 0; + auto&& x = identity(i); // Type of x should be `int&`, but it is `int&&`. +} + +int main (int argc, char* argv[]) +{ + f(); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-47570.C 2011-03-29 14:24:09.912103000 +0000 @@ -0,0 +1,25 @@ +// PR c++/47570 +// { dg-options -std=c++0x } + +unsigned int constexpr one() +{ return 1; } + +int constexpr one_B() +{ return 1; } + +int main() +{ + // FAIL TO COMPILE: + static bool constexpr SC_huh1 = ((unsigned int)one()) >= ((unsigned int)0); + static bool constexpr SC_huh2 = one() >= ((unsigned int)0); + static bool constexpr SC_huh3 = one() >= 0; + + // COMPILE OK: + static bool constexpr SC_huh4 = ((one() == 0) || (one() > 0)); + static bool constexpr SC_huh5 = one() == 0; + static bool constexpr SC_huh6 = one() > 0; + static bool constexpr SC_huh7 = one_B() >= 0; + static bool constexpr SC_huh8 = one() >= 1; + + return SC_huh3; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-48089.C 2011-05-06 21:58:22.201769000 +0000 @@ -0,0 +1,24 @@ +// PR c++/48089 +// { dg-options -std=c++0x } + +// bang is ill-formed (diagnostic required) because its initializer is +// non-constant, because it uses the value of an uninitialized object. + +// s() is ill-formed (no diagnostic required) because there is no set of +// arguments that would produce a constant expression. + +// R() is well-formed because i is initialized before j. + +struct s { + constexpr s() : v(v) { } // { dg-message "" } + int v; +}; + +constexpr s bang; // { dg-error "" } + +struct R { + int i,j; + constexpr R() : i(42),j(i) { } // { dg-bogus "" "" { xfail *-*-* } } +}; + +constexpr R r; // { dg-bogus "" "" { xfail *-*-* } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-attribute.C 2011-03-29 14:24:59.569455000 +0000 @@ -0,0 +1,63 @@ +// { dg-options -std=c++0x } + +//A few constexpr's +constexpr int foo() { return __alignof__(int); } + +template +constexpr int fooT() { return __alignof__(T); } + +template +constexpr int fooN() { return N; } + +//Now the attributes + +//with normal variables, +int a __attribute__((aligned(foo()))); +int b __attribute__((aligned(fooT()))); +int c __attribute__((aligned(fooN<__alignof__(int)>()))); + +//with variables inside a template, +template +void fun() +{ + T a __attribute__((aligned(foo()))); + T b __attribute__((aligned(fooT()))); + T c __attribute__((aligned(fooN<__alignof__(T)>()))); + T d __attribute__((aligned(fooT()))); + T e __attribute__((aligned(fooN<__alignof__(int)>()))); +} + +//instantiate it, +void bar() +{ + fun(); +} + +//with classes +struct __attribute__((aligned(foo()))) S0 +{ + char dummy; +}; +S0 s0; + +struct __attribute__((aligned(fooT()))) S1 +{ + char dummy; +}; +S1 s1; + +//and class templates +template +struct __attribute__((aligned(foo()))) S2 +{ + char dummy; +}; + +S2 s2; + +template +struct __attribute__((aligned(fooT()))) S3 +{ + char dummy; +}; +S3 s3; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-condition2.C 2011-05-06 21:58:44.977085000 +0000 @@ -0,0 +1,18 @@ +// PR c++/48909 +// { dg-options -std=c++0x } + +#define SA(X) static_assert((X),#X) + +constexpr int const * is_sorted_until(int const * first, int const * last) +{ + return first == last || first + 1 == last ? last + : (*(first + 1) < *first) != false ? first + 1 + : is_sorted_until(first + 1, last); +} + +int main() +{ + static constexpr int array[2] = {0, 1}; + constexpr int const * last = is_sorted_until(array, array + 2); + SA(last==array+2); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C 2011-02-23 15:24:04.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-data2.C 2011-03-29 14:24:19.897229000 +0000 @@ -44,5 +44,4 @@ // Use. A3 a31; -// FIXME should this be an error? A3 a32; // { dg-warning "overflow" } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C 2010-11-02 01:31:18.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C 2011-03-29 14:26:21.311895000 +0000 @@ -1,12 +1,11 @@ // Test that we explain why a template instantiation isn't constexpr // { dg-options -std=c++0x } -// { dg-prune-output "not a constexpr function" } template struct A { T t; - constexpr int f() { return 42; } + constexpr int f() { return 42; } // { dg-error "enclosing class" } }; struct B { B(); operator int(); }; @@ -14,8 +13,8 @@ constexpr A ai = { 42 }; constexpr int i = ai.f(); -constexpr int b = A().f(); // { dg-error "enclosing class" } +constexpr int b = A().f(); // { dg-error "not a constexpr function" } template -constexpr int f (T t) { return 42; } -constexpr int x = f(B()); // { dg-error "parameter" } +constexpr int f (T t) { return 42; } // { dg-error "parameter" } +constexpr int x = f(B()); // { dg-error "constexpr function" } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-memfn1.C 2011-03-29 14:26:33.022146000 +0000 @@ -0,0 +1,18 @@ +// PR c++/48296 +// { dg-options -std=c++0x } + +struct X +{ + constexpr X() { } + constexpr X f(X x) { return x; } + constexpr X g(X x); +}; + +constexpr X X::g(X x) { return x; } + +struct Y +{ + Y() { } + constexpr Y f(Y y); // { dg-error "constexpr" } + static constexpr Y g(Y y); // { dg-error "constexpr" } +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-missing.C 2011-05-06 21:58:37.761722000 +0000 @@ -0,0 +1,39 @@ +// PR c++/48911 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +#define SA(X) static_assert((X),#X) + +struct A +{ + constexpr A () : a (6) {} + int a; +}; + +int +main () +{ + constexpr int a[2] = { 42 }; + constexpr int i = a[1]; + SA(i==0); + constexpr int b[1] = { }; + constexpr int j = b[0]; + SA(j==0); + constexpr char c[2] = "a"; + constexpr char k = c[1]; + SA(k==0); + constexpr char d[2] = ""; + constexpr char l = d[1]; + SA(l==0); + constexpr wchar_t e[2] = L"a"; + constexpr wchar_t m = e[1]; + SA(m==0); + constexpr wchar_t f[2] = L""; + constexpr wchar_t n = f[1]; + SA(n==0); + constexpr A g[2] = { A () }; + constexpr A o = g[0]; + SA(o.a == 6); + constexpr A p = g[1]; + SA(p.a == 6); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept5.C 2011-03-29 14:24:30.843482000 +0000 @@ -0,0 +1,15 @@ +// { dg-options -std=c++0x } + +struct booleable { + bool data; + constexpr explicit operator bool() { return data; } +}; + +constexpr booleable truthy_func() { return {true}; } + +void funky() noexcept(truthy_func()) {} + +int main() { + funky(); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-overflow2.C 2011-03-29 14:24:19.897229000 +0000 @@ -0,0 +1,8 @@ +// PR c++/47504 +// { dg-options -std=c++0x } + +char constexpr sub(char arg) +{ return char(arg - char(1)); } + +int main() +{ static char constexpr m = sub(-1); } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-recursion.C 2011-03-29 14:24:42.977146000 +0000 @@ -0,0 +1,5 @@ +// Test that we catch excessive recursion. +// { dg-options "-std=c++0x -fconstexpr-depth=5" } +// { dg-prune-output "in constexpr expansion" } +constexpr int f (int i) { return f (i-1); } +constexpr int i = f(42); // { dg-error "constexpr evaluation depth" } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring1.C 2011-04-13 15:47:40.086398000 +0000 @@ -0,0 +1,34 @@ +// PR c++/48570 +// { dg-do run } +// { dg-options "-std=c++0x" } + +extern "C" void abort (); +constexpr wchar_t foo (int i) { return L"0123"[i]; } +constexpr char16_t bar (int i) { return u"0123"[i]; } +constexpr char32_t baz (int i) { return U"0123"[i]; } +const wchar_t foo0 = foo (0); +const wchar_t foo1 = foo (1); +const wchar_t foo2 = foo (2); +const wchar_t foo3 = foo (3); +const wchar_t foo4 = foo (4); +const char16_t bar0 = bar (0); +const char16_t bar1 = bar (1); +const char16_t bar2 = bar (2); +const char16_t bar3 = bar (3); +const char16_t bar4 = bar (4); +const char32_t baz0 = baz (0); +const char32_t baz1 = baz (1); +const char32_t baz2 = baz (2); +const char32_t baz3 = baz (3); +const char32_t baz4 = baz (4); + +int +main () +{ + if (foo0 != L'0' || foo1 != L'1' || foo2 != L'2' || foo3 != L'3' || foo4 != L'\0') + abort (); + if (bar0 != u'0' || bar1 != u'1' || bar2 != u'2' || bar3 != u'3' || bar4 != u'\0') + abort (); + if (baz0 != U'0' || baz1 != U'1' || baz2 != U'2' || baz3 != U'3' || baz4 != U'\0') + abort (); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/constexpr-wstring2.C 2011-04-13 15:47:40.086398000 +0000 @@ -0,0 +1,7 @@ +// PR c++/48570 +// { dg-do compile } +// { dg-options -std=c++0x } + +constexpr wchar_t c1 = L"hi"[3]; // { dg-error "out of bound" } +constexpr char16_t c2 = u"hi"[3]; // { dg-error "out of bound" } +constexpr char32_t c3 = U"hi"[3]; // { dg-error "out of bound" } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/defaulted24.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/defaulted24.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/defaulted24.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/defaulted24.C 2011-03-31 20:33:07.952847000 +0000 @@ -0,0 +1,6 @@ +// PR c++/48280 +// { dg-options -std=c++0x } + +struct S { + template < typename > S (const S &) = default; // { dg-error "" } +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/dependent1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/dependent1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/dependent1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/dependent1.C 2011-03-29 18:47:47.285863000 +0000 @@ -0,0 +1,25 @@ +// PR c++/48319 +// { dg-options -std=c++0x } +// We were failing to recognize declval<_Args1> as dependent. + +template Tp declval() noexcept; + +template +class __is_constructible_helper +{ + typedef char __one; + typedef struct { char __arr[2]; } __two; + + template + static decltype(_Tp1(declval<_Args1>()...), __one()) __test(int); + + template + static __two __test(...); + +public: + static const bool __value = sizeof(__test<_Tp>(0)) == 1; +}; + +int main() { + return __is_constructible_helper::__value; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/elision2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/elision2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/elision2.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/elision2.C 2011-03-29 14:25:10.162719000 +0000 @@ -0,0 +1,13 @@ +// Core 1148: should be able to move from value parameter on return +// { dg-options -std=c++0x } + +struct A +{ + A(const A&) = delete; + A(A&&); +}; + +A f (A a) +{ + return a; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/enum10.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/enum10.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/enum10.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/enum10.C 2011-04-12 00:20:32.250766000 +0000 @@ -0,0 +1,9 @@ +// PR c++/48534 +// { dg-options -std=c++0x } + +enum class OpSE : bool; + +int main() +{ + return static_cast(OpSE()); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/enum9.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/enum9.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/enum9.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/enum9.C 2011-04-08 15:01:50.477968000 +0000 @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +enum class E { }; +E f(); +bool b2 = static_cast(f()); diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist-array2.C 2011-03-29 14:26:10.694009000 +0000 @@ -0,0 +1,12 @@ +// { dg-options -std=c++0x } + +typedef int IA[2]; +typedef double DA[2]; + +void f(const IA&) { } +void f(const DA&); + +int main() +{ + f({1,2}); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist-arrray1.C 2011-03-29 14:26:00.889803000 +0000 @@ -0,0 +1,5 @@ +// { dg-options -std=c++0x } + +typedef int IRT[2]; + +const IRT& ir = IRT{1,2}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist46.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist46.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist46.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist46.C 2011-03-30 18:05:43.644460000 +0000 @@ -0,0 +1,14 @@ +// PR c++/48281 +// { dg-options "-std=c++0x -O2" } +// { dg-do run } + +#include + +typedef std::initializer_list int1; +typedef std::initializer_list int2; +static int2 ib = {{42,2,3,4,5},{2,3,4,5,1},{3,4,5,2,1}}; + +int main() +{ + return *(ib.begin()->begin()) != 42; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist47.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist47.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist47.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist47.C 2011-04-21 04:27:30.081275000 +0000 @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } + +struct A { ~A() = delete; }; // { dg-error "declared" } + +int main() +{ + typedef const A cA[2]; + cA{}; // { dg-error "deleted" } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist48.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist48.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/initlist48.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/initlist48.C 2011-04-26 23:42:50.605125000 +0000 @@ -0,0 +1,11 @@ +// PR c++/48726 +// { dg-options -std=c++0x } + +#include + +struct Foo{ + int i; +}; +typedef std::unique_ptr up; + +std::initializer_list il{up{new Foo}, up{new Foo}}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-this4.C 2011-04-12 00:20:18.545735000 +0000 @@ -0,0 +1,13 @@ +// PR c++/48523 +// { dg-options -std=c++0x } + +template +struct X +{ + bool b; + + void f() + { + [this]{ return b; }; + } +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/move1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/move1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/move1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/move1.C 2011-03-29 14:25:51.070918000 +0000 @@ -0,0 +1,15 @@ +// { dg-options "-std=c++0x -pedantic-errors" } + +#include + +class A { }; + +static void g ( A && ) { } + +template < class T > class B { +public: + void f ( ) { + A a; + g ( std :: move ( a ) ); + } +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/noexcept02.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/noexcept02.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/noexcept02.C 2010-06-04 21:21:23.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/noexcept02.C 2011-04-08 15:02:16.658686000 +0000 @@ -46,7 +46,9 @@ template void f (T1, T2) noexcept(noexcept(T1(), T2())); -SA(noexcept(f3(1,1))); +struct B { }; + +SA(noexcept(f3(1,B()))); SA(!noexcept(f3(1,A()))); SA(!noexcept(f3(A(),1))); SA(!noexcept(f3(A(),A()))); diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/pr48522.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/pr48522.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/pr48522.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/pr48522.C 2011-05-09 23:24:21.367834000 +0000 @@ -0,0 +1,24 @@ +// { dg-options "-std=c++0x" } + +template +struct Handle +{ + Handle(T& t); +}; + +template +struct Class { + struct Struct {} data; + void f(); + void g(); +}; + +template +void Class::f() { + Handle< decltype((data)) > handle(data); +} + +template +void Class::g() { + Handle< decltype((data)) > handle(data); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/call1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/call1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/call1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/call1.C 2011-04-08 15:02:28.454441000 +0000 @@ -0,0 +1,13 @@ +// PR c++/48500 +// { dg-options -std=c++0x } + +struct linked_ptr { +}; +template linked_ptr make_linked_ptr(T* ptr); +struct Concrete; +struct NewedClass { + NewedClass(const Concrete& req){} +}; +template void AddObjToChange(const ArgT& req) { + linked_ptr p = make_linked_ptr(new NewedClass(req)); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/error-recovery1.C 2011-03-30 20:29:43.717277000 +0000 @@ -0,0 +1,9 @@ +// PR c++/48212 +// { dg-options -std=c++0x } + +template < bool > void +foo () +{ + const bool b =; // { dg-error "" } + foo < b > (); // { dg-error "constant expression" } +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/isnan.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/isnan.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/isnan.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/isnan.C 2011-03-30 19:50:17.340645000 +0000 @@ -0,0 +1,9 @@ +// PR c++/48369 +// { dg-options -std=gnu++0x } + +extern "C" int isnan (double); + +void f(double d) +{ + bool b = isnan(d); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/template-const2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/template-const2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/template-const2.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/template-const2.C 2011-04-25 21:53:57.607248000 +0000 @@ -0,0 +1,14 @@ +// PR c++/48707 +// { dg-options -std=c++0x } + +struct A { + static int a(); +}; + +template +struct B: A { + static int const b; +}; + +template +int const B::b=B::a(); diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/regress/value-dep1.C 2011-03-30 02:16:37.202786000 +0000 @@ -0,0 +1,7 @@ +// PR c++/48265 +// { dg-options -std=c++0x } + +template < int > struct S +{ + S () { const int i = i; i; }; +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/rv-deduce2.C 2011-03-29 14:25:22.277919000 +0000 @@ -0,0 +1,18 @@ +// PR c++/48313 +// { dg-options -std=c++0x } + +template +void f(F&&) { } + +void g() { } + +template void h() { } + +int main() +{ + f( g ); // OK + void (&p)() = h; + f( p ); // OK + f( h ); // ??? +} + diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/sfinae10.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/sfinae10.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/sfinae10.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/sfinae10.C 2011-04-09 19:04:11.295490000 +0000 @@ -0,0 +1,16 @@ +// PR c++/48452 +// { dg-options -std=c++0x } +namespace std { + template T&& declval(); +} + +template +decltype(T(std::declval()...), char()) f(int); + +template +char (&f(...))[2]; + +struct B {}; + +static_assert(sizeof(f(0)) != 1, "Error"); // b +static_assert(sizeof(f(0)) != 1, "Error"); // c diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/sfinae11.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/sfinae11.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/sfinae11.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/sfinae11.C 2011-04-08 15:02:16.658686000 +0000 @@ -0,0 +1,56 @@ +// PR c++/48468 +// { dg-options -std=c++0x } +// { dg-prune-output "note" } + +template +T&& declval() noexcept; + +template< class T > +inline void f1( T& x ) noexcept( noexcept( declval().foo() ) ) +{ + x.foo(); +} + +template< class T, + bool Noexcept = noexcept( declval().foo() ) +> +inline void f2( T& x ) noexcept( Noexcept ) +{ + x.foo(); +} + +// a common and trivial mistake +template< class T > +inline void f3( T& x ) noexcept( declval().foo() ) +{ + x.foo(); +} + +struct X +{ + void foo(); +}; + +struct Y +{ + void foo() noexcept; +}; + +struct Z {}; + +int main() +{ + X x; Y y; Z z; + + static_assert( !noexcept( f1(x) ), "OK." ); + static_assert( !noexcept( f2(x) ), "OK." ); + // static_assert( !noexcept( f3(x) ), "shall be ill-formed(OK)." ); + + static_assert( noexcept( f1(y) ), "OK." ); + static_assert( noexcept( f2(y) ), "OK." ); + // static_assert( noexcept( f3(y) ), "shall be ill-formed(OK)." ); + + static_assert( noexcept( f1(z) ), "shall be ill-formed." ); // { dg-error "no match" } + static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match" } + static_assert( !noexcept( f3(z) ), "shall be ill-formed." ); // { dg-error "no match" } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/sfinae7.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/sfinae7.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/sfinae7.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/sfinae7.C 2011-04-08 15:02:00.188423000 +0000 @@ -0,0 +1,20 @@ +// { dg-options -std=c++0x } + +struct A +{ + void f(); + void f(int); + typedef int g; +}; + +template decltype (T::f) f(); +template void f(); + +template decltype (T::g) g(); +template void g(); + +int main() +{ + f(); + g(); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/union4.C gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/union4.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/cpp0x/union4.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/cpp0x/union4.C 2011-04-18 23:29:30.549099000 +0000 @@ -0,0 +1,17 @@ +// PR c++/48537 +// { dg-options -std=c++0x } + +struct SFoo +{ + SFoo() =delete; // { dg-error "declared" } +}; + +union UFoo // { dg-error "deleted" } +{ + SFoo foo; +}; + +int main() +{ + UFoo(); // { dg-error "deleted" } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/ext/complex7.C gcc-4.6.0/gcc/testsuite/g++.dg/ext/complex7.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/ext/complex7.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/ext/complex7.C 2011-04-20 06:31:51.769604000 +0000 @@ -0,0 +1,6 @@ +// { dg-options "" } + +class A +{ + static const _Complex double x = 1.0 + 2.0i; +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/ext/vla10.C gcc-4.6.0/gcc/testsuite/g++.dg/ext/vla10.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/ext/vla10.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/ext/vla10.C 2011-05-06 21:58:30.234668000 +0000 @@ -0,0 +1,32 @@ +// PR c++/48446 +// { dg-options "" } + +template +struct A +{ + ~A (); + T *operator-> () const; +}; + +struct B +{ + typedef A P; + static P foo (int); +}; + +struct C +{ + typedef A P; + static const int c = 80; +}; + +C::P bar (); + +void +baz () +{ + char z[bar ()->c]; + { + B::P m = B::foo (sizeof (z)); + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/gomp/pr48632.C gcc-4.6.0/gcc/testsuite/g++.dg/gomp/pr48632.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/gomp/pr48632.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/gomp/pr48632.C 2011-04-18 21:56:12.983838000 +0000 @@ -0,0 +1,22 @@ +// PR c++/48632 +// { dg-do compile } +// { dg-options "-fopenmp" } + +template +void +foo (T *x, T *y, unsigned z) +{ +#pragma omp parallel for + for (T *p = x; p < y; p += z) + ; +#pragma omp parallel for + for (T *p = y; p > x; p -= z) + ; +} + +int +main () +{ + char buf[10]; + foo (&buf[0], &buf[9], 1); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/gomp/pr48716.C gcc-4.6.0/gcc/testsuite/g++.dg/gomp/pr48716.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/gomp/pr48716.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/gomp/pr48716.C 2011-04-22 14:11:44.240476000 +0000 @@ -0,0 +1,24 @@ +// PR c/48716 +// { dg-do compile } +// { dg-options "-fopenmp" } + +int +main (void) +{ + #pragma omp parallel default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } + #pragma omp task default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/guality/guality.exp gcc-4.6.0/gcc/testsuite/g++.dg/guality/guality.exp --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/guality/guality.exp 2010-07-16 20:35:16.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/guality/guality.exp 2011-03-28 16:46:27.305053000 +0000 @@ -4,7 +4,8 @@ load_lib gcc-gdb-test.exp # Disable on darwin until radr://7264615 is resolved. -if { [istarget *-*-darwin*] } { +# Disable on Tru64 UNIX (PR testsuite/48251). +if { [istarget *-*-darwin*] || [istarget alpha*-dec-osf*] } { return } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/init/new30.C gcc-4.6.0/gcc/testsuite/g++.dg/init/new30.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/init/new30.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/init/new30.C 2011-05-05 21:02:06.894116000 +0000 @@ -0,0 +1,15 @@ +// PR c++/40975 + +struct data_type +{ + // constructor required to reproduce compiler bug + data_type() {} +}; + +struct ptr_type +{ + // array new as default argument required to reproduce compiler bug + ptr_type (data_type* ptr = new data_type[1]) { delete[] ptr; } +}; + +ptr_type obj; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/init/pr48859.C gcc-4.6.0/gcc/testsuite/g++.dg/init/pr48859.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/init/pr48859.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/init/pr48859.C 2011-05-11 06:03:38.016847000 +0000 @@ -0,0 +1,14 @@ +// PR c++/48859 +// { dg-do compile } + +struct HasConstructor { + HasConstructor() {} +}; + +class ConstMember { + const HasConstructor empty_; +}; + +void foo() { + new ConstMember; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/lookup/koenig13.C gcc-4.6.0/gcc/testsuite/g++.dg/lookup/koenig13.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/lookup/koenig13.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/lookup/koenig13.C 2011-04-27 05:20:06.025460000 +0000 @@ -0,0 +1,16 @@ +// PR c++/42687 +// DR 705 + +namespace N +{ + struct S { }; + void f(const S &) { } +} + +void f(const N::S &) { } + +int main() +{ + N::S v; + (f)(v); // no ambiguity: ADL is prevented with (), only ::f is considered +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/opt/pr48549.C gcc-4.6.0/gcc/testsuite/g++.dg/opt/pr48549.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/opt/pr48549.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/opt/pr48549.C 2011-04-12 13:44:33.209292000 +0000 @@ -0,0 +1,63 @@ +// PR rtl-optimization/48549 +// { dg-do compile } +// { dg-options "-fcompare-debug -O2" } + +void +foo (void *from, void *to) +{ + long offset = reinterpret_cast (to) - reinterpret_cast (from); + if (offset != static_cast (offset)) + *(int *) 0xC0DE = 0; + reinterpret_cast (from)[1] = offset; +} +struct A +{ + A () : a () {} + A (void *x) : a (x) {} + void *bar () { return a; } + void *a; +}; +struct C; +struct D; +struct E : public A +{ + C m1 (int); + D m2 (); + E () {} + E (A x) : A (x) {} +}; +struct C : public E +{ + C () {} + C (void *x) : E (x) {} +}; +struct D : public E +{ + D (void *x) : E (x) {} +}; +C +E::m1 (int x) +{ + return (reinterpret_cast (bar ()) + x); +} +D +E::m2 () +{ + return reinterpret_cast (bar ()); +} +struct B +{ + E a; + unsigned b : 16; + unsigned c : 1; +}; +void +baz (B *x) +{ + for (unsigned i = 0; i < 64; i++) + { + D d = x[i].a.m2 (); + C c = x[i].a.m1 (x[i].c); + foo (d.bar (), c.bar ()); + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/opt/pr48967.C gcc-4.6.0/gcc/testsuite/g++.dg/opt/pr48967.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/opt/pr48967.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/opt/pr48967.C 2011-05-12 11:59:32.631940000 +0000 @@ -0,0 +1,98 @@ +// PR debug/48967 +// { dg-do compile } +// { dg-options "-g -O2" } + +template struct A; +template struct A +{ + typedef T ref; +}; +template struct B +{ + typedef A t; + typedef typename t::ref ref; + ref operator * () { return ref (); } +}; +template struct I +{ + typedef T *cp; + template struct J + { + typedef I other; + }; +}; +template struct S : public I +{ +}; +template struct E +{ + typedef typename _A::template J ::other at; +}; +template > struct D +{ + typedef E _Base; + typedef typename _Base::at at; + typedef typename at::cp cp; + typedef B H; +}; +template struct F +{ + T *operator -> () { return __null; } +}; +template long +lfloor (T x) +{ + return static_cast (x) - (x && x != static_cast (x)); +} +template long +lround (T x) +{ + return lfloor (x - 0.5) + 1; +} +class M; +template class P; +typedef P Q; +template struct P +{ + float x (); +}; +struct CV +{ + Q c; +}; +struct C +{ + void foo (const CV &) const; + class O; + typedef D > R; + R n; +}; +struct S3 +{ + S3 (int, int); +}; +struct S2 +{ + S3 sx, sy; + S2 (int x = 0, int y = 0, int s = 0, int t = 0) : sx (x, y), sy (s, t) {} +}; +template struct N +{ + int bar (); +}; +struct C::O +{ + N o; + void foo (CV r, int) + { + Q c = r.c; + float t = 0.5 * (o.bar ()); + S2 (lround (c.x ()), t); + } +}; +void +C::foo (const CV &w) const +{ + R::H m; + (*m)->foo (w, 8); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/other/i386-9.C gcc-4.6.0/gcc/testsuite/g++.dg/other/i386-9.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/other/i386-9.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/other/i386-9.C 2011-03-31 11:14:41.603032000 +0000 @@ -0,0 +1,12 @@ +// PR target/48142 +// Testcase by Zdenek Sojka + +// { dg-do run { target i?86-*-* x86_64-*-* } } +// { dg-options "-Os -mpreferred-stack-boundary=5 -fstack-check -fno-omit-frame-pointer" } + +int main() +{ + try { throw 0; } + catch (...) {} + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/parse/ambig6.C gcc-4.6.0/gcc/testsuite/g++.dg/parse/ambig6.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/parse/ambig6.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/parse/ambig6.C 2011-04-27 15:57:06.718966000 +0000 @@ -0,0 +1,12 @@ +// PR c++/48046 + +namespace N1 { typedef int T; } // { dg-error "" } +namespace N2 { typedef float T; } // { dg-error "" } + +int main() +{ + using namespace N1; + using namespace N2; + + static T t; // { dg-error "" } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/parse/memfnquals1.C gcc-4.6.0/gcc/testsuite/g++.dg/parse/memfnquals1.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/parse/memfnquals1.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/parse/memfnquals1.C 2011-03-29 16:07:15.972474000 +0000 @@ -0,0 +1,6 @@ +// PR c++/48166 + +struct foo { + static void func (); +}; +void foo::func () const {} // { dg-error "type qualifiers" } diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/const4.C gcc-4.6.0/gcc/testsuite/g++.dg/template/const4.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/const4.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/template/const4.C 2011-04-20 19:39:26.124076000 +0000 @@ -0,0 +1,9 @@ +// PR c++/48657 + +template struct A { typedef int T; }; + +template void f() +{ + const unsigned D = 4; + A::T t; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/dependent-expr7.C gcc-4.6.0/gcc/testsuite/g++.dg/template/dependent-expr7.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/dependent-expr7.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/template/dependent-expr7.C 2011-04-13 15:19:40.268469000 +0000 @@ -0,0 +1,22 @@ +// Origin PR c++/48574 +// { dg-do compile } + +struct A +{ + virtual void foo(); +}; + +template +void +bar(T x) +{ + A &b = *x; + b.foo (); +} + +void +foo() +{ + A a; + bar(&a); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/dependent-expr8.C gcc-4.6.0/gcc/testsuite/g++.dg/template/dependent-expr8.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/dependent-expr8.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/template/dependent-expr8.C 2011-05-09 12:34:19.714405000 +0000 @@ -0,0 +1,25 @@ +// Origin PR c++/48574 +// { dg-options "-std=c++0x" } +// { dg-do compile } + +struct A +{ + virtual int foo(); +}; + +void baz (int); + +template +void +bar(T x) +{ + A &b = *x; + baz (b.foo ()); +} + +void +foo() +{ + A a; + bar(&a); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/inherit7.C gcc-4.6.0/gcc/testsuite/g++.dg/template/inherit7.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/inherit7.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/template/inherit7.C 2011-04-28 19:46:34.343462000 +0000 @@ -0,0 +1,21 @@ +// Origin: PR c++/48656 +// { dg-options "-std=c++0x" } +// { dg-do compile } + +struct A { + int f(); + int f(int); +}; + +template struct B : A +{ +}; + +template struct C : B +{ + void + g() + { + A::f(); + } +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/member9.C gcc-4.6.0/gcc/testsuite/g++.dg/template/member9.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/member9.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/template/member9.C 2011-05-06 08:34:10.904710000 +0000 @@ -0,0 +1,21 @@ +// Origin PR c++/48838 +// { dg-do compile } + +class DUChainItemSystem +{ +public: + + template + void registerTypeClass(); + + static DUChainItemSystem& self(); +}; + +template +struct DUChainItemRegistrator +{ + DUChainItemRegistrator() + { + DUChainItemSystem::self().registerTypeClass(); + } +}; diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/operator11.C gcc-4.6.0/gcc/testsuite/g++.dg/template/operator11.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/template/operator11.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/template/operator11.C 2011-04-13 20:51:23.855260000 +0000 @@ -0,0 +1,25 @@ +// PR c++/48594 +// Test for uses of (X->*Y)() that don't actually involve a +// pointer to member function. + +struct A { } a; +struct B { } b; +struct C * cp; + +struct Func { void operator()(); }; +Func operator->* (A, int); + +typedef void (*pfn)(); +pfn operator->* (B, int); + +pfn C::*cpfn; +Func C::*cfunc; + +template +void f() +{ + (a->*1)(); + (b->*1)(); + (cp->*cpfn)(); + (cp->*cfunc)(); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/torture/pr46364.C gcc-4.6.0/gcc/testsuite/g++.dg/torture/pr46364.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/torture/pr46364.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/torture/pr46364.C 2011-04-18 14:25:57.965089000 +0000 @@ -0,0 +1,20 @@ +// { dg-do compile } +#include + +void a() throw (int); +void b(std::string const &); + +void c(std::string *e) +{ + b(""); + + try { + a(); + } catch (...) { + *e = ""; + } +} + +void d() { + c(0); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/torture/pr48661.C gcc-4.6.0/gcc/testsuite/g++.dg/torture/pr48661.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/torture/pr48661.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/torture/pr48661.C 2011-04-18 21:58:03.570372000 +0000 @@ -0,0 +1,77 @@ +// PR middle-end/48661 +// { dg-do run } + +extern "C" void abort (); + +__attribute__((noinline)) +double +foo (double x, double y) +{ + asm volatile ("" : : : "memory"); + return x + y; +} + +__attribute__((noinline, noclone)) +void +bar (int x) +{ + if (x != 123) + abort (); +} + +struct A +{ + double a1, a2; +}; + +struct B +{ + virtual int m () const = 0 ; +}; + +struct C +{ + virtual ~C () {} +}; + +struct D : virtual public B, public C +{ + explicit D (const A &x) : d(123) { foo (x.a2, x.a1); } + int m () const { return d; } + int d; +}; + +struct E +{ + E () : d(0) {} + virtual void n (const B &x) { d = x.m (); x.m (); x.m (); } + int d; +}; + +void +test () +{ + A a; + a.a1 = 0; + a.a2 = 1; + E p; + D q (a); + const B &b = q; + bar (b.m ()); + p.n (b); + bar (p.d); +} + +void +baz () +{ + A a; + D p2 (a); +} + +int +main () +{ + test (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/g++.dg/torture/pr48695.C gcc-4.6.0/gcc/testsuite/g++.dg/torture/pr48695.C --- gcc-4.6.0.orig/gcc/testsuite/g++.dg/torture/pr48695.C 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/g++.dg/torture/pr48695.C 2011-04-21 14:40:53.747428000 +0000 @@ -0,0 +1,38 @@ +// { dg-do run } + +typedef __SIZE_TYPE__ size_t; + +inline void *operator new (size_t, void *__p) throw() { return __p; } + +struct _Vector_impl +{ + int *_M_start; + int *_M_finish; + _Vector_impl () :_M_start (0), _M_finish (0) {} +}; + +struct vector +{ + _Vector_impl _M_impl; + int *_M_allocate (size_t __n) + { + return __n != 0 ? new int[__n] : 0; + } + void push_back () + { + new (this->_M_impl._M_finish) int (); + this->_M_impl._M_finish = + this->_M_allocate (this->_M_impl._M_finish - this->_M_impl._M_start) + 1; + } +}; + +int +main () +{ + for (int i = 0; i <= 1; i++) + for (int j = 0; j <= 1; j++) + { + vector a[2]; + a[i].push_back (); + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48335-1.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,41 @@ +/* PR middle-end/48335 */ + +struct S { float d; }; + +void bar (struct S); + +void +f0 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[0] = x; + s.d *= 7.0; + bar (s); +} + +void +f1 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[1] = x; + s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[2] = x; + s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = {.d = 0.0f }; + ((char *) &s.d)[3] = x; + s.d *= 7.0; + bar (s); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48517.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48517.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48517.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48517.c 2011-04-12 06:53:13.421559000 +0000 @@ -0,0 +1,13 @@ +/* PR c/48517 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +void bar (const unsigned short *); + +void +foo (void) +{ + static const unsigned short array[] = (const unsigned short []) { 0x0D2B }; + const unsigned short *ptr = array; + bar (ptr); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48734.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48734.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48734.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48734.c 2011-04-26 13:44:51.810726000 +0000 @@ -0,0 +1,11 @@ +/* PR tree-optimization/48734 */ + +unsigned int +foo (int x, unsigned int y, unsigned int z) +{ + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + z &= (x == -__INT_MAX__ - 1 ? x : -x) > y; + return z; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48742.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48742.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/compile/pr48742.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/compile/pr48742.c 2011-04-27 07:05:54.304227000 +0000 @@ -0,0 +1,15 @@ +/* PR c/48742 */ + +void baz (int); + +int +foo (void) +{ + return 1 / 0 > 0; +} + +void +bar (void) +{ + baz (1 <= 2 % (3 >> 1 > 5 / 6 == 3)); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr42544.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr42544.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr42544.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr42544.c 2011-03-26 09:23:01.628648000 +0000 @@ -0,0 +1,14 @@ +/* PR c/42544 */ + +extern void abort (void); + +int +main () +{ + signed short s = -1; + if (sizeof (long long) == sizeof (unsigned int)) + return 0; + if ((unsigned int) s >= 0x100000000ULL) + abort (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr48197.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr48197.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr48197.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr48197.c 2011-03-26 09:23:01.628648000 +0000 @@ -0,0 +1,25 @@ +/* PR c/48197 */ + +extern void abort (void); +static int y = 0x8000; + +int +main () +{ + unsigned int x = (short)y; + if (sizeof (0LL) == sizeof (0U)) + return 0; + if (0LL > (0U ^ (short)-0x8000)) + abort (); + if (0LL > (0U ^ x)) + abort (); + if (0LL > (0U ^ (short)y)) + abort (); + if ((0U ^ (short)-0x8000) < 0LL) + abort (); + if ((0U ^ x) < 0LL) + abort (); + if ((0U ^ (short)y) < 0LL) + abort (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr48717.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr48717.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr48717.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr48717.c 2011-04-22 18:53:30.123145000 +0000 @@ -0,0 +1,26 @@ +/* PR tree-optimization/48717 */ + +extern void abort (void); + +int v = 1, w; + +unsigned short +foo (unsigned short x, unsigned short y) +{ + return x + y; +} + +void +bar (void) +{ + v = foo (~w, w); +} + +int +main () +{ + bar (); + if (v != (unsigned short) -1) + abort (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr48809.c gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr48809.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.c-torture/execute/pr48809.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.c-torture/execute/pr48809.c 2011-04-30 06:55:11.755353000 +0000 @@ -0,0 +1,60 @@ +/* PR tree-optimization/48809 */ + +extern void abort (void); + +int +foo (signed char x) +{ + int y = 0; + switch (x) + { + case 0: y = 1; break; + case 1: y = 7; break; + case 2: y = 2; break; + case 3: y = 19; break; + case 4: y = 5; break; + case 5: y = 17; break; + case 6: y = 31; break; + case 7: y = 8; break; + case 8: y = 28; break; + case 9: y = 16; break; + case 10: y = 31; break; + case 11: y = 12; break; + case 12: y = 15; break; + case 13: y = 111; break; + case 14: y = 17; break; + case 15: y = 10; break; + case 16: y = 31; break; + case 17: y = 7; break; + case 18: y = 2; break; + case 19: y = 19; break; + case 20: y = 5; break; + case 21: y = 107; break; + case 22: y = 31; break; + case 23: y = 8; break; + case 24: y = 28; break; + case 25: y = 106; break; + case 26: y = 31; break; + case 27: y = 102; break; + case 28: y = 105; break; + case 29: y = 111; break; + case 30: y = 17; break; + case 31: y = 10; break; + case 32: y = 31; break; + case 98: y = 18; break; + case -62: y = 19; break; + } + return y; +} + +int +main () +{ + if (foo (98) != 18 || foo (97) != 0 || foo (99) != 0) + abort (); + if (foo (-62) != 19 || foo (-63) != 0 || foo (-61) != 0) + abort (); + if (foo (28) != 105 || foo (27) != 102 || foo (29) != 111) + abort (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/20020312-2.c gcc-4.6.0/gcc/testsuite/gcc.dg/20020312-2.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/20020312-2.c 2010-01-20 14:17:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/20020312-2.c 2011-04-27 14:55:28.170311000 +0000 @@ -58,6 +58,8 @@ # else # define PIC_REG "30" # endif +#elif defined(__RX__) +/* No pic register. */ #elif defined(__s390__) # define PIC_REG "12" #elif defined(__sparc__) diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c gcc-4.6.0/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/Wstrict-overflow-23.c 2011-03-28 10:14:34.889170000 +0000 @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wstrict-overflow" } */ + +unsigned int +do_scrolling (unsigned int window_size, unsigned int writecost) +{ + unsigned int i = window_size; + + int terminal_window_p = 0; + unsigned int queue = 0; + + for (i = window_size; i; i--) + { + if (writecost < i) + ++queue; + else if (writecost & 1) + terminal_window_p = 1; + } + + if (queue > 0) + { + if (!terminal_window_p) + { + terminal_window_p = 1; + } + } + + if (terminal_window_p) + return 100; + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/builtin-object-size-10.c gcc-4.6.0/gcc/testsuite/gcc.dg/builtin-object-size-10.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/builtin-object-size-10.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/builtin-object-size-10.c 2011-03-28 10:14:34.889170000 +0000 @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-objsz-details" } */ + +typedef struct { + char sentinel[4]; + char data[0]; +} drone_packet; +typedef struct { + char type_str[16]; + char channel_hop; +} drone_source_packet; +drone_packet * +foo(char *x) +{ + drone_packet *dpkt = __builtin_malloc(sizeof(drone_packet) + + sizeof(drone_source_packet)); + drone_source_packet *spkt = (drone_source_packet *) dpkt->data; + __builtin___snprintf_chk (spkt->type_str, 16, + 1, __builtin_object_size (spkt->type_str, 1), + "%s", x); + return dpkt; +} + +/* { dg-final { scan-tree-dump "maximum object size 21" "objsz" } } */ +/* { dg-final { scan-tree-dump "maximum subobject size 16" "objsz" } } */ +/* { dg-final { cleanup-tree-dump "objsz" } } */ diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/dfp/pr48204.c gcc-4.6.0/gcc/testsuite/gcc.dg/dfp/pr48204.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/dfp/pr48204.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/dfp/pr48204.c 2011-03-26 09:24:06.569126000 +0000 @@ -0,0 +1,10 @@ +/* PR debug/48204 */ +/* { dg-do compile } */ +/* { dg-options "-O -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-fre -g" } */ + +void +foo (void) +{ + float cf = 3.0f; + _Decimal64 d64 = cf; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/gomp/pr48591.c gcc-4.6.0/gcc/testsuite/gcc.dg/gomp/pr48591.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/gomp/pr48591.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/gomp/pr48591.c 2011-04-13 15:52:17.795243000 +0000 @@ -0,0 +1,22 @@ +/* PR middle-end/48591 */ +/* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */ +/* { dg-options "-fopenmp" } */ + +extern void abort (void); + +int +main () +{ + __float128 f = 0.0; + int i; + #pragma omp parallel for reduction(+:f) + for (i = 0; i < 128; i++) + f += 0.5Q; + if (f != 64.0Q) + abort (); + #pragma omp atomic + f += 8.5Q; + if (f != 72.5Q) + abort (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/gomp/pr48716.c gcc-4.6.0/gcc/testsuite/gcc.dg/gomp/pr48716.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/gomp/pr48716.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/gomp/pr48716.c 2011-04-22 14:11:44.240476000 +0000 @@ -0,0 +1,24 @@ +/* PR c/48716 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +int +main (void) +{ + #pragma omp parallel default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } + #pragma omp task default(none) + { + static int s; + int t = 0; + #pragma omp atomic + s++; + t++; + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/guality/pr36977.c gcc-4.6.0/gcc/testsuite/gcc.dg/guality/pr36977.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/guality/pr36977.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/guality/pr36977.c 2011-04-06 20:40:24.221480000 +0000 @@ -0,0 +1,32 @@ +/* PR debug/36977 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +void +foo () +{ +} + +int +main () +{ + struct { char c[100]; } cbig; + struct { int i[800]; } ibig; + struct { long l[900]; } lbig; + struct { float f[200]; } fbig; + struct { double d[300]; } dbig; + struct { short s[400]; } sbig; + + ibig.i[0] = 55; /* { dg-final { gdb-test 30 "ibig.i\[0\]" "55" } } */ + ibig.i[100] = 5; /* { dg-final { gdb-test 30 "ibig.i\[100\]" "5" } } */ + cbig.c[0] = '\0'; /* { dg-final { gdb-test 30 "cbig.c\[0\]" "'\\0'" } } */ + cbig.c[99] = 'A'; /* { dg-final { gdb-test 30 "cbig.c\[99\]" "'A'" } } */ + fbig.f[100] = 11.0; /* { dg-final { gdb-test 30 "fbig.f\[100\]" "11" } } */ + dbig.d[202] = 9.0; /* { dg-final { gdb-test 30 "dbig.d\[202\]" "9" } } */ + sbig.s[90] = 255; /* { dg-final { gdb-test 30 "sbig.s\[90\]" "255" } } */ + lbig.l[333] = 999; /* { dg-final { gdb-test 30 "lbig.l\[333\]" "999" } } */ + + foo (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/guality/pr48466.c gcc-4.6.0/gcc/testsuite/gcc.dg/guality/pr48466.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/guality/pr48466.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/guality/pr48466.c 2011-04-06 20:40:24.221480000 +0000 @@ -0,0 +1,41 @@ +/* PR debug/48466 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ +/* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */ + +struct S { unsigned int a; unsigned int *b; }; +struct T { struct S a; struct S b; }; +struct U { const char *u; }; +int n[10]; +volatile int v; + +struct U +foo (const char *s) +{ + struct U r; + r.u = s; + return r; +} + +void +bar (struct T *s, int a, int b) +{ + s->a.a = a; + s->a.b = &s->a.a; + s->b.a = b; + s->b.b = &s->b.a; +} + +int +main () +{ + struct T t; + struct U x = foo ("this is x"); + struct S y, z; + y.b = n; /* { dg-final { gdb-test 38 "t.a.a" "17" } } */ + y.a = 0; /* { dg-final { gdb-test 38 "*t.a.b" "17" } } */ + bar (&t, 17, 21); /* { dg-final { gdb-test 38 "t.b.a" "21" } } */ + v++; /* { dg-final { gdb-test 38 "*t.b.b" "21" } } */ + z = y; + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/ipa/pr48195.c gcc-4.6.0/gcc/testsuite/gcc.dg/ipa/pr48195.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/ipa/pr48195.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/ipa/pr48195.c 2011-04-12 18:31:55.325180000 +0000 @@ -0,0 +1,24 @@ +/* { dg-do link } */ +/* { dg-options "-O2 -flto --param partial-inlining-entry-probability=101" } */ + +extern void abort(void); + +int i; + +void __attribute__ ((constructor)) +c2 () +{ + if (i) + abort (); +} + +void __attribute__ ((destructor)) +d1 () +{ + if (i) + abort (); +} + +void main () +{ +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48134.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48134.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48134.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48134.c 2011-03-28 10:14:34.889170000 +0000 @@ -0,0 +1,31 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fstack-check=specific -fno-tree-dse -fno-tree-fre -fno-tree-loop-optimize -g" } */ + +struct S +{ + int w, z; +}; +struct T +{ + struct S s; +}; + +int i; + +static inline struct S +bar (struct S x) +{ + i++; + return x; +} + +int +foo (struct T t, struct S s) +{ + struct S *c = &s; + if (i) + c = &t.s; + t.s.w = 3; + s = bar (*c); + return t.s.w; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48141.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48141.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48141.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48141.c 2011-03-26 09:19:36.537496000 +0000 @@ -0,0 +1,17 @@ +/* PR rtl-optimization/48141 */ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +#define A i = 0; +#define B A A A A A A A A A A +#define C B B B B B B B B B B +#define D C C C C C C C C C C +#define E D D D D D D D D D D + +int +foo (void) +{ + volatile int i = 0; + E E E E E E E E E E E + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48144.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48144.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48144.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48144.c 2011-04-07 12:07:24.807359000 +0000 @@ -0,0 +1,16 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O -frerun-cse-after-loop -fschedule-insns2 -fselective-scheduling2 -fno-tree-ch -funroll-loops --param=max-sched-extend-regions-iters=2 --param=max-sched-region-blocks=15" } */ +extern void *memcpy(void *dest, const void *src, __SIZE_TYPE__ n); + +void bar (void *, void *, void *); + +void foo + (void *p, char *data, unsigned data_len) +{ + int buffer[8]; + int buf2[8]; + unsigned i; + for (i = 0; i + 8 <= data_len; i += 8) + bar (p, buffer, data + i); + memcpy (buf2, data + i, data_len); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48156.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48156.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48156.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48156.c 2011-03-26 09:21:34.659334000 +0000 @@ -0,0 +1,45 @@ +/* PR rtl-optimization/48156 */ +/* { dg-do run } */ +/* { dg-options "-O -fcrossjumping --param min-crossjump-insns=1" } */ + +extern void abort (void); + +static int __attribute__ ((noinline, noclone)) +equals (int s1, int s2) +{ + return s1 == s2; +} + +static int __attribute__ ((noinline, noclone)) +bar (void) +{ + return 1; +} + +static void __attribute__ ((noinline, noclone)) +baz (int f, int j) +{ + if (f != 4 || j != 2) + abort (); +} + +void +foo (int x) +{ + int i = 0, j = bar (); + + if (x == 1) + i = 2; + + if (j && equals (i, j)) + baz (8, i); + else + baz (4, i); +} + +int +main () +{ + foo (1); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48159-1.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48159-1.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48159-1.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48159-1.c 2011-05-11 13:07:54.877914000 +0000 @@ -0,0 +1,10 @@ +/* PR debug/48159 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fcompare-debug" } */ + +void +foo (double x, int y, double *__restrict z, double *__restrict w) +{ + while (y--) + *z++ = (*w++ = 0) * x; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48159-2.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48159-2.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48159-2.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48159-2.c 2011-05-11 13:07:54.877914000 +0000 @@ -0,0 +1,22 @@ +/* PR debug/48159 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -ftree-loop-distribution -fcompare-debug" } */ + +int foo (int * __restrict__ ia, int * __restrict__ ib, + int * __restrict__ oxa, int * __restrict__ oxb) +{ + int i; + int oya[52], oyb[52]; + for (i = 0; i < 52; i++) + { + int w1 = ia[i]; + int w2 = oxa[i]; + int w3 = ib[i]; + int w4 = oxb[i]; + int w5 = w1 + w2 + 5; + oya[i] = (w1 * w2) >> 10; + int w6 = w3 + w4 + 6; + oyb[i] = (w3 * w4) >> 10; + } + return oya[22] + oyb[21]; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-1.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-1.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-1.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-1.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,48 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias)); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +void bar (struct S); + +void +f1 (T x) +{ + struct S s; + *(T *) &s.d = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0f }; + *(char *) &s.d = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0f }; + ((char *) &s.d)[2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f4 (int x, int y) +{ + struct S s = { .d = 0.0f }; + ((char *) &s.d)[y] = x; + __real__ s.d *= 7.0; + bar (s); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-2.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-2.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-2.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-2.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,58 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias, aligned (1))); +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +void bar (struct S); + +void +f1 (T x) +{ + struct S s; + *(T *) ((char *) &s.d + 1) = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[0] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[1] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f4 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f5 (int x) +{ + struct S s = { .d = 0.0f }; + ((U *)((char *) &s.d + 1))[3] = x; + __real__ s.d *= 7.0; + bar (s); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-3.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-3.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-3.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-3.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,48 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +void bar (struct S); + +void +f1 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[0] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[1] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f4 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[3] = x; + __real__ s.d *= 7.0; + bar (s); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-4.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-4.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-4.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-4.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,39 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +void bar (struct S); + +void +f1 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[-1] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[-2] = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f3 (int x) +{ + struct S s = { .d = 0.0 }; + ((U *)((char *) &s.d + 1))[5] = x; + __real__ s.d *= 7.0; + bar (s); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-5.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-5.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-5.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-5.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,38 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias)); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +int +f1 (struct S x) +{ + struct S s = x; + return *(T *) &s.d; +} + +int +f2 (struct S x) +{ + struct S s = x; + return *(char *) &s.d; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((char *) &s.d)[2]; +} + +int +f4 (struct S x, int y) +{ + struct S s = x; + return ((char *) &s.d)[y]; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-6.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-6.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-6.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-6.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,46 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef long long T __attribute__((may_alias, aligned (1))); +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + _Complex float d __attribute__((aligned (8))); +}; + +T +f1 (struct S x) +{ + struct S s = x; + return *(T *) ((char *) &s.d + 1); +} + +int +f2 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[0]; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[1]; +} + +int +f4 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[2]; +} + +int +f5 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[3]; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-7.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-7.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-7.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-7.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,38 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +int +f1 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[0]; +} + +int +f2 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[1]; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[2]; +} + +int +f4 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[3]; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-8.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-8.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48335-8.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48335-8.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,31 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra" } */ + +typedef short U __attribute__((may_alias, aligned (1))); + +struct S +{ + double d; +}; + +int +f1 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[-1]; +} + +int +f2 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[-2]; +} + +int +f3 (struct S x) +{ + struct S s = x; + return ((U *)((char *) &s.d + 1))[5]; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48616.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48616.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48616.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48616.c 2011-04-23 17:47:17.191898000 +0000 @@ -0,0 +1,135 @@ +/* PR tree-optimization/48616 */ +/* { dg-do run } */ +/* { dg-options "-O2 -ftree-vectorize" } */ +/* { dg-options "-O2 -ftree-vectorize -fno-common" { target hppa*-*-hpux* } } */ + +extern void abort (void); +int a[4] __attribute__((aligned (32))); +int b[4] __attribute__((aligned (32))); +int c[4] __attribute__((aligned (32))); +int d[4] __attribute__((aligned (32))); +int e[4] __attribute__((aligned (32))); + +__attribute__((noinline, noclone)) +int +foo (int x) +{ + asm ("" : "+r" (x)); + return x; +} + +__attribute__((noinline, noclone)) +void +fn1 (int i) +{ + a[0] = b[0] << c[0]; + a[1] = b[1] << c[1]; + a[2] = b[2] << c[2]; + a[3] = b[3] << c[3]; + if (i) + { + d[0] = e[0] >> c[0]; + d[1] = e[1] >> c[1]; + d[2] = e[2] >> c[2]; + d[3] = e[3] >> c[3]; + } +} + +__attribute__((noinline, noclone)) +void +fn2 (int i) +{ + a[0] = b[0] << 1; + a[1] = b[1] << 2; + a[2] = b[2] << 3; + a[3] = b[3] << 4; + if (i) + { + d[0] = e[0] >> 1; + d[1] = e[1] >> 2; + d[2] = e[2] >> 3; + d[3] = e[3] >> 4; + } +} + +__attribute__((noinline, noclone)) +void +fn3 (int i, int j) +{ + int x = foo (j); + a[0] = b[0] << x; + a[1] = b[1] << x; + a[2] = b[2] << x; + a[3] = b[3] << x; + if (i) + { + d[0] = e[0] >> x; + d[1] = e[1] >> x; + d[2] = e[2] >> x; + d[3] = e[3] >> x; + } +} + +__attribute__((noinline, noclone)) +void +fn4 (int i) +{ + a[0] = b[0] << 1; + a[1] = b[1] << 1; + a[2] = b[2] << 1; + a[3] = b[3] << 1; + if (i) + { + d[0] = e[0] >> 1; + d[1] = e[1] >> 1; + d[2] = e[2] >> 1; + d[3] = e[3] >> 1; + } +} + +int +main () +{ + int i; + int *t; + for (i = 0; i < 4; i++) + { + b[i] = 32; + c[i] = i + 1; + e[i] = 32; + } + asm volatile ("" : : "r" (b) : "memory"); + asm volatile ("" : : "r" (c) : "memory"); + asm volatile ("" : "=r" (t) : "0" (d) : "memory"); + fn1 (t != 0); + for (i = 0; i < 4; i++) + { + if (a[i] != (32 << (i + 1)) || d[i] != (32 >> (i + 1))) + abort (); + a[i] = 0; + d[i] = 0; + } + fn2 (t != 0); + for (i = 0; i < 4; i++) + { + if (a[i] != (32 << (i + 1)) || d[i] != (32 >> (i + 1))) + abort (); + a[i] = 0; + d[i] = 0; + } + fn3 (t != 0, t != 0); + for (i = 0; i < 4; i++) + { + if (a[i] != (32 << 1) || d[i] != (32 >> 1)) + abort (); + a[i] = 0; + d[i] = 0; + } + fn4 (t != 0); + for (i = 0; i < 4; i++) + { + if (a[i] != (32 << 1) || d[i] != (32 >> 1)) + abort (); + } + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48685.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48685.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48685.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48685.c 2011-04-23 10:18:54.464278000 +0000 @@ -0,0 +1,11 @@ +/* PR c/48685 */ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +int +main () +{ + int v = 1; + (void) (1 == 2 ? (void) 0 : (v = 0)); + return v; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48768.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48768.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48768.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48768.c 2011-04-26 13:47:13.981476000 +0000 @@ -0,0 +1,38 @@ +/* PR debug/48768 */ +/* { dg-do compile } */ +/* { dg-options "-O -fcompare-debug" } */ + +int a, b; + +int +bar (void) +{ + int i, j = 1; + for (i = 0; i != 10; i++) + { + lab: + if (i) + { + int *k = &j; + } + else if (j) + goto lab; + } + return 1; +} + +inline int +foo (int x) +{ + unsigned int c = x; + int d = x; + if (bar ()) + for (; c; c++) + while (x >= 0) + if (foo (d) >= 0) + { + d = bar (); + a = b ? b : 1; + } + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48774.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48774.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48774.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48774.c 2011-05-03 13:06:06.981402000 +0000 @@ -0,0 +1,38 @@ +/* PR target/48774 */ +/* { dg-do run } */ +/* { dg-options "-O2 -funroll-loops" } */ + +extern void abort (void); +unsigned long int s[24] + = { 12, ~1, 12, ~2, 12, ~4, 12, ~8, 12, ~16, 12, ~32, + 12, ~64, 12, ~128, 12, ~256, 12, ~512, 12, ~1024, 12, ~2048 }; +struct { int n; unsigned long *e[12]; } g + = { 12, { &s[0], &s[2], &s[4], &s[6], &s[8], &s[10], &s[12], &s[14], + &s[16], &s[18], &s[20], &s[22] } }; +int c[12]; + +__attribute__((noinline, noclone)) void +foo (void) +{ + int i, j; + for (i = 0; i < g.n; i++) + for (j = 0; j < g.n; j++) + { + if (i == j && j < g.e[0][0] && (g.e[i][1] & (1UL << j))) + abort (); + if (j < g.e[0][0] && (g.e[i][1] & (1UL << j))) + c[i]++; + } +} + +int +main () +{ + int i; + asm volatile ("" : "+m" (s), "+m" (g), "+m" (c)); + foo (); + for (i = 0; i < 12; i++) + if (c[i] != 11) + abort (); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48837.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48837.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48837.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48837.c 2011-05-10 08:45:00.526163000 +0000 @@ -0,0 +1,30 @@ +/* PR tree-optimization/48837 */ +/* { dg-do run } */ +/* { dg-options "-O2" } */ + +void abort (void); + +__attribute__((noinline)) +int baz(void) +{ + return 1; +} + +inline const int *bar(const int *a, const int *b) +{ + return *a ? a : b; +} + +int foo(int a, int b) +{ + return a || b ? baz() : foo(*bar(&a, &b), 1) + foo(1, 0); +} + +int main(void) +{ + if (foo(0, 0) != 2) + abort(); + + return 0; +} + diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48975.c gcc-4.6.0/gcc/testsuite/gcc.dg/pr48975.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/pr48975.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/pr48975.c 2011-05-12 17:46:15.934858000 +0000 @@ -0,0 +1,18 @@ +/* PR tree-optimization/48975 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -ffast-math -fno-tree-slp-vectorize" } */ + +static int +foo (int x) +{ + return (x > 0) ? 0 : x + 1; +} + +void +bar (unsigned int x) +{ + int l = 1; +lab: + while (x) + x = foo (x); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/pr48343.c gcc-4.6.0/gcc/testsuite/gcc.dg/torture/pr48343.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/pr48343.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/torture/pr48343.c 2011-04-07 18:05:08.563352000 +0000 @@ -0,0 +1,19 @@ +/* PR debug/48343 */ +/* { dg-do compile } */ +/* { dg-options "-fcompare-debug" } */ + +void foo (unsigned char *, unsigned char *); + +void +test (unsigned int x, int y) +{ + unsigned int i, j = 0, k; + unsigned char s[256], t[64]; + foo (s, t); + t[0] = y; + for (i = 0; i < 256; i++) + { + j = (j + s[i] + t[i % x]) & 0xff; + k = i; i = j; j = k; + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/pr48731.c gcc-4.6.0/gcc/testsuite/gcc.dg/torture/pr48731.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/pr48731.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/torture/pr48731.c 2011-04-26 12:59:22.871525000 +0000 @@ -0,0 +1,24 @@ +/* { dg-do compile } */ + +#include + +int blah(int a, ...) +{ + va_list va; + va_start(va,a); + if (a == 0) + return -1; + else + { + int i; + for (i = 0; i < a; i++) + va_arg(va,int); + return va_arg(va,int); + } +} + +__attribute((flatten)) +int blah2(int b, int c) +{ + return blah(2, b, c); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/pr48822.c gcc-4.6.0/gcc/testsuite/gcc.dg/torture/pr48822.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/pr48822.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/torture/pr48822.c 2011-05-12 14:08:00.418016000 +0000 @@ -0,0 +1,20 @@ +/* { dg-do compile } */ + +void foo (int *, int *); +int bar () +{ + int a = 0; + int b = 0; + if (b != 0) + { + int ax = a; + int bx = b; + while (bx != 0) + { + int tem = ax % bx; + ax = bx; + bx = tem; + } + } + foo (&a, &b); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c gcc-4.6.0/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c 2008-07-30 19:24:02.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/torture/stackalign/non-local-goto-5.c 2011-04-07 21:33:47.585429000 +0000 @@ -1,8 +1,8 @@ /* { dg-do run } */ +extern void exit (int); #if !defined (NO_LABEL_VALUES) && !defined (NO_TRAMPOLINES) extern void abort (void); -extern void exit (int); int s(i){if(i>0){__label__ l1;int f(int i){if(i==2)goto l1;return 0;}return f(i);l1:;}return 1;} int x(){return s(0)==1&&s(1)==0&&s(2)==1;} int main(){if(x()!=1)abort();exit(0);} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/va-arg-25.c gcc-4.6.0/gcc/testsuite/gcc.dg/torture/va-arg-25.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/va-arg-25.c 2010-11-08 17:44:40.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/torture/va-arg-25.c 2011-04-28 22:39:59.485927000 +0000 @@ -3,6 +3,8 @@ /* { dg-do run } */ /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-mabi=altivec -maltivec" { target { powerpc-*-* powerpc64-*-* } } } */ +/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */ #include #include diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/vector-1.c gcc-4.6.0/gcc/testsuite/gcc.dg/torture/vector-1.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/vector-1.c 2010-11-08 17:44:40.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/torture/vector-1.c 2011-04-28 22:39:59.485927000 +0000 @@ -3,6 +3,8 @@ /* { dg-do run } */ /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-mabi=altivec" { target { powerpc-*-* powerpc64-*-* } } } */ +/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */ #define vector __attribute__((vector_size(16) )) diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/vector-2.c gcc-4.6.0/gcc/testsuite/gcc.dg/torture/vector-2.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/torture/vector-2.c 2010-11-08 17:44:40.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/torture/vector-2.c 2011-04-28 22:39:59.485927000 +0000 @@ -3,6 +3,8 @@ /* { dg-do run } */ /* { dg-options "-msse" { target { i?86-*-* x86_64-*-* } } } */ /* { dg-require-effective-target sse_runtime { target { i?86-*-* x86_64-*-* } } } */ +/* { dg-options "-mabi=altivec" { target { powerpc-*-* powerpc64-*-* } } } */ +/* { dg-require-effective-target vmx_hw { target { powerpc-*-* powerpc64--*-* } } } */ #define vector __attribute__((vector_size(16) )) diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-17.c gcc-4.6.0/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-17.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-17.c 2008-03-20 22:06:40.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-17.c 2011-04-08 23:56:45.615141000 +0000 @@ -18,7 +18,7 @@ return ((struct Foo *)p)->i; } -const struct Foo g; +extern const struct Foo g; int foobar(void) { diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.dg/vect/pr48377.c gcc-4.6.0/gcc/testsuite/gcc.dg/vect/pr48377.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.dg/vect/pr48377.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.dg/vect/pr48377.c 2011-04-08 11:45:29.006078000 +0000 @@ -0,0 +1,25 @@ +/* PR tree-optimization/48377 */ +/* { dg-do run } */ + +typedef unsigned int U __attribute__((__aligned__ (1), __may_alias__)); + +__attribute__((noinline, noclone)) unsigned int +foo (const char *s, int len) +{ + const U *p = (const U *) s; + unsigned int f = len / sizeof (unsigned int), hash = len, i; + + for (i = 0; i < f; ++i) + hash += *p++; + return hash; +} + +char buf[64] __attribute__((aligned (32))); + +int +main (void) +{ + return foo (buf + 1, 26) != 26; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/arm/neon-vld-1.c gcc-4.6.0/gcc/testsuite/gcc.target/arm/neon-vld-1.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/arm/neon-vld-1.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/arm/neon-vld-1.c 2011-03-28 10:22:57.435118000 +0000 @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target arm_neon_ok } */ +/* { dg-options "-O1" } */ +/* { dg-add-options arm_neon } */ + +#include + +uint8x16_t +foo (uint8_t *a, uint8x16_t b) +{ + vst1q_lane_u8 (a, b, 14); + return vld1q_lane_u8 (a + 0x100, b, 15); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/arm/neon-vset_lanes8.c gcc-4.6.0/gcc/testsuite/gcc.target/arm/neon-vset_lanes8.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/arm/neon-vset_lanes8.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/arm/neon-vset_lanes8.c 2011-05-05 15:56:06.050425000 +0000 @@ -0,0 +1,21 @@ +/* Test the `vset_lane_s8' ARM Neon intrinsic. */ + +/* { dg-do run } */ +/* { dg-require-effective-target arm_neon_hw } */ +/* { dg-options "-O0" } */ +/* { dg-add-options arm_neon } */ + +#include "arm_neon.h" +#include +#include + +int8x8_t x = { 1, 2, 3, 4, 5, 6, 7, 8 }; +int8x8_t y = { 1, 2, 3, 16, 5, 6, 7, 8 }; + +int main (void) +{ + x = vset_lane_s8 (16, x, 3); + if (memcmp (&x, &y, sizeof (x)) != 0) + abort(); + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/arm/pr48252.c gcc-4.6.0/gcc/testsuite/gcc.target/arm/pr48252.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/arm/pr48252.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/arm/pr48252.c 2011-05-05 08:39:40.220991000 +0000 @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-require-effective-target arm_neon_hw } */ +/* { dg-options "-O2" } */ +/* { dg-add-options arm_neon } */ + +#include "arm_neon.h" +#include + +int main(void) +{ + uint8x8_t v1 = {1, 1, 1, 1, 1, 1, 1, 1}; + uint8x8_t v2 = {2, 2, 2, 2, 2, 2, 2, 2}; + uint8x8x2_t vd1, vd2; + union {uint8x8_t v; uint8_t buf[8];} d1, d2, d3, d4; + int i; + + vd1 = vzip_u8(v1, vdup_n_u8(0)); + vd2 = vzip_u8(v2, vdup_n_u8(0)); + + vst1_u8(d1.buf, vd1.val[0]); + vst1_u8(d2.buf, vd1.val[1]); + vst1_u8(d3.buf, vd2.val[0]); + vst1_u8(d4.buf, vd2.val[1]); + + for (i = 0; i < 8; i++) + if ((i % 2 == 0 && d4.buf[i] != 2) + || (i % 2 == 1 && d4.buf[i] != 0)) + abort (); + + return 0; +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/avx-vinsertps-3.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/avx-vinsertps-3.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/avx-vinsertps-3.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/avx-vinsertps-3.c 2011-04-15 10:21:00.737989000 +0000 @@ -0,0 +1,8 @@ +/* { dg-do run { target ilp32 } } */ +/* { dg-require-effective-target avx } */ +/* { dg-options "-O2 -mfpmath=sse -mavx -mtune=geode" } */ + +#define CHECK_H "avx-check.h" +#define TEST avx_test + +#include "sse4_1-insertps-3.c" diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/avx-vinsertps-4.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/avx-vinsertps-4.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/avx-vinsertps-4.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/avx-vinsertps-4.c 2011-04-15 10:21:00.737989000 +0000 @@ -0,0 +1,8 @@ +/* { dg-do run } */ +/* { dg-require-effective-target avx } */ +/* { dg-options "-O2 -mfpmath=sse -mavx" } */ + +#define CHECK_H "avx-check.h" +#define TEST avx_test + +#include "sse4_1-insertps-4.c" diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr46084.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr46084.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr46084.c 2010-11-05 23:45:32.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr46084.c 2011-04-15 10:29:58.754073000 +0000 @@ -1,7 +1,7 @@ /* This test needs to use setrlimit to set the stack size, so it can only run on Unix. */ /* { dg-do run { target *-*-linux* *-*-solaris* *-*-darwin* } } */ -/* { dg-require-effective-target avx } */ +/* { dg-require-effective-target avx_runtime } */ /* { dg-require-effective-target split_stack } */ /* { dg-options "-fsplit-stack -O2 -mavx" } */ diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48237.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48237.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48237.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48237.c 2011-03-26 18:41:02.446263000 +0000 @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fcaller-saves -fschedule-insns2 -fselective-scheduling2 -mtune=core2" } */ + +union double_union +{ + double d; + int i[2]; +}; + +void bar (int, ...); + +void +foo (double d) +{ + union double_union du = { d }; + while (1) + { + du.i[1] -= 0x100000L; + bar (0, du.d); + du.d += d; + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48335-1.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48335-1.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48335-1.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48335-1.c 2011-04-06 20:39:20.887184000 +0000 @@ -0,0 +1,32 @@ +/* PR middle-end/48335 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-tree-sra -msse2" } */ + +#include + +typedef __float128 T __attribute__((may_alias)); + +struct S +{ + _Complex double d __attribute__((aligned (16))); +}; + +void bar (struct S); + +void +f1 (T x) +{ + struct S s; + *(T *) &s.d = x; + __real__ s.d *= 7.0; + bar (s); +} + +void +f2 (__m128d x) +{ + struct S s; + _mm_store_pd ((double *) &s.d, x); + __real__ s.d *= 7.0; + bar (s); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48678.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48678.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48678.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48678.c 2011-04-19 16:49:19.533794000 +0000 @@ -0,0 +1,16 @@ +/* PR target/48678 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +#include + +typedef short T __attribute__((may_alias)); +struct S { __m128i d; }; + +__m128i +foo (short *x, struct S *y, __m128i *z) +{ + struct S s = *y; + ((T *) &s.d)[0] = *x; + return _mm_cmpeq_epi16 (s.d, *z); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48708.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48708.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48708.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48708.c 2011-04-21 20:23:55.759646000 +0000 @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2" } */ + +#include + +typedef long long T __attribute__((may_alias)); +struct S { __m128i d; }; + +__m128i +foo (long long *x, struct S *y, __m128i *z) +{ + struct S s = *y; + ((T *) &s.d)[0] = *x; + return _mm_cmpeq_epi16 (s.d, *z); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48723.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48723.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/pr48723.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/pr48723.c 2011-04-22 18:43:57.557110000 +0000 @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-fstack-check -mavx" } */ + +struct S0 +{ + int f0, f1, f2, f3; +} g_106; + +struct S0 +func_99 () +{ + return (g_106); +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/sse4_1-insertps-3.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/sse4_1-insertps-3.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/sse4_1-insertps-3.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/sse4_1-insertps-3.c 2011-04-15 10:21:00.737989000 +0000 @@ -0,0 +1,5 @@ +/* { dg-do run { target ilp32 } } */ +/* { dg-require-effective-target sse4 } */ +/* { dg-options "-O2 -msse4.1 -mtune=geode" } */ + +#include "sse4_1-insertps-2.c" diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/sse4_1-insertps-4.c gcc-4.6.0/gcc/testsuite/gcc.target/i386/sse4_1-insertps-4.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/i386/sse4_1-insertps-4.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/i386/sse4_1-insertps-4.c 2011-04-15 10:21:00.737989000 +0000 @@ -0,0 +1,92 @@ +/* { dg-do run } */ +/* { dg-require-effective-target sse4 } */ +/* { dg-options "-O2 -msse4.1" } */ + +#ifndef CHECK_H +#define CHECK_H "sse4_1-check.h" +#endif + +#ifndef TEST +#define TEST sse4_1_test +#endif + +#include CHECK_H + +#include +#include + +#define msk0 0x41 +#define msk1 0x90 +#define msk2 0xe9 +#define msk3 0x70 + +#define msk4 0xFC +#define msk5 0x05 +#define msk6 0x0A +#define msk7 0x0F + +union + { + __m128 x; + float f[4]; + } val1; + +static void +TEST (void) +{ + union + { + __m128 x; + float f[4]; + } res[8], val2, tmp; + int masks[8]; + int i, j; + + val2.f[0] = 55.0; + val2.f[1] = 55.0; + val2.f[2] = 55.0; + val2.f[3] = 55.0; + + val1.f[0] = 1.; + val1.f[1] = 2.; + val1.f[2] = 3.; + val1.f[3] = 4.; + + asm volatile ("" : "+m" (val1)); + res[0].x = _mm_insert_ps (val2.x, val1.x, msk0); + asm volatile ("" : "+m" (val1)); + res[1].x = _mm_insert_ps (val2.x, val1.x, msk1); + asm volatile ("" : "+m" (val1)); + res[2].x = _mm_insert_ps (val2.x, val1.x, msk2); + asm volatile ("" : "+m" (val1)); + res[3].x = _mm_insert_ps (val2.x, val1.x, msk3); + + masks[0] = msk0; + masks[1] = msk1; + masks[2] = msk2; + masks[3] = msk3; + + for (i = 0; i < 4; i++) + { + asm volatile ("" : "+m" (val1)); + res[i + 4].x = _mm_insert_ps (val2.x, val1.x, msk4); + } + + masks[4] = msk4; + masks[5] = msk4; + masks[6] = msk4; + masks[7] = msk4; + + for (i=0; i < 8; i++) + { + tmp = val2; + tmp.f[(masks[i] & 0x30) >> 4] = val1.f[(masks[i] & 0xC0) >> 6]; + + for (j = 0; j < 4; j++) + if (masks[i] & (0x1 << j)) + tmp.f[j] = 0.f; + + if (memcmp (&res[i], &tmp, sizeof (tmp))) + abort (); + } +} diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/powerpc/pr48192.c gcc-4.6.0/gcc/testsuite/gcc.target/powerpc/pr48192.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/powerpc/pr48192.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/powerpc/pr48192.c 2011-04-28 22:39:59.485927000 +0000 @@ -0,0 +1,49 @@ +/* { dg-do compile } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O3 -mcpu=power7 -std=gnu89" } */ + +/* Make sure that the conditional macros vector, bool, and pixel are not + considered as being defined. */ + +#ifdef bool +#error "bool is considered defined" +#endif + +#ifdef vector +#error "vector is considered defined" +#endif + +#ifdef pixel +#error "pixel is condsidered defined" +#endif + +#if defined(bool) +#error "bool is considered defined" +#endif + +#if defined(vector) +#error "vector is considered defined" +#endif + +#if defined(pixel) +#error "pixel is condsidered defined" +#endif + +#ifndef bool +#else +#error "bool is considered defined" +#endif + +#ifndef vector +#else +#error "vector is considered defined" +#endif + +#ifndef pixel +#else +#error "pixel is condsidered defined" +#endif + +#define bool long double +bool pixel = 0; diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/powerpc/pr48857.c gcc-4.6.0/gcc/testsuite/gcc.target/powerpc/pr48857.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/powerpc/pr48857.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/powerpc/pr48857.c 2011-05-10 19:59:20.426663000 +0000 @@ -0,0 +1,25 @@ +/* { dg-do compile { target { powerpc*-*-* } } } */ +/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */ +/* { dg-require-effective-target powerpc_vsx_ok } */ +/* { dg-options "-O2 -mcpu=power7 -mabi=altivec" } */ +/* { dg-final { scan-assembler-times "lxvd2x" 1 } } */ +/* { dg-final { scan-assembler-times "stxvd2x" 1 } } */ +/* { dg-final { scan-assembler-not "ld" } } */ +/* { dg-final { scan-assembler-not "lwz" } } */ +/* { dg-final { scan-assembler-not "stw" } } */ +/* { dg-final { scan-assembler-not "addi" } } */ + +typedef vector long long v2di_type; + +v2di_type +return_v2di (v2di_type *ptr) +{ + return *ptr; /* should generate lxvd2x 34,0,3. */ +} + +void +pass_v2di (v2di_type arg, v2di_type *ptr) +{ + *ptr = arg; /* should generate stxvd2x 34,0,{3,5}. */ +} + diff -Naur gcc-4.6.0.orig/gcc/testsuite/gcc.target/rx/pack.c gcc-4.6.0/gcc/testsuite/gcc.target/rx/pack.c --- gcc-4.6.0.orig/gcc/testsuite/gcc.target/rx/pack.c 2010-11-16 09:40:02.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gcc.target/rx/pack.c 2011-04-27 14:55:28.170311000 +0000 @@ -4,10 +4,10 @@ typedef struct tst_2 { - INT16U f0; // [+0] - INT16U * f1; // [+2] - INT16U f2; // [+6] - INT16U * f3; // [+8] + INT16U f0; /* [+0] */ + INT16U * f1; /* [+2] */ + INT16U f2; /* [+6] */ + INT16U * f3; /* [+8] */ } __attribute__ ((__packed__)) t2; #include diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/bessel_1.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/bessel_1.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/bessel_1.f90 2008-03-03 23:46:20.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/bessel_1.f90 2011-04-28 18:47:28.286450000 +0000 @@ -26,11 +26,11 @@ call check(bessel_yn (3,x4), bessel_yn (3,1.9_4)) contains - subroutine check_r4 (a, b) + subroutine check_r4 (a, b) ! { dg-warning "Extension: Internal procedure" } real(kind=4), intent(in) :: a, b if (abs(a - b) > 1.e-5 * abs(b)) call abort end subroutine - subroutine check_r8 (a, b) + subroutine check_r8 (a, b) ! { dg-warning "Extension: Internal procedure" } real(kind=8), intent(in) :: a, b if (abs(a - b) > 1.e-7 * abs(b)) call abort end subroutine diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/bessel_6.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/bessel_6.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/bessel_6.f90 2011-01-29 19:18:06.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/bessel_6.f90 2011-04-04 15:55:33.076116000 +0000 @@ -1,4 +1,5 @@ ! { dg-do run { xfail spu-*-* } } +! { dg-add-options ieee } ! ! PR fortran/36158 ! PR fortran/33197 diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/bessel_7.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/bessel_7.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/bessel_7.f90 2011-01-29 19:18:06.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/bessel_7.f90 2011-04-04 15:55:33.076116000 +0000 @@ -1,4 +1,5 @@ ! { dg-do run { xfail *-*-mingw* spu-*-* } } +! { dg-add-options ieee } ! ! PR fortran/36158 ! PR fortran/33197 diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/class_42.f03 gcc-4.6.0/gcc/testsuite/gfortran.dg/class_42.f03 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/class_42.f03 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/class_42.f03 2011-04-04 18:53:34.102550000 +0000 @@ -0,0 +1,16 @@ +! { dg-do compile } +! +! PR 48291: [4.6/4.7 Regression] [OOP] internal compiler error, new_symbol(): Symbol name too long +! +! Contributed by Adrian Prantl + +module Overload_AnException_Impl + type :: Overload_AnException_impl_t + end type +contains + subroutine ctor_impl(self) + class(Overload_AnException_impl_t) :: self + end subroutine +end module + +! { dg-final { cleanup-modules "Overload_AnException_Impl" } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/erfc_scaled_1.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/erfc_scaled_1.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/erfc_scaled_1.f90 2008-03-03 23:46:20.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/erfc_scaled_1.f90 2011-04-28 18:47:28.286450000 +0000 @@ -1,4 +1,8 @@ ! { dg-do run } +! +! { dg-options "" } +! Do not run with -pedantic checks enabled as "check" +! contains internal procedures which is a vendor extension program test implicit none diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/func_result_6.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/func_result_6.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/func_result_6.f90 2011-02-18 21:35:44.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/func_result_6.f90 2011-04-28 18:47:28.286450000 +0000 @@ -63,7 +63,7 @@ bar = gen() if (ptr /= 77) call abort() contains - function foo() + function foo() ! { dg-warning "Extension: Internal procedure .foo. in generic interface" } integer, allocatable :: foo(:) allocate(foo(2)) foo = [33, 77] diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/g77/cabs.f gcc-4.6.0/gcc/testsuite/gfortran.dg/g77/cabs.f --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/g77/cabs.f 2005-12-17 15:41:15.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/g77/cabs.f 2011-03-31 15:05:47.609354000 +0000 @@ -1,4 +1,5 @@ -c { dg-do run { xfail mips-sgi-irix6* } } PR 16292 +c { dg-do run } +c { dg-xfail-run-if "PR target/16292" { mips-sgi-irix6* } { -O0 } } program cabs_1 complex z0 real r0 diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/generic_24.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/generic_24.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/generic_24.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/generic_24.f90 2011-05-11 20:31:14.899018000 +0000 @@ -0,0 +1,100 @@ +! { dg-do compile } +! +! PR fortran/48889 +! +! Thanks for +! reporting to Lawrence Mitchell +! for the test case to David Ham +! +module sparse_tools + implicit none + private + + type csr_foo + integer, dimension(:), pointer :: colm=>null() + end type csr_foo + + type block_csr_matrix + type(csr_foo) :: sparsity + end type block_csr_matrix + + interface attach_block + module procedure block_csr_attach_block + end interface + + interface size + module procedure sparsity_size + end interface + + public :: size, attach_block +contains + subroutine block_csr_attach_block(matrix, val) + type(block_csr_matrix), intent(inout) :: matrix + real, dimension(size(matrix%sparsity%colm)), intent(in), target :: val + end subroutine block_csr_attach_block + + pure function sparsity_size(sparsity, dim) + integer :: sparsity_size + type(csr_foo), intent(in) :: sparsity + integer, optional, intent(in) :: dim + end function sparsity_size +end module sparse_tools + +module global_numbering + use sparse_tools + implicit none + + type ele_numbering_type + integer :: boundaries + end type ele_numbering_type + + type element_type + integer :: loc + type(ele_numbering_type), pointer :: numbering=>null() + end type element_type + + type csr_sparsity + end type csr_sparsity + + interface size + module procedure sparsity_size + end interface size +contains + pure function sparsity_size(sparsity, dim) + integer :: sparsity_size + type(csr_sparsity), intent(in) :: sparsity + integer, optional, intent(in) :: dim + end function sparsity_size + + subroutine make_boundary_numbering(EEList, xndglno, ele_n) + type(csr_sparsity), intent(in) :: EEList + type(element_type), intent(in) :: ele_n + integer, dimension(size(EEList,1)*ele_n%loc), intent(in), target ::& + & xndglno + integer, dimension(ele_n%numbering%boundaries) :: neigh + integer :: j + j=size(neigh) + end subroutine make_boundary_numbering +end module global_numbering + +module sparse_matrices_fields + use sparse_tools +implicit none + type scalar_field + real, dimension(:), pointer :: val + end type scalar_field +contains + subroutine csr_mult_T_scalar(x) + type(scalar_field), intent(inout) :: x + real, dimension(:), allocatable :: tmp + integer :: i + i=size(x%val) + end subroutine csr_mult_T_scalar +end module sparse_matrices_fields + +program test + use sparse_matrices_fields + use global_numbering +end program test + +! { dg-final { cleanup-modules "sparse_tools sparse_matrices_fields global_numbering" } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/gomp/pr48117.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/gomp/pr48117.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/gomp/pr48117.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/gomp/pr48117.f90 2011-04-07 18:33:34.122568000 +0000 @@ -0,0 +1,11 @@ +! PR fortran/48117 +! { dg-do compile } +! { dg-options "-O2 -fopenmp" } + +subroutine foo(x) + character(len=*), optional :: x + character(len=80) :: v + !$omp master + if (present(x)) v = adjustl(x) + !$omp end master +end subroutine foo diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/gomp/pr48611.f90 2011-05-10 06:31:59.518466000 +0000 @@ -0,0 +1,12 @@ +! PR tree-optimization/48611 +! { dg-do compile } +! { dg-options "-Os -fopenmp -fexceptions -fno-tree-ccp -fno-tree-copy-prop" } + + integer, allocatable :: a(:) + logical :: l +!$omp parallel private (a) reduction (.or.:l) + do i = 1, 7 + a(:) = i + end do +!$omp end parallel +end diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/gomp/pr48794.f90 2011-05-10 06:31:59.518466000 +0000 @@ -0,0 +1,12 @@ +! PR tree-optimization/48794 +! { dg-do compile } +! { dg-options "-Os -fopenmp -fexceptions -fno-tree-ccp -fno-tree-copy-prop" } + + integer, allocatable :: a(:) + logical :: l + if (allocated (a)) call abort +!$omp parallel private (a) reduction (.or.:l) + do i = 1, 7 + end do +!$omp end parallel +end diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/hypot_1.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/hypot_1.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/hypot_1.f90 2008-03-03 23:46:20.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/hypot_1.f90 2011-04-28 18:47:28.286450000 +0000 @@ -18,11 +18,11 @@ call check(hypot(x4,y4), hypot(1.9_4,-2.1_4)) contains - subroutine check_r4 (a, b) + subroutine check_r4 (a, b) ! { dg-warning "Extension: Internal procedure" } real(kind=4), intent(in) :: a, b if (abs(a - b) > 1.e-5 * abs(b)) call abort end subroutine - subroutine check_r8 (a, b) + subroutine check_r8 (a, b) ! { dg-warning "Extension: Internal procedure" } real(kind=8), intent(in) :: a, b if (abs(a - b) > 1.e-7 * abs(b)) call abort end subroutine diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/interface_35.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/interface_35.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/interface_35.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/interface_35.f90 2011-04-28 18:47:28.286450000 +0000 @@ -0,0 +1,79 @@ +! { dg-do compile } +! { dg-options "-std=f2008" } +! +! PR fortran/48112 (module_m) +! PR fortran/48279 (sidl_string_array, s_Hard) +! +! Contributed by mhp77@gmx.at (module_m) +! and Adrian Prantl (sidl_string_array, s_Hard) +! + +module module_m + interface test + function test1( ) result( test ) + integer :: test + end function test1 + end interface test +end module module_m + +! ----- + +module sidl_string_array + type sidl_string_1d + end type sidl_string_1d + interface set + module procedure & + setg1_p + end interface +contains + subroutine setg1_p(array, index, val) + type(sidl_string_1d), intent(inout) :: array + end subroutine setg1_p +end module sidl_string_array + +module s_Hard + use sidl_string_array + type :: s_Hard_t + integer(8) :: dummy + end type s_Hard_t + interface set_d_interface + end interface + interface get_d_string + module procedure get_d_string_p + end interface + contains ! Derived type member access functions + type(sidl_string_1d) function get_d_string_p(s) + type(s_Hard_t), intent(in) :: s + end function get_d_string_p + subroutine set_d_objectArray_p(s, d_objectArray) + end subroutine set_d_objectArray_p +end module s_Hard + +subroutine initHard(h, ex) + use s_Hard + type(s_Hard_t), intent(inout) :: h + call set(get_d_string(h), 0, 'Three') ! { dg-error "There is no specific subroutine for the generic" } +end subroutine initHard + +! ----- + + interface get + procedure get1 + end interface + + integer :: h + call set1 (get (h)) + +contains + + subroutine set1 (a) + integer, intent(in) :: a + end subroutine + + integer function get1 (s) ! { dg-error "Extension: Internal procedure .get1. in generic interface .get." } + integer :: s + end function + +end + +! { dg-final { cleanup-modules "module_m module_m2 s_hard sidl_string_array" } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/interface_36.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/interface_36.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/interface_36.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/interface_36.f90 2011-04-29 21:26:07.931377000 +0000 @@ -0,0 +1,28 @@ +! { dg-do compile } +! +! PR fortran/48800 +! +! Contributed by Daniel Carrera +! + pure function runge_kutta_step(t, r_, dr, h) result(res) + real, intent(in) :: t, r_(:), h + real, dimension(:), allocatable :: k1, k2, k3, k4, res + integer :: N + + interface + pure function dr(t, r_) ! { dg-error "cannot have a deferred shape" } + real, intent(in) :: t, r_(:) + real :: dr(:) + end function + end interface + + N = size(r_) + allocate(k1(N),k2(N),k3(N),k4(N),res(N)) + + k1 = dr(t, r_) + k2 = dr(t + h/2, r_ + k1*h/2) + k3 = dr(t + h/2, r_ + k2*h/2) + k4 = dr(t + h , r_ + k3*h) + + res = r_ + (k1 + 2*k2 + 2*k3 + k4) * h/6 + end function diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/interface_assignment_4.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/interface_assignment_4.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/interface_assignment_4.f90 2009-07-15 08:41:29.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/interface_assignment_4.f90 2011-04-28 18:47:28.286450000 +0000 @@ -16,7 +16,7 @@ contains - subroutine op_assign_VS_CH (var, exp) + subroutine op_assign_VS_CH (var, exp) ! { dg-warning "Extension: Internal procedure" } type(varying_string), intent(out) :: var character(LEN=*), intent(in) :: exp end subroutine diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/proc_ptr_comp_20.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/proc_ptr_comp_20.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/proc_ptr_comp_20.f90 2009-08-27 19:48:46.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/proc_ptr_comp_20.f90 2011-04-28 18:47:28.286450000 +0000 @@ -35,12 +35,12 @@ contains - real function f1(a,b) + real function f1(a,b) ! { dg-warning "Extension: Internal procedure" } real,intent(in) :: a,b f1 = a + b end function - integer function f2(a,b) + integer function f2(a,b) ! { dg-warning "Extension: Internal procedure" } real,intent(in) :: a,b f2 = a - b end function diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/proc_ptr_comp_21.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/proc_ptr_comp_21.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/proc_ptr_comp_21.f90 2009-09-10 22:47:03.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/proc_ptr_comp_21.f90 2011-04-28 18:47:28.286450000 +0000 @@ -19,7 +19,7 @@ contains - elemental subroutine op_assign (str, ch) + elemental subroutine op_assign (str, ch) ! { dg-warning "Extension: Internal procedure" } type(nf_t), intent(out) :: str character(len=*), intent(in) :: ch end subroutine diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/realloc_on_assign_6.f03 gcc-4.6.0/gcc/testsuite/gfortran.dg/realloc_on_assign_6.f03 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/realloc_on_assign_6.f03 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/realloc_on_assign_6.f03 2011-04-13 18:38:17.941552000 +0000 @@ -0,0 +1,129 @@ +! { dg-do compile } +! Test the fix for PR48456 and PR48360 in which the backend +! declarations for components were not located in the automatic +! reallocation on assignments, thereby causing ICEs. +! +! Contributed by Keith Refson +! and Douglas Foulds +! +! This is PR48360 + +module m + type mm + real, dimension(3,3) :: h0 + end type mm +end module m + +module gf33 + + real, allocatable, save, dimension(:,:) :: hmat + +contains + subroutine assignit + + use m + implicit none + + type(mm) :: mmv + + hmat = mmv%h0 + end subroutine assignit +end module gf33 + +! This is PR48456 + +module custom_type + +integer, parameter :: dp = kind(0.d0) + +type :: my_type_sub + real(dp), dimension(5) :: some_vector +end type my_type_sub + +type :: my_type + type(my_type_sub) :: some_element +end type my_type + +end module custom_type + +module custom_interfaces + +interface + subroutine store_data_subroutine(vec_size) + implicit none + integer, intent(in) :: vec_size + integer :: k + end subroutine store_data_subroutine +end interface + +end module custom_interfaces + +module store_data_test + +use custom_type + +save +type(my_type), dimension(:), allocatable :: some_type_to_save + +end module store_data_test + +program test + +use store_data_test + +integer :: vec_size + +vec_size = 2 + +call store_data_subroutine(vec_size) +call print_after_transfer() + +end program test + +subroutine store_data_subroutine(vec_size) + +use custom_type +use store_data_test + +implicit none + +integer, intent(in) :: vec_size +integer :: k + +allocate(some_type_to_save(vec_size)) + +do k = 1,vec_size + + some_type_to_save(k)%some_element%some_vector(1) = 1.0_dp + some_type_to_save(k)%some_element%some_vector(2) = 2.0_dp + some_type_to_save(k)%some_element%some_vector(3) = 3.0_dp + some_type_to_save(k)%some_element%some_vector(4) = 4.0_dp + some_type_to_save(k)%some_element%some_vector(5) = 5.0_dp + +end do + +end subroutine store_data_subroutine + +subroutine print_after_transfer() + +use custom_type +use store_data_test + +implicit none + +real(dp), dimension(:), allocatable :: C_vec +integer :: k + +allocate(C_vec(5)) + +do k = 1,size(some_type_to_save) + + C_vec = some_type_to_save(k)%some_element%some_vector + print *, "C_vec", C_vec + +end do + +end subroutine print_after_transfer +! { dg-final { cleanup-modules "m gf33" } } +! { dg-final { cleanup-modules "custom_type custom_interfaces" } } +! { dg-final { cleanup-modules "store_data_test" } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/realloc_on_assign_7.f03 gcc-4.6.0/gcc/testsuite/gfortran.dg/realloc_on_assign_7.f03 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/realloc_on_assign_7.f03 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/realloc_on_assign_7.f03 2011-04-30 12:00:50.541680000 +0000 @@ -0,0 +1,84 @@ +! { dg-do run } +! Check the fix for PR48462 in which the assignments involving matmul +! seg faulted because a was automatically freed before the assignment. +! Since it is related, the test for the fix of PR48746 has been added +! as a subroutine by that name. +! +! Contributed by John Nedney +! +program main + implicit none + integer, parameter :: dp = kind(0.0d0) + real(kind=dp), allocatable :: delta(:,:) + real(kind=dp), allocatable, target :: a(:,:) + real(kind=dp), pointer :: aptr(:,:) + + allocate(a(3,3)) + aptr => a + + call foo + if (.not. associated (aptr, a)) call abort () ! reallocated to same size - remains associated + call bar + if (.not. associated (aptr, a)) call abort () ! reallocated to smaller size - remains associated + call foobar + if (associated (aptr, a)) call abort () ! reallocated to larger size - disassociates + + call pr48746 +contains +! +! Original reduced version from comment #2 + subroutine foo + implicit none + real(kind=dp), allocatable :: b(:,:) + + allocate(b(3,3)) + allocate(delta(3,3)) + + a = reshape ([1d0, 2d0, 3d0, 4d0, 5d0, 6d0, 7d0, 8d0, 9d0], [3,3]) + b = reshape ([1d0, 0d0, 0d0, 0d0, 1d0, 0d0, 0d0, 0d0, 1d0], [3,3]) + + a = matmul( matmul( a, b ), b ) + delta = (a - reshape ([1d0, 2d0, 3d0, 4d0, 5d0, 6d0, 7d0, 8d0, 9d0], [3,3]))**2 + if (any (delta > 1d-12)) call abort + if (any (lbound (a) .ne. [1, 1])) call abort + end subroutine +! +! Check that all is well when the shape of 'a' changes. + subroutine bar + implicit none + real(kind=dp), allocatable :: a(:,:) + real(kind=dp), allocatable :: b(:,:) + + b = reshape ([1d0, 1d0, 1d0], [3,1]) + a = reshape ([1d0, 2d0, 3d0, 4d0, 5d0, 6d0, 7d0, 8d0, 9d0], [3,3]) + + a = matmul( a, matmul( a, b ) ) + + delta = (a - reshape ([198d0, 243d0, 288d0], [3,1]))**2 + if (any (delta > 1d-12)) call abort + if (any (lbound (a) .ne. [1, 1])) call abort + end subroutine + subroutine foobar + integer :: i + a = reshape ([(real(i, dp), i = 1, 100)],[10,10]) + end subroutine + subroutine pr48746 +! This is a further wrinkle on the original problem and came about +! because the dtype field of the result argument, passed to matmul, +! was not being set. This is needed by matmul for the rank. +! +! Contributed by Thomas Koenig +! + implicit none + integer, parameter :: m=10, n=12, count=4 + real :: optmatmul(m, n) + real :: a(m, count), b(count, n), c(m, n) + real, dimension(:,:), allocatable :: tmp + call random_number(a) + call random_number(b) + tmp = matmul(a,b) + if (any (lbound (tmp) .ne. [1,1])) call abort + if (any (ubound (tmp) .ne. [10,12])) call abort + end subroutine +end program main + diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/typebound_proc_22.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/typebound_proc_22.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/typebound_proc_22.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/typebound_proc_22.f90 2011-04-29 21:26:07.931377000 +0000 @@ -0,0 +1,49 @@ +! { dg-do compile } +! +! PR fortran/48810 +! +! Contributed by Andrew Baldwin +! + module qtest + type foobar + integer :: x + contains + private + procedure :: gimmex + generic, public :: getx => gimmex + end type foobar + contains + function gimmex(foo) + class (foobar) :: foo + integer :: gimmex + gimmex = foo%x + end function gimmex + end module qtest + + module qtestPriv + type foobarPriv + integer :: x + contains + private + procedure :: gimmexPriv + generic, private :: getxPriv => gimmexPriv + end type foobarPriv + contains + function gimmexPriv(foo) + class (foobarPriv) :: foo + integer :: gimmex + gimmex = foo%x + end function gimmexPriv + end module qtestPriv + + program quicktest + use qtest + use qtestPriv + type (foobar) :: foo + type (foobarPriv) :: fooPriv + integer :: bar + bar = foo%getx() ! OK + bar = fooPriv%getxPriv() ! { dg-error " is PRIVATE " } + end program quicktest + +! { dg-final { cleanup-modules "qtest qtestpriv" } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/whole_file_33.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/whole_file_33.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/whole_file_33.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/whole_file_33.f90 2011-04-26 08:41:31.964983000 +0000 @@ -0,0 +1,50 @@ +! { dg-do compile } +! +! PR fortran/48588 +! +! Contributed by Andres Legarra. +! + +MODULE LA_PRECISION +IMPLICIT NONE +INTEGER, PARAMETER :: dp = KIND(1.0D0) +END MODULE LA_PRECISION + +module lapack90 +INTERFACE + SUBROUTINE DGESV_F90( A, B, IPIV, INFO ) + USE la_precision, ONLY: wp => dp + IMPLICIT NONE + INTEGER, INTENT(OUT), OPTIONAL :: INFO + INTEGER, INTENT(OUT), OPTIONAL, TARGET :: IPIV(:) + REAL(WP), INTENT(IN OUT) :: A(:,:), B(:,:) + END SUBROUTINE DGESV_F90 +END INTERFACE +end module + +SUBROUTINE DGESV_F90( A, B, IPIV, INFO ) + USE la_precision, ONLY: wp => dp + IMPLICIT NONE + INTEGER, INTENT(OUT), OPTIONAL :: INFO + INTEGER, INTENT(OUT), OPTIONAL, TARGET :: IPIV(:) + REAL(WP), INTENT(IN OUT) :: A(:,:), B(:,:) +END SUBROUTINE DGESV_F90 + +MODULE DENSEOP + USE LAPACK90 + implicit none + integer, parameter :: r8 = SELECTED_REAL_KIND( 15, 307 ) + real(r8)::denseop_tol=1.d-50 + + CONTAINS + + SUBROUTINE GEINV8 (x) + real(r8)::x(:,:) + real(r8),allocatable::x_o(:,:) + allocate(x_o(size(x,1),size(x,1))) + CALL dgesv_f90(x,x_o) + x=x_o + END SUBROUTINE GEINV8 +END MODULE DENSEOP + +! { dg-final { cleanup-modules "la_precision lapack90 denseop" } } diff -Naur gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/whole_file_34.f90 gcc-4.6.0/gcc/testsuite/gfortran.dg/whole_file_34.f90 --- gcc-4.6.0.orig/gcc/testsuite/gfortran.dg/whole_file_34.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gfortran.dg/whole_file_34.f90 2011-04-28 18:43:16.311468000 +0000 @@ -0,0 +1,12 @@ +! { dg-do compile } +! +! PR fortran/48788 +! +! Contributed by Zdenek Sojka +! +function foo () +end function foo + character(4), external :: foo ! { dg-error "Return type mismatch of function" } + character(4) :: x + x = foo () +END diff -Naur gcc-4.6.0.orig/gcc/testsuite/gnat.dg/discr29.adb gcc-4.6.0/gcc/testsuite/gnat.dg/discr29.adb --- gcc-4.6.0.orig/gcc/testsuite/gnat.dg/discr29.adb 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gnat.dg/discr29.adb 2011-05-05 16:27:03.722146000 +0000 @@ -0,0 +1,8 @@ +package body Discr29 is + + procedure Proc (R : out Rec3) is + begin + R := (False, Tmp); + end; + +end Discr29; diff -Naur gcc-4.6.0.orig/gcc/testsuite/gnat.dg/discr29.ads gcc-4.6.0/gcc/testsuite/gnat.dg/discr29.ads --- gcc-4.6.0.orig/gcc/testsuite/gnat.dg/discr29.ads 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gnat.dg/discr29.ads 2011-05-05 16:27:03.722146000 +0000 @@ -0,0 +1,27 @@ +-- { dg-do compile } + +package Discr29 is + + type Rec1 is record + I1 : Integer; + I2 : Integer; + I3 : Integer; + end record; + + type Rec2 is tagged record + I1 : Integer; + I2 : Integer; + end record; + + type Rec3 (D : Boolean) is record + case D is + when True => A : Rec1; + when False => B : Rec2; + end case; + end record; + + procedure Proc (R : out Rec3); + + Tmp : Rec2; + +end Discr29; diff -Naur gcc-4.6.0.orig/gcc/testsuite/gnat.dg/discr30.adb gcc-4.6.0/gcc/testsuite/gnat.dg/discr30.adb --- gcc-4.6.0.orig/gcc/testsuite/gnat.dg/discr30.adb 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gnat.dg/discr30.adb 2011-05-05 16:27:03.722146000 +0000 @@ -0,0 +1,50 @@ +-- PR ada/48844 +-- Reported by Georg Bauhaus */ + +-- { dg-do compile } + +procedure Discr30 is + + generic + type Source is private; + type Target is private; + function Conversion (S : Source) return Target; + + function Conversion (S : Source) return Target is + type Source_Wrapper is tagged record + S : Source; + end record; + type Target_Wrapper is tagged record + T : Target; + end record; + + type Selector is (Source_Field, Target_Field); + type Magic (Sel : Selector := Target_Field) is record + case Sel is + when Source_Field => S : Source_Wrapper; + when Target_Field => T : Target_Wrapper; + end case; + end record; + + M : Magic; + + function Convert (T : Target_Wrapper) return Target is + begin + M := (Sel => Source_Field, S => (S => S)); + return T.T; + end Convert; + + begin + return Convert (M.T); + end Conversion; + + type Integer_Access is access all Integer; + + I : aliased Integer; + I_Access : Integer_Access := I'Access; + + function Convert is new Conversion (Integer_Access, Integer); + +begin + I := Convert (I_Access); +end; diff -Naur gcc-4.6.0.orig/gcc/testsuite/gnat.dg/volatile5.adb gcc-4.6.0/gcc/testsuite/gnat.dg/volatile5.adb --- gcc-4.6.0.orig/gcc/testsuite/gnat.dg/volatile5.adb 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gnat.dg/volatile5.adb 2011-04-21 14:18:54.402847000 +0000 @@ -0,0 +1,16 @@ +-- { dg-do compile } + +with Volatile5_Pkg; use Volatile5_Pkg; + +procedure Volatile5 is + + A : Rec; + + procedure Proc is + begin + A := F; + end; + +begin + Proc; +end; diff -Naur gcc-4.6.0.orig/gcc/testsuite/gnat.dg/volatile5_pkg.ads gcc-4.6.0/gcc/testsuite/gnat.dg/volatile5_pkg.ads --- gcc-4.6.0.orig/gcc/testsuite/gnat.dg/volatile5_pkg.ads 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/gnat.dg/volatile5_pkg.ads 2011-04-21 14:18:54.402847000 +0000 @@ -0,0 +1,11 @@ +package Volatile5_Pkg is + + type Rec is record + I : Integer; + end record; + pragma Volatile(Rec); + + function F return Rec; + +end Volatile5_Pkg; +-- \ No newline at end of file diff -Naur gcc-4.6.0.orig/gcc/testsuite/lib/target-supports.exp gcc-4.6.0/gcc/testsuite/lib/target-supports.exp --- gcc-4.6.0.orig/gcc/testsuite/lib/target-supports.exp 2011-02-19 15:31:15.000000000 +0000 +++ gcc-4.6.0/gcc/testsuite/lib/target-supports.exp 2011-04-27 14:55:28.170311000 +0000 @@ -3556,6 +3556,9 @@ || [istarget "sh*-*-*"] } { return "$flags -mieee" } + if { [istarget "rx-*-*"] } { + return "$flags -mnofpu" + } return $flags } diff -Naur gcc-4.6.0.orig/gcc/tree-data-ref.c gcc-4.6.0/gcc/tree-data-ref.c --- gcc-4.6.0.orig/gcc/tree-data-ref.c 2011-02-05 01:39:20.000000000 +0000 +++ gcc-4.6.0/gcc/tree-data-ref.c 2011-05-11 13:07:54.877914000 +0000 @@ -1,5 +1,5 @@ /* Data references and dependences detectors. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Sebastian Pop @@ -4975,7 +4975,7 @@ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) { stmt = gsi_stmt (bsi); - if (gimple_code (stmt) != GIMPLE_LABEL) + if (gimple_code (stmt) != GIMPLE_LABEL && !is_gimple_debug (stmt)) VEC_safe_push (gimple, heap, *stmts, stmt); } } diff -Naur gcc-4.6.0.orig/gcc/tree-eh.c gcc-4.6.0/gcc/tree-eh.c --- gcc-4.6.0.orig/gcc/tree-eh.c 2011-01-21 15:15:40.000000000 +0000 +++ gcc-4.6.0/gcc/tree-eh.c 2011-05-10 06:31:59.518466000 +0000 @@ -849,6 +849,8 @@ { while (bitmap_set_bit (eh_region_may_contain_throw_map, region->index)) { + if (region->type == ERT_MUST_NOT_THROW) + break; region = region->outer; if (region == NULL) break; @@ -3319,6 +3321,19 @@ SET_BIT (r_reachable, region->index); SET_BIT (lp_reachable, lp_nr); } + + /* Avoid removing regions referenced from RESX/EH_DISPATCH. */ + switch (gimple_code (stmt)) + { + case GIMPLE_RESX: + SET_BIT (r_reachable, gimple_resx_region (stmt)); + break; + case GIMPLE_EH_DISPATCH: + SET_BIT (r_reachable, gimple_eh_dispatch_region (stmt)); + break; + default: + break; + } } } diff -Naur gcc-4.6.0.orig/gcc/tree-flow.h gcc-4.6.0/gcc/tree-flow.h --- gcc-4.6.0.orig/gcc/tree-flow.h 2011-02-15 18:36:31.000000000 +0000 +++ gcc-4.6.0/gcc/tree-flow.h 2011-05-11 13:07:54.877914000 +0000 @@ -559,6 +559,7 @@ void insert_debug_temps_for_defs (gimple_stmt_iterator *); void insert_debug_temp_for_var_def (gimple_stmt_iterator *, tree); +void reset_debug_uses (gimple); void release_defs_bitset (bitmap toremove); /* In tree-into-ssa.c */ diff -Naur gcc-4.6.0.orig/gcc/tree-if-conv.c gcc-4.6.0/gcc/tree-if-conv.c --- gcc-4.6.0.orig/gcc/tree-if-conv.c 2011-02-23 16:49:52.000000000 +0000 +++ gcc-4.6.0/gcc/tree-if-conv.c 2011-05-12 17:46:15.934858000 +0000 @@ -1604,6 +1604,7 @@ for (i = 0; i < orig_loop_num_nodes; i++) { bb = ifc_bbs[i]; + free_bb_predicate (bb); if (bb_with_exit_edge_p (loop, bb)) { exit_bb = bb; @@ -1679,6 +1680,9 @@ && exit_bb != loop->header && can_merge_blocks_p (loop->header, exit_bb)) merge_blocks (loop->header, exit_bb); + + free (ifc_bbs); + ifc_bbs = NULL; } /* If-convert LOOP when it is legal. For the moment this pass has no diff -Naur gcc-4.6.0.orig/gcc/tree-inline.c gcc-4.6.0/gcc/tree-inline.c --- gcc-4.6.0.orig/gcc/tree-inline.c 2011-02-28 10:23:14.000000000 +0000 +++ gcc-4.6.0/gcc/tree-inline.c 2011-05-05 21:02:06.894116000 +0000 @@ -4334,14 +4334,16 @@ CONSTRUCTOR_ELTS (*tp)); *tp = new_tree; } + else if (code == STATEMENT_LIST) + /* We used to just abort on STATEMENT_LIST, but we can run into them + with statement-expressions (c++/40975). */ + copy_statement_list (tp); else if (TREE_CODE_CLASS (code) == tcc_type) *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == tcc_declaration) *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == tcc_constant) *walk_subtrees = 0; - else - gcc_assert (code != STATEMENT_LIST); return NULL_TREE; } diff -Naur gcc-4.6.0.orig/gcc/tree-loop-distribution.c gcc-4.6.0/gcc/tree-loop-distribution.c --- gcc-4.6.0.orig/gcc/tree-loop-distribution.c 2011-01-01 13:25:17.000000000 +0000 +++ gcc-4.6.0/gcc/tree-loop-distribution.c 2011-05-11 13:07:54.877914000 +0000 @@ -1,5 +1,5 @@ /* Loop distribution. - Copyright (C) 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Georges-Andre Silber and Sebastian Pop . @@ -181,6 +181,25 @@ stmts_from_loop. */ bbs = get_loop_body_in_dom_order (loop); + if (MAY_HAVE_DEBUG_STMTS) + for (x = 0, i = 0; i < loop->num_nodes; i++) + { + basic_block bb = bbs[i]; + + for (bsi = gsi_start_phis (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + if (!bitmap_bit_p (partition, x++)) + reset_debug_uses (gsi_stmt (bsi)); + + for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi)) + { + gimple stmt = gsi_stmt (bsi); + if (gimple_code (stmt) != GIMPLE_LABEL + && !is_gimple_debug (stmt) + && !bitmap_bit_p (partition, x++)) + reset_debug_uses (stmt); + } + } + for (x = 0, i = 0; i < loop->num_nodes; i++) { basic_block bb = bbs[i]; @@ -199,7 +218,8 @@ for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi);) { gimple stmt = gsi_stmt (bsi); - if (gimple_code (gsi_stmt (bsi)) != GIMPLE_LABEL + if (gimple_code (stmt) != GIMPLE_LABEL + && !is_gimple_debug (stmt) && !bitmap_bit_p (partition, x++)) { unlink_stmt_vdef (stmt); @@ -312,7 +332,9 @@ { gimple stmt = gsi_stmt (bsi); - if (bitmap_bit_p (partition, x++) + if (gimple_code (stmt) != GIMPLE_LABEL + && !is_gimple_debug (stmt) + && bitmap_bit_p (partition, x++) && is_gimple_assign (stmt) && !is_gimple_reg (gimple_assign_lhs (stmt))) { diff -Naur gcc-4.6.0.orig/gcc/tree-object-size.c gcc-4.6.0/gcc/tree-object-size.c --- gcc-4.6.0.orig/gcc/tree-object-size.c 2011-03-17 13:22:26.000000000 +0000 +++ gcc-4.6.0/gcc/tree-object-size.c 2011-03-28 10:14:34.889170000 +0000 @@ -348,8 +348,6 @@ tree bytes2 = compute_object_offset (TREE_OPERAND (ptr, 0), pt_var); if (bytes2 != error_mark_node) { - bytes2 = size_binop (PLUS_EXPR, bytes2, - TREE_OPERAND (pt_var, 1)); if (TREE_CODE (bytes2) == INTEGER_CST && tree_int_cst_lt (pt_var_size, bytes2)) bytes2 = size_zero_node; diff -Naur gcc-4.6.0.orig/gcc/tree-ssa-alias.c gcc-4.6.0/gcc/tree-ssa-alias.c --- gcc-4.6.0.orig/gcc/tree-ssa-alias.c 2011-03-03 12:10:40.000000000 +0000 +++ gcc-4.6.0/gcc/tree-ssa-alias.c 2011-04-21 14:40:53.747428000 +0000 @@ -594,11 +594,11 @@ are the respective alias sets. */ static bool -aliasing_component_refs_p (tree ref1, tree type1, +aliasing_component_refs_p (tree ref1, alias_set_type ref1_alias_set, alias_set_type base1_alias_set, HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, - tree ref2, tree type2, + tree ref2, alias_set_type ref2_alias_set, alias_set_type base2_alias_set, HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2, @@ -610,9 +610,21 @@ struct A { int i; int j; } *q; struct B { struct A a; int k; } *p; disambiguating q->i and p->a.j. */ + tree base1, base2; + tree type1, type2; tree *refp; int same_p; + /* Choose bases and base types to search for. */ + base1 = ref1; + while (handled_component_p (base1)) + base1 = TREE_OPERAND (base1, 0); + type1 = TREE_TYPE (base1); + base2 = ref2; + while (handled_component_p (base2)) + base2 = TREE_OPERAND (base2, 0); + type2 = TREE_TYPE (base2); + /* Now search for the type1 in the access path of ref2. This would be a common base for doing offset based disambiguation on. */ refp = &ref2; @@ -628,6 +640,8 @@ HOST_WIDE_INT offadj, sztmp, msztmp; get_ref_base_and_extent (*refp, &offadj, &sztmp, &msztmp); offset2 -= offadj; + get_ref_base_and_extent (base1, &offadj, &sztmp, &msztmp); + offset1 -= offadj; return ranges_overlap_p (offset1, max_size1, offset2, max_size2); } /* If we didn't find a common base, try the other way around. */ @@ -644,6 +658,8 @@ HOST_WIDE_INT offadj, sztmp, msztmp; get_ref_base_and_extent (*refp, &offadj, &sztmp, &msztmp); offset1 -= offadj; + get_ref_base_and_extent (base2, &offadj, &sztmp, &msztmp); + offset2 -= offadj; return ranges_overlap_p (offset1, max_size1, offset2, max_size2); } @@ -805,11 +821,10 @@ && TREE_CODE (base1) != TARGET_MEM_REF && (TREE_CODE (base1) != MEM_REF || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1)) - return aliasing_component_refs_p (ref1, TREE_TYPE (ptrtype1), + return aliasing_component_refs_p (ref1, ref1_alias_set, base1_alias_set, offset1, max_size1, - ref2, TREE_TYPE - (reference_alias_ptr_type (ref2)), + ref2, ref2_alias_set, base2_alias_set, offset2, max_size2, true); @@ -952,10 +967,10 @@ || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1) && (TREE_CODE (base2) != MEM_REF || same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1)) - return aliasing_component_refs_p (ref1, TREE_TYPE (ptrtype1), + return aliasing_component_refs_p (ref1, ref1_alias_set, base1_alias_set, offset1, max_size1, - ref2, TREE_TYPE (ptrtype2), + ref2, ref2_alias_set, base2_alias_set, offset2, max_size2, false); diff -Naur gcc-4.6.0.orig/gcc/tree-ssa-forwprop.c gcc-4.6.0/gcc/tree-ssa-forwprop.c --- gcc-4.6.0.orig/gcc/tree-ssa-forwprop.c 2011-02-08 10:44:06.000000000 +0000 +++ gcc-4.6.0/gcc/tree-ssa-forwprop.c 2011-04-22 18:53:30.123145000 +0000 @@ -1815,7 +1815,7 @@ { /* ~A + A -> -1. */ code = INTEGER_CST; - rhs1 = build_int_cst (TREE_TYPE (rhs2), -1); + rhs1 = build_int_cst_type (TREE_TYPE (rhs2), -1); rhs2 = NULL_TREE; gimple_assign_set_rhs_with_ops (&gsi, code, rhs1, NULL_TREE); gcc_assert (gsi_stmt (gsi) == stmt); @@ -1915,7 +1915,7 @@ { /* A + ~A -> -1. */ code = INTEGER_CST; - rhs1 = build_int_cst (TREE_TYPE (rhs1), -1); + rhs1 = build_int_cst_type (TREE_TYPE (rhs1), -1); rhs2 = NULL_TREE; gimple_assign_set_rhs_with_ops (&gsi, code, rhs1, NULL_TREE); gcc_assert (gsi_stmt (gsi) == stmt); diff -Naur gcc-4.6.0.orig/gcc/tree-ssa-reassoc.c gcc-4.6.0/gcc/tree-ssa-reassoc.c --- gcc-4.6.0.orig/gcc/tree-ssa-reassoc.c 2011-02-14 17:59:10.000000000 +0000 +++ gcc-4.6.0/gcc/tree-ssa-reassoc.c 2011-04-26 13:44:51.810726000 +0000 @@ -1,5 +1,6 @@ /* Reassociation for trees. - Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2008, 2009, 2010, 2011 + Free Software Foundation, Inc. Contributed by Daniel Berlin This file is part of GCC. @@ -1279,6 +1280,20 @@ if (!useless_type_conversion_p (TREE_TYPE (curr->op), TREE_TYPE (t))) t = fold_convert (TREE_TYPE (curr->op), t); + if (TREE_CODE (t) != INTEGER_CST + && !operand_equal_p (t, curr->op, 0)) + { + enum tree_code subcode; + tree newop1, newop2; + if (!COMPARISON_CLASS_P (t)) + continue; + extract_ops_from_tree (t, &subcode, &newop1, &newop2); + STRIP_USELESS_TYPE_CONVERSION (newop1); + STRIP_USELESS_TYPE_CONVERSION (newop2); + if (!is_gimple_val (newop1) || !is_gimple_val (newop2)) + continue; + } + if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, "Equivalence: "); diff -Naur gcc-4.6.0.orig/gcc/tree-ssa-sccvn.c gcc-4.6.0/gcc/tree-ssa-sccvn.c --- gcc-4.6.0.orig/gcc/tree-ssa-sccvn.c 2011-02-07 16:58:17.000000000 +0000 +++ gcc-4.6.0/gcc/tree-ssa-sccvn.c 2011-05-12 14:08:00.418016000 +0000 @@ -2103,12 +2103,26 @@ static inline bool set_ssa_val_to (tree from, tree to) { - tree currval; + tree currval = SSA_VAL (from); - if (from != to - && TREE_CODE (to) == SSA_NAME - && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (to)) - to = from; + if (from != to) + { + if (currval == from) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Not changing value number of "); + print_generic_expr (dump_file, from, 0); + fprintf (dump_file, " from VARYING to "); + print_generic_expr (dump_file, to, 0); + fprintf (dump_file, "\n"); + } + return false; + } + else if (TREE_CODE (to) == SSA_NAME + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (to)) + to = from; + } /* The only thing we allow as value numbers are VN_TOP, ssa_names and invariants. So assert that here. */ @@ -2125,8 +2139,6 @@ print_generic_expr (dump_file, to, 0); } - currval = SSA_VAL (from); - if (currval != to && !operand_equal_p (currval, to, OEP_PURE_SAME)) { VN_INFO (from)->valnum = to; @@ -3124,6 +3136,8 @@ { changed = false; iterations++; + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "Starting iteration %d\n", iterations); /* As we are value-numbering optimistically we have to clear the expression tables and the simplified expressions in each iteration until we converge. */ diff -Naur gcc-4.6.0.orig/gcc/tree-ssa.c gcc-4.6.0/gcc/tree-ssa.c --- gcc-4.6.0.orig/gcc/tree-ssa.c 2011-02-15 18:36:31.000000000 +0000 +++ gcc-4.6.0/gcc/tree-ssa.c 2011-05-11 13:07:54.877914000 +0000 @@ -1,5 +1,5 @@ /* Miscellaneous SSA utility functions. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of GCC. @@ -352,6 +352,10 @@ value = degenerate_phi_result (def_stmt); if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL)) value = NULL; + /* error_mark_node is what fixup_noreturn_call changes PHI arguments + to. */ + else if (value == error_mark_node) + value = NULL; } else if (is_gimple_assign (def_stmt)) { @@ -455,13 +459,19 @@ continue; if (value) - FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) - /* unshare_expr is not needed here. vexpr is either a - SINGLE_RHS, that can be safely shared, some other RHS - that was unshared when we found it had a single debug - use, or a DEBUG_EXPR_DECL, that can be safely - shared. */ - SET_USE (use_p, value); + { + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) + /* unshare_expr is not needed here. vexpr is either a + SINGLE_RHS, that can be safely shared, some other RHS + that was unshared when we found it had a single debug + use, or a DEBUG_EXPR_DECL, that can be safely + shared. */ + SET_USE (use_p, value); + /* If we didn't replace uses with a debug decl fold the + resulting expression. Otherwise we end up with invalid IL. */ + if (TREE_CODE (value) != DEBUG_EXPR_DECL) + fold_stmt_inplace (stmt); + } else gimple_debug_bind_reset_value (stmt); @@ -497,6 +507,37 @@ } } +/* Reset all debug stmts that use SSA_NAME(s) defined in STMT. */ + +void +reset_debug_uses (gimple stmt) +{ + ssa_op_iter op_iter; + def_operand_p def_p; + imm_use_iterator imm_iter; + gimple use_stmt; + + if (!MAY_HAVE_DEBUG_STMTS) + return; + + FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF) + { + tree var = DEF_FROM_PTR (def_p); + + if (TREE_CODE (var) != SSA_NAME) + continue; + + FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, var) + { + if (!gimple_debug_bind_p (use_stmt)) + continue; + + gimple_debug_bind_reset_value (use_stmt); + update_stmt (use_stmt); + } + } +} + /* Delete SSA DEFs for SSA versions in the TOREMOVE bitmap, removing dominated stmts before their dominators, so that release_ssa_defs stands a chance of propagating DEFs into debug bind stmts. */ diff -Naur gcc-4.6.0.orig/gcc/tree-switch-conversion.c gcc-4.6.0/gcc/tree-switch-conversion.c --- gcc-4.6.0.orig/gcc/tree-switch-conversion.c 2010-11-29 14:09:41.000000000 +0000 +++ gcc-4.6.0/gcc/tree-switch-conversion.c 2011-04-30 06:55:11.755353000 +0000 @@ -1,6 +1,6 @@ /* Switch Conversion converts variable initializations based on switch statements to initializations from a static array. - Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2006, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Martin Jambor This file is part of GCC. @@ -656,7 +656,7 @@ build_arrays (gimple swtch) { tree arr_index_type; - tree tidx, sub, tmp; + tree tidx, sub, tmp, utype; gimple stmt; gimple_stmt_iterator gsi; int i; @@ -664,14 +664,20 @@ gsi = gsi_for_stmt (swtch); + /* Make sure we do not generate arithmetics in a subrange. */ + utype = TREE_TYPE (info.index_expr); + if (TREE_TYPE (utype)) + utype = lang_hooks.types.type_for_mode (TYPE_MODE (TREE_TYPE (utype)), 1); + else + utype = lang_hooks.types.type_for_mode (TYPE_MODE (utype), 1); + arr_index_type = build_index_type (info.range_size); - tmp = create_tmp_var (TREE_TYPE (info.index_expr), "csti"); + tmp = create_tmp_var (utype, "csui"); add_referenced_var (tmp); tidx = make_ssa_name (tmp, NULL); - sub = fold_build2_loc (loc, MINUS_EXPR, - TREE_TYPE (info.index_expr), info.index_expr, - fold_convert_loc (loc, TREE_TYPE (info.index_expr), - info.range_min)); + sub = fold_build2_loc (loc, MINUS_EXPR, utype, + fold_convert_loc (loc, utype, info.index_expr), + fold_convert_loc (loc, utype, info.range_min)); sub = force_gimple_operand_gsi (&gsi, sub, false, NULL, true, GSI_SAME_STMT); stmt = gimple_build_assign (tidx, sub); @@ -780,12 +786,7 @@ tree label_decl2 = create_artificial_label (UNKNOWN_LOCATION); tree label_decl3 = create_artificial_label (UNKNOWN_LOCATION); gimple label1, label2, label3; - - tree utype; - tree tmp_u_1, tmp_u_2, tmp_u_var; - tree cast; - gimple cast_assign, minus_assign; - tree ulb, minus; + tree utype, tidx; tree bound; gimple cond_stmt; @@ -799,49 +800,24 @@ gcc_assert (info.default_values); bb0 = gimple_bb (swtch); - /* Make sure we do not generate arithmetics in a subrange. */ - if (TREE_TYPE (TREE_TYPE (info.index_expr))) - utype = lang_hooks.types.type_for_mode - (TYPE_MODE (TREE_TYPE (TREE_TYPE (info.index_expr))), 1); - else - utype = lang_hooks.types.type_for_mode - (TYPE_MODE (TREE_TYPE (info.index_expr)), 1); + tidx = gimple_assign_lhs (info.arr_ref_first); + utype = TREE_TYPE (tidx); /* (end of) block 0 */ gsi = gsi_for_stmt (info.arr_ref_first); - tmp_u_var = create_tmp_var (utype, "csui"); - add_referenced_var (tmp_u_var); - tmp_u_1 = make_ssa_name (tmp_u_var, NULL); - - cast = fold_convert_loc (loc, utype, info.index_expr); - cast_assign = gimple_build_assign (tmp_u_1, cast); - SSA_NAME_DEF_STMT (tmp_u_1) = cast_assign; - gsi_insert_before (&gsi, cast_assign, GSI_SAME_STMT); - update_stmt (cast_assign); - - ulb = fold_convert_loc (loc, utype, info.range_min); - minus = fold_build2_loc (loc, MINUS_EXPR, utype, tmp_u_1, ulb); - minus = force_gimple_operand_gsi (&gsi, minus, false, NULL, true, - GSI_SAME_STMT); - tmp_u_2 = make_ssa_name (tmp_u_var, NULL); - minus_assign = gimple_build_assign (tmp_u_2, minus); - SSA_NAME_DEF_STMT (tmp_u_2) = minus_assign; - gsi_insert_before (&gsi, minus_assign, GSI_SAME_STMT); - update_stmt (minus_assign); + gsi_next (&gsi); bound = fold_convert_loc (loc, utype, info.range_size); - cond_stmt = gimple_build_cond (LE_EXPR, tmp_u_2, bound, NULL_TREE, NULL_TREE); + cond_stmt = gimple_build_cond (LE_EXPR, tidx, bound, NULL_TREE, NULL_TREE); gsi_insert_before (&gsi, cond_stmt, GSI_SAME_STMT); update_stmt (cond_stmt); /* block 2 */ - gsi = gsi_for_stmt (info.arr_ref_first); label2 = gimple_build_label (label_decl2); gsi_insert_before (&gsi, label2, GSI_SAME_STMT); last_assign = gen_def_assigns (&gsi); /* block 1 */ - gsi = gsi_for_stmt (info.arr_ref_first); label1 = gimple_build_label (label_decl1); gsi_insert_before (&gsi, label1, GSI_SAME_STMT); diff -Naur gcc-4.6.0.orig/gcc/tree-tailcall.c gcc-4.6.0/gcc/tree-tailcall.c --- gcc-4.6.0.orig/gcc/tree-tailcall.c 2011-02-15 18:36:31.000000000 +0000 +++ gcc-4.6.0/gcc/tree-tailcall.c 2011-05-10 08:45:00.526163000 +0000 @@ -1019,6 +1019,14 @@ integer_one_node); } + if (a_acc || m_acc) + { + /* When the tail call elimination using accumulators is performed, + statements adding the accumulated value are inserted at all exits. + This turns all other tail calls to non-tail ones. */ + opt_tailcalls = false; + } + for (; tailcalls; tailcalls = next) { next = tailcalls->next; diff -Naur gcc-4.6.0.orig/gcc/tree-vect-data-refs.c gcc-4.6.0/gcc/tree-vect-data-refs.c --- gcc-4.6.0.orig/gcc/tree-vect-data-refs.c 2011-02-25 11:18:14.000000000 +0000 +++ gcc-4.6.0/gcc/tree-vect-data-refs.c 2011-04-08 11:45:29.006078000 +0000 @@ -1,5 +1,5 @@ /* Data References Analysis and Manipulation Utilities for Vectorization. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Dorit Naishlos and Ira Rosen @@ -1143,6 +1143,9 @@ if (ba) is_packed = contains_packed_reference (ba); + if (compare_tree_int (TYPE_SIZE (type), TYPE_ALIGN (type)) > 0) + is_packed = true; + if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "Unknown misalignment, is_packed = %d",is_packed); if (targetm.vectorize.vector_alignment_reachable (type, is_packed)) diff -Naur gcc-4.6.0.orig/gcc/tree-vect-stmts.c gcc-4.6.0/gcc/tree-vect-stmts.c --- gcc-4.6.0.orig/gcc/tree-vect-stmts.c 2011-02-25 11:18:14.000000000 +0000 +++ gcc-4.6.0/gcc/tree-vect-stmts.c 2011-04-18 07:38:11.502299000 +0000 @@ -2077,7 +2077,7 @@ VEC (tree, heap) *vec_oprnds0 = NULL, *vec_oprnds1 = NULL; tree vop0, vop1; unsigned int k; - bool scalar_shift_arg = false; + bool scalar_shift_arg = true; bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_info); int vf; @@ -2159,8 +2159,34 @@ /* Determine whether the shift amount is a vector, or scalar. If the shift/rotate amount is a vector, use the vector/vector shift optabs. */ + if (dt[1] == vect_internal_def && !slp_node) + scalar_shift_arg = false; + else if (dt[1] == vect_constant_def + || dt[1] == vect_external_def + || dt[1] == vect_internal_def) + { + /* In SLP, need to check whether the shift count is the same, + in loops if it is a constant or invariant, it is always + a scalar shift. */ + if (slp_node) + { + VEC (gimple, heap) *stmts = SLP_TREE_SCALAR_STMTS (slp_node); + gimple slpstmt; + + FOR_EACH_VEC_ELT (gimple, stmts, k, slpstmt) + if (!operand_equal_p (gimple_assign_rhs2 (slpstmt), op1, 0)) + scalar_shift_arg = false; + } + } + else + { + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "operand mode requires invariant argument."); + return false; + } + /* Vector shifted by vector. */ - if (dt[1] == vect_internal_def) + if (!scalar_shift_arg) { optab = optab_for_tree_code (code, vectype, optab_vector); if (vect_print_dump_info (REPORT_DETAILS)) @@ -2168,13 +2194,12 @@ } /* See if the machine has a vector shifted by scalar insn and if not then see if it has a vector shifted by vector insn. */ - else if (dt[1] == vect_constant_def || dt[1] == vect_external_def) + else { optab = optab_for_tree_code (code, vectype, optab_scalar); if (optab && optab_handler (optab, TYPE_MODE (vectype)) != CODE_FOR_nothing) { - scalar_shift_arg = true; if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "vector/scalar shift/rotate found."); } @@ -2185,6 +2210,8 @@ && (optab_handler (optab, TYPE_MODE (vectype)) != CODE_FOR_nothing)) { + scalar_shift_arg = false; + if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "vector/vector shift/rotate found."); @@ -2197,12 +2224,6 @@ } } } - else - { - if (vect_print_dump_info (REPORT_DETAILS)) - fprintf (vect_dump, "operand mode requires invariant argument."); - return false; - } /* Supportable by target? */ if (!optab) diff -Naur gcc-4.6.0.orig/gcc/tree-vrp.c gcc-4.6.0/gcc/tree-vrp.c --- gcc-4.6.0.orig/gcc/tree-vrp.c 2011-02-14 17:59:10.000000000 +0000 +++ gcc-4.6.0/gcc/tree-vrp.c 2011-03-28 10:14:34.889170000 +0000 @@ -6619,6 +6619,7 @@ edge; this helps us avoid an overflow infinity for conditionals which are not in a loop. */ if (edges > 0 + && gimple_phi_num_args (phi) > 1 && edges == old_edges) { int cmp_min = compare_values (lhs_vr->min, vr_result.min); diff -Naur gcc-4.6.0.orig/gcc/tree.c gcc-4.6.0/gcc/tree.c --- gcc-4.6.0.orig/gcc/tree.c 2011-03-14 12:20:48.000000000 +0000 +++ gcc-4.6.0/gcc/tree.c 2011-04-09 16:14:07.476963000 +0000 @@ -2453,6 +2453,10 @@ min = TYPE_MIN_VALUE (index_type); max = TYPE_MAX_VALUE (index_type); + /* TYPE_MAX_VALUE may not be set if the array has unknown length. */ + if (!max) + return error_mark_node; + return (integer_zerop (min) ? max : fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, min)); diff -Naur gcc-4.6.0.orig/gcc/var-tracking.c gcc-4.6.0/gcc/var-tracking.c --- gcc-4.6.0.orig/gcc/var-tracking.c 2011-03-07 22:11:55.000000000 +0000 +++ gcc-4.6.0/gcc/var-tracking.c 2011-05-12 11:59:32.631940000 +0000 @@ -739,6 +739,10 @@ case REG: if (cselib_lookup (*loc, GET_MODE (SUBREG_REG (subreg)), 0, VOIDmode)) return 1; + if (!validate_subreg (GET_MODE (subreg), GET_MODE (*loc), + *loc, subreg_lowpart_offset (GET_MODE (subreg), + GET_MODE (*loc)))) + return 1; return -1; case PLUS: case MINUS: @@ -4107,8 +4111,9 @@ VALUE_RECURSED_INTO (val) = true; for (node = var->var_part[0].loc_chain; node; node = node->next) - if (MEM_P (node->loc) && MEM_EXPR (node->loc) == expr - && MEM_OFFSET (node->loc) == 0) + if (MEM_P (node->loc) + && MEM_EXPR (node->loc) == expr + && INT_MEM_OFFSET (node->loc) == 0) { where = node; break; @@ -4171,11 +4176,10 @@ { for (loc = var->var_part[0].loc_chain; loc; loc = loc->next) { - /* We want to remove dying MEMs that doesn't refer to - DECL. */ + /* We want to remove dying MEMs that doesn't refer to DECL. */ if (GET_CODE (loc->loc) == MEM && (MEM_EXPR (loc->loc) != decl - || MEM_OFFSET (loc->loc)) + || INT_MEM_OFFSET (loc->loc) != 0) && !mem_dies_at_call (loc->loc)) break; /* We want to move here MEMs that do refer to DECL. */ @@ -4219,7 +4223,7 @@ if (GET_CODE (loc->loc) != MEM || (MEM_EXPR (loc->loc) == decl - && MEM_OFFSET (loc->loc) == 0) + && INT_MEM_OFFSET (loc->loc) == 0) || !mem_dies_at_call (loc->loc)) { if (old_loc != loc->loc && emit_notes) diff -Naur gcc-4.6.0.orig/gcc/version.c gcc-4.6.0/gcc/version.c --- gcc-4.6.0.orig/gcc/version.c 2009-04-21 19:03:23.000000000 +0000 +++ gcc-4.6.0/gcc/version.c 2011-05-17 15:39:45.833360914 +0000 @@ -33,4 +33,4 @@ Makefile. */ const char version_string[] = BASEVER DATESTAMP DEVPHASE REVISION; -const char pkgversion_string[] = PKGVERSION; +const char pkgversion_string[] = "(GCC for Cross-LFS 4.6.0.20110517) "; diff -Naur gcc-4.6.0.orig/libcpp/directives.c gcc-4.6.0/libcpp/directives.c --- gcc-4.6.0.orig/libcpp/directives.c 2011-01-04 23:18:12.000000000 +0000 +++ gcc-4.6.0/libcpp/directives.c 2011-04-28 22:39:59.485927000 +0000 @@ -1819,7 +1819,12 @@ if (node) { - skip = node->type != NT_MACRO; + /* Do not treat conditional macros as being defined. This is due to + the powerpc and spu ports using conditional macros for 'vector', + 'bool', and 'pixel' to act as conditional keywords. This messes + up tests like #ifndef bool. */ + skip = (node->type != NT_MACRO + || ((node->flags & NODE_CONDITIONAL) != 0)); _cpp_mark_macro_used (node); if (!(node->flags & NODE_USED)) { @@ -1860,7 +1865,12 @@ if (node) { - skip = node->type == NT_MACRO; + /* Do not treat conditional macros as being defined. This is due to + the powerpc and spu ports using conditional macros for 'vector', + 'bool', and 'pixel' to act as conditional keywords. This messes + up tests like #ifndef bool. */ + skip = (node->type == NT_MACRO + && ((node->flags & NODE_CONDITIONAL) == 0)); _cpp_mark_macro_used (node); if (!(node->flags & NODE_USED)) { diff -Naur gcc-4.6.0.orig/libcpp/expr.c gcc-4.6.0/libcpp/expr.c --- gcc-4.6.0.orig/libcpp/expr.c 2010-09-29 14:49:14.000000000 +0000 +++ gcc-4.6.0/libcpp/expr.c 2011-04-28 22:39:59.485927000 +0000 @@ -720,10 +720,15 @@ pfile->state.prevent_expansion--; + /* Do not treat conditional macros as being defined. This is due to the + powerpc and spu ports using conditional macros for 'vector', 'bool', and + 'pixel' to act as conditional keywords. This messes up tests like #ifndef + bool. */ result.unsignedp = false; result.high = 0; result.overflow = false; - result.low = node && node->type == NT_MACRO; + result.low = (node && node->type == NT_MACRO + && (node->flags & NODE_CONDITIONAL) == 0); return result; } diff -Naur gcc-4.6.0.orig/libcpp/lex.c gcc-4.6.0/libcpp/lex.c --- gcc-4.6.0.orig/libcpp/lex.c 2011-03-18 20:19:45.000000000 +0000 +++ gcc-4.6.0/libcpp/lex.c 2011-04-23 23:33:39.473034000 +0000 @@ -1410,7 +1410,9 @@ raw_prefix_len) == 0 && cur[raw_prefix_len+1] == '"') { - cur += raw_prefix_len+2; + BUF_APPEND (")", 1); + base++; + cur += raw_prefix_len + 2; goto break_outer_loop; } else diff -Naur gcc-4.6.0.orig/libffi/src/alpha/osf.S gcc-4.6.0/libffi/src/alpha/osf.S --- gcc-4.6.0.orig/libffi/src/alpha/osf.S 2009-06-04 15:43:03.000000000 +0000 +++ gcc-4.6.0/libffi/src/alpha/osf.S 2011-05-02 12:30:09.547483000 +0000 @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat + osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat Alpha/OSF Foreign Function Interface @@ -299,33 +299,51 @@ #endif #ifdef __ELF__ +# define UA_SI .4byte +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# define FDE_ENCODE(X) .4byte X-. +# define FDE_ARANGE(X) .4byte X +#elif defined __osf__ +# define UA_SI .align 0; .long +# define FDE_ENCODING 0x50 /* aligned absolute */ +# define FDE_ENCODE(X) .align 3; .quad X +# define FDE_ARANGE(X) .align 0; .quad X +#endif + +#ifdef __ELF__ .section .eh_frame,EH_FRAME_FLAGS,@progbits +#elif defined __osf__ + .data + .align 3 + .globl _GLOBAL__F_ffi_call_osf +_GLOBAL__F_ffi_call_osf: +#endif __FRAME_BEGIN__: - .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry + UA_SI $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: - .4byte 0x0 # CIE Identifier Tag + UA_SI 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor .byte 0x78 # sleb128 -8; CIE Data Alignment Factor .byte 26 # CIE RA Column .byte 0x1 # uleb128 0x1; Augmentation size - .byte 0x1b # FDE Encoding (pcrel sdata4) + .byte FDE_ENCODING # FDE Encoding .byte 0xc # DW_CFA_def_cfa .byte 30 # uleb128 column 30 .byte 0 # uleb128 offset 0 .align 3 $LECIE1: $LSFDE1: - .4byte $LEFDE1-$LASFDE1 # FDE Length + UA_SI $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: - .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB1-. # FDE initial location - .4byte $LFE1-$LFB1 # FDE address range + UA_SI $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB1) # FDE initial location + FDE_ARANGE($LFE1-$LFB1) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI1-$LFB1 + UA_SI $LCFI1-$LFB1 .byte 0x9a # DW_CFA_offset, column 26 .byte 4 # uleb128 4*-8 .byte 0x8f # DW_CFA_offset, column 15 @@ -335,32 +353,35 @@ .byte 32 # uleb128 offset 32 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI2-$LCFI1 + UA_SI $LCFI2-$LCFI1 .byte 0xda # DW_CFA_restore, column 26 .align 3 $LEFDE1: $LSFDE3: - .4byte $LEFDE3-$LASFDE3 # FDE Length + UA_SI $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: - .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB2-. # FDE initial location - .4byte $LFE2-$LFB2 # FDE address range + UA_SI $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB2) # FDE initial location + FDE_ARANGE($LFE2-$LFB2) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI5-$LFB2 + UA_SI $LCFI5-$LFB2 .byte 0xe # DW_CFA_def_cfa_offset .byte 0x80,0x1 # uleb128 128 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI6-$LCFI5 + UA_SI $LCFI6-$LCFI5 .byte 0x9a # DW_CFA_offset, column 26 .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: +#if defined __osf__ + .align 0 + .long 0 # End of Table +#endif -#ifdef __linux__ +#if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif -#endif diff -Naur gcc-4.6.0.orig/libgfortran/acinclude.m4 gcc-4.6.0/libgfortran/acinclude.m4 --- gcc-4.6.0.orig/libgfortran/acinclude.m4 2011-02-25 17:56:04.000000000 +0000 +++ gcc-4.6.0/libgfortran/acinclude.m4 2011-04-18 15:49:16.153371000 +0000 @@ -108,7 +108,7 @@ [Define to 1 if the target supports #pragma weak]) fi case "$host" in - *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) + *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | alpha*-dec-osf* ) AC_DEFINE(GTHREAD_USE_WEAK, 0, [Define to 0 if the target shouldn't use #pragma weak]) ;; diff -Naur gcc-4.6.0.orig/libgfortran/config.h.in gcc-4.6.0/libgfortran/config.h.in --- gcc-4.6.0.orig/libgfortran/config.h.in 2011-02-24 21:51:39.000000000 +0000 +++ gcc-4.6.0/libgfortran/config.h.in 2011-04-18 15:49:16.153371000 +0000 @@ -210,6 +210,9 @@ /* Define to 1 if you have the `clock_gettime' function. */ #undef HAVE_CLOCK_GETTIME +/* Define to 1 if you have the `clock_gettime' function in librt. */ +#undef HAVE_CLOCK_GETTIME_LIBRT + /* libm includes clog */ #undef HAVE_CLOG diff -Naur gcc-4.6.0.orig/libgfortran/configure gcc-4.6.0/libgfortran/configure --- gcc-4.6.0.orig/libgfortran/configure 2011-03-25 17:07:00.000000000 +0000 +++ gcc-4.6.0/libgfortran/configure 2011-04-18 15:49:16.153371000 +0000 @@ -757,6 +757,7 @@ enable_maintainer_mode enable_multilib enable_dependency_tracking +enable_symvers enable_shared enable_static with_pic @@ -1406,6 +1407,7 @@ --enable-multilib build many library versions (default) --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --disable-symvers disable symbol versioning for libgfortran --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] @@ -5564,14 +5566,22 @@ # Check for symbol versioning (copied from libssp). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symbol versioning is supported" >&5 $as_echo_n "checking whether symbol versioning is supported... " >&6; } -save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" -cat > conftest.map < conftest.map <conftest.$ac_ext @@ -5592,18 +5602,18 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext -if test x$gfortran_use_symver = xno; then - case "$target_os" in - solaris2*) - LDFLAGS="$save_LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map" - # Sun ld cannot handle wildcards and treats all entries as undefined. - cat > conftest.map < conftest.map <conftest.$ac_ext @@ -5624,10 +5634,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ;; - esac + ;; + esac + fi + LDFLAGS="$save_LDFLAGS" fi -LDFLAGS="$save_LDFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gfortran_use_symver" >&5 $as_echo "$gfortran_use_symver" >&6; } if test "x$gfortran_use_symver" != xno; then @@ -12101,7 +12112,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12104 "configure" +#line 12115 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12207,7 +12218,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12210 "configure" +#line 12221 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -25303,10 +25314,11 @@ fi -# At least for glibc, clock_gettime is in librt. But don't pull that -# in if it still doesn't give us the function we want. -# This test is copied from libgomp, and modified to not link in -lrt -# as libgfortran calls clock_gettime via a weak reference. +# At least for glibc and Tru64, clock_gettime is in librt. But don't +# pull that in if it still doesn't give us the function we want. This +# test is copied from libgomp, and modified to not link in -lrt as +# libgfortran calls clock_gettime via a weak reference if it's found +# in librt. if test $ac_cv_func_clock_gettime = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for clock_gettime in -lrt" >&5 $as_echo_n "checking for clock_gettime in -lrt... " >&6; } @@ -25349,7 +25361,7 @@ $as_echo "$ac_cv_lib_rt_clock_gettime" >&6; } if test "x$ac_cv_lib_rt_clock_gettime" = x""yes; then : -$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h +$as_echo "#define HAVE_CLOCK_GETTIME_LIBRT 1" >>confdefs.h fi @@ -25687,7 +25699,7 @@ fi case "$host" in - *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* ) + *-*-darwin* | *-*-hpux* | *-*-cygwin* | *-*-mingw* | alpha*-dec-osf* ) $as_echo "#define GTHREAD_USE_WEAK 0" >>confdefs.h diff -Naur gcc-4.6.0.orig/libgfortran/configure.ac gcc-4.6.0/libgfortran/configure.ac --- gcc-4.6.0.orig/libgfortran/configure.ac 2011-02-24 21:51:39.000000000 +0000 +++ gcc-4.6.0/libgfortran/configure.ac 2011-04-18 15:49:16.153371000 +0000 @@ -144,30 +144,37 @@ # Check for symbol versioning (copied from libssp). AC_MSG_CHECKING([whether symbol versioning is supported]) -save_LDFLAGS="$LDFLAGS" -LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" -cat > conftest.map < conftest.map < conftest.map < conftest.map <u.p.current_unit->pad_status == PAD_NO || is_internal_unit (dtp)) && dtp->u.p.current_unit->bytes_left < n) @@ -1131,7 +1130,7 @@ if (is_internal_unit (dtp)) { - p = mem_alloc_r (dtp->u.p.current_unit->s, &length); + mem_alloc_r (dtp->u.p.current_unit->s, &length); if (unlikely (length < n)) n = length; goto done; @@ -1140,55 +1139,37 @@ if (dtp->u.p.sf_seen_eor) return; - p = fbuf_read (dtp->u.p.current_unit, &length); - if (p == NULL) - { - hit_eof (dtp); - return; - } - - if (length == 0 && dtp->u.p.item_count == 1) - { - if (dtp->u.p.current_unit->pad_status == PAD_NO) - { - hit_eof (dtp); - return; - } - else - return; - } - n = 0; while (n < length) { - q = *p; - if (q == '\n' || q == '\r') + q = fbuf_getc (dtp->u.p.current_unit); + if (q == EOF) + break; + else if (q == '\n' || q == '\r') { /* Unexpected end of line. Set the position. */ - fbuf_seek (dtp->u.p.current_unit, n + 1 ,SEEK_CUR); dtp->u.p.sf_seen_eor = 1; + /* If we see an EOR during non-advancing I/O, we need to skip + the rest of the I/O statement. Set the corresponding flag. */ + if (dtp->u.p.advance_status == ADVANCE_NO || dtp->u.p.seen_dollar) + dtp->u.p.eor_condition = 1; + /* If we encounter a CR, it might be a CRLF. */ if (q == '\r') /* Probably a CRLF */ { - /* See if there is an LF. Use fbuf_read rather then fbuf_getc so - the position is not advanced unless it really is an LF. */ - int readlen = 1; - p = fbuf_read (dtp->u.p.current_unit, &readlen); - if (*p == '\n' && readlen == 1) - { - dtp->u.p.sf_seen_eor = 2; - fbuf_seek (dtp->u.p.current_unit, 1 ,SEEK_CUR); - } + /* See if there is an LF. */ + q2 = fbuf_getc (dtp->u.p.current_unit); + if (q2 == '\n') + dtp->u.p.sf_seen_eor = 2; + else if (q2 != EOF) /* Oops, seek back. */ + fbuf_seek (dtp->u.p.current_unit, -1, SEEK_CUR); } goto done; } n++; - p++; } - fbuf_seek (dtp->u.p.current_unit, n, SEEK_CUR); - done: if ((dtp->common.flags & IOPARM_DT_HAS_SIZE) != 0) dtp->u.p.size_used += (GFC_IO_INT) n; diff -Naur gcc-4.6.0.orig/libgomp/acinclude.m4 gcc-4.6.0/libgomp/acinclude.m4 --- gcc-4.6.0.orig/libgomp/acinclude.m4 2011-01-20 23:41:24.000000000 +0000 +++ gcc-4.6.0/libgomp/acinclude.m4 2011-03-28 17:09:27.398261000 +0000 @@ -228,20 +228,24 @@ # If we never went through the LIBGOMP_CHECK_LINKER_FEATURES macro, then we # don't know enough about $LD to do tricks... AC_REQUIRE([LIBGOMP_CHECK_LINKER_FEATURES]) -# FIXME The following test is too strict, in theory. -if test $enable_shared = no || test "x$LD" = x; then - enable_symvers=no -else - if test $with_gnu_ld = yes ; then - enable_symvers=gnu + +# Turn a 'yes' into a suitable default. +if test x$enable_symvers = xyes ; then + # FIXME The following test is too strict, in theory. + if test $enable_shared = no || test "x$LD" = x; then + enable_symvers=no else - case ${target_os} in - # Sun symbol versioning exists since Solaris 2.5. - solaris2.[[5-9]]* | solaris2.1[[0-9]]*) - enable_symvers=sun ;; - *) - enable_symvers=no ;; - esac + if test $with_gnu_ld = yes ; then + enable_symvers=gnu + else + case ${target_os} in + # Sun symbol versioning exists since Solaris 2.5. + solaris2.[[5-9]]* | solaris2.1[[0-9]]*) + enable_symvers=sun ;; + *) + enable_symvers=no ;; + esac + fi fi fi diff -Naur gcc-4.6.0.orig/libgomp/configure gcc-4.6.0/libgomp/configure --- gcc-4.6.0.orig/libgomp/configure 2011-02-13 11:45:53.000000000 +0000 +++ gcc-4.6.0/libgomp/configure 2011-03-28 17:09:27.398261000 +0000 @@ -15780,20 +15780,24 @@ # If we never went through the LIBGOMP_CHECK_LINKER_FEATURES macro, then we # don't know enough about $LD to do tricks... -# FIXME The following test is too strict, in theory. -if test $enable_shared = no || test "x$LD" = x; then - enable_symvers=no -else - if test $with_gnu_ld = yes ; then - enable_symvers=gnu + +# Turn a 'yes' into a suitable default. +if test x$enable_symvers = xyes ; then + # FIXME The following test is too strict, in theory. + if test $enable_shared = no || test "x$LD" = x; then + enable_symvers=no else - case ${target_os} in - # Sun symbol versioning exists since Solaris 2.5. - solaris2.[5-9]* | solaris2.1[0-9]*) - enable_symvers=sun ;; - *) - enable_symvers=no ;; - esac + if test $with_gnu_ld = yes ; then + enable_symvers=gnu + else + case ${target_os} in + # Sun symbol versioning exists since Solaris 2.5. + solaris2.[5-9]* | solaris2.1[0-9]*) + enable_symvers=sun ;; + *) + enable_symvers=no ;; + esac + fi fi fi diff -Naur gcc-4.6.0.orig/libgomp/fortran.c gcc-4.6.0/libgomp/fortran.c --- gcc-4.6.0.orig/libgomp/fortran.c 2009-04-09 15:00:19.000000000 +0000 +++ gcc-4.6.0/libgomp/fortran.c 2011-05-06 10:11:59.254047000 +0000 @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. +/* Copyright (C) 2005, 2007, 2008, 2009, 2011 Free Software Foundation, Inc. Contributed by Jakub Jelinek . This file is part of the GNU OpenMP Library (libgomp). @@ -27,6 +27,7 @@ #include "libgomp.h" #include "libgomp_f.h" #include +#include #ifdef HAVE_ATTRIBUTE_ALIAS /* Use internal aliases if possible. */ @@ -244,6 +245,8 @@ omp_lock_symver (omp_test_nest_lock_) #endif +#define TO_INT(x) ((x) > INT_MIN ? (x) < INT_MAX ? (x) : INT_MAX : INT_MIN) + void omp_set_dynamic_ (const int32_t *set) { @@ -253,7 +256,7 @@ void omp_set_dynamic_8_ (const int64_t *set) { - omp_set_dynamic (*set); + omp_set_dynamic (!!*set); } void @@ -265,7 +268,7 @@ void omp_set_nested_8_ (const int64_t *set) { - omp_set_nested (*set); + omp_set_nested (!!*set); } void @@ -277,7 +280,7 @@ void omp_set_num_threads_8_ (const int64_t *set) { - omp_set_num_threads (*set); + omp_set_num_threads (TO_INT (*set)); } int32_t @@ -343,7 +346,7 @@ void omp_set_schedule_8_ (const int32_t *kind, const int64_t *modifier) { - omp_set_schedule (*kind, *modifier); + omp_set_schedule (*kind, TO_INT (*modifier)); } void @@ -381,7 +384,7 @@ void omp_set_max_active_levels_8_ (const int64_t *levels) { - omp_set_max_active_levels (*levels); + omp_set_max_active_levels (TO_INT (*levels)); } int32_t @@ -405,7 +408,7 @@ int32_t omp_get_ancestor_thread_num_8_ (const int64_t *level) { - return omp_get_ancestor_thread_num (*level); + return omp_get_ancestor_thread_num (TO_INT (*level)); } int32_t @@ -417,7 +420,7 @@ int32_t omp_get_team_size_8_ (const int64_t *level) { - return omp_get_team_size (*level); + return omp_get_team_size (TO_INT (*level)); } int32_t diff -Naur gcc-4.6.0.orig/libgomp/testsuite/libgomp.c/pr48591.c gcc-4.6.0/libgomp/testsuite/libgomp.c/pr48591.c --- gcc-4.6.0.orig/libgomp/testsuite/libgomp.c/pr48591.c 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/libgomp/testsuite/libgomp.c/pr48591.c 2011-04-13 15:52:17.795243000 +0000 @@ -0,0 +1,22 @@ +/* PR middle-end/48591 */ +/* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* } } */ +/* { dg-options "-fopenmp" } */ + +extern void abort (void); + +int +main () +{ + __float128 f = 0.0; + int i; + #pragma omp parallel for reduction(+:f) + for (i = 0; i < 128; i++) + f += 0.5Q; + if (f != 64.0Q) + abort (); + #pragma omp atomic + f += 8.5Q; + if (f != 72.5Q) + abort (); + return 0; +} diff -Naur gcc-4.6.0.orig/libgomp/testsuite/libgomp.fortran/pr48894.f90 gcc-4.6.0/libgomp/testsuite/libgomp.fortran/pr48894.f90 --- gcc-4.6.0.orig/libgomp/testsuite/libgomp.fortran/pr48894.f90 1970-01-01 00:00:00.000000000 +0000 +++ gcc-4.6.0/libgomp/testsuite/libgomp.fortran/pr48894.f90 2011-05-06 10:11:59.254047000 +0000 @@ -0,0 +1,23 @@ +! PR fortran/48894 +! { dg-do run } +! { dg-options "-fdefault-integer-8" } + + use omp_lib + integer, parameter :: zero = 0 + integer :: err + logical :: l + err = 0 + !$omp parallel + !$omp parallel private (l) + l = omp_get_ancestor_thread_num (-HUGE (zero)) .ne. -1 + l = l .or. (omp_get_ancestor_thread_num (HUGE (zero)) .ne. -1) + l = l .or. (omp_get_team_size (-HUGE (zero)) .ne. -1) + l = l .or. (omp_get_team_size (HUGE (zero)) .ne. -1) + if (l) then + !$omp atomic + err = err + 1 + endif + !$omp end parallel + !$omp end parallel + if (err .ne. 0) call abort +end diff -Naur gcc-4.6.0.orig/libjava/configure gcc-4.6.0/libjava/configure --- gcc-4.6.0.orig/libjava/configure 2011-03-25 17:07:00.000000000 +0000 +++ gcc-4.6.0/libjava/configure 2011-03-28 17:09:27.398261000 +0000 @@ -959,6 +959,7 @@ with_libiconv_prefix enable_tls with_system_libunwind +enable_symvers with_python_dir enable_aot_compile_rpm enable_java_home @@ -1648,6 +1649,7 @@ --enable-java-gc=TYPE choose garbage collector (default is boehm) --disable-rpath do not hardcode runtime library paths --enable-tls Use thread-local storage [default=yes] + --disable-symvers disable symbol versioning for libjava --enable-aot-compile-rpm enable installation of aot-compile-rpm [default=no] --enable-java-home create a standard JDK-style directory layout in the @@ -13344,7 +13346,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 13347 "configure" +#line 13349 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13450,7 +13452,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 13453 "configure" +#line 13455 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19443,7 +19445,7 @@ enableval=$enable_sjlj_exceptions; : else cat > conftest.$ac_ext << EOF -#line 19446 "configure" +#line 19448 "configure" struct S { ~S(); }; void bar(); void foo() @@ -24530,12 +24532,24 @@ if test "${libjava_cv_anon_version_script+set}" = set; then : $as_echo_n "(cached) " >&6 else - save_CFLAGS="$CFLAGS"; save_LDFLAGS="$LDFLAGS" - libjava_cv_anon_version_script=no - CFLAGS="$CFLAGS -fPIC"; - LDFLAGS="$LDFLAGS -shared -Wl,--version-script,conftest.map" - echo '{ global: globalsymb*; local: *; };' > conftest.map - if test x$gcc_no_link = xyes; then + # Check whether --enable-symvers was given. +if test "${enable_symvers+set}" = set; then : + enableval=$enable_symvers; case "$enableval" in + yes) libjava_cv_anon_version_script=yes ;; + no) libjava_cv_anon_version_script=no ;; + *) as_fn_error "Unknown argument to enable/disable symvers" "$LINENO" 5;; + esac +else + libjava_cv_anon_version_script=yes + +fi + + if test x$libjava_cv_anon_version_script = xyes; then + save_CFLAGS="$CFLAGS"; save_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS -fPIC"; + LDFLAGS="$LDFLAGS -shared -Wl,--version-script,conftest.map" + echo '{ global: globalsymb*; local: *; };' > conftest.map + if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24551,17 +24565,19 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : libjava_cv_anon_version_script=gnu +else + libjava_cv_anon_version_script=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test x$libjava_cv_anon_version_script = xno; then - case "$target_os" in - solaris2*) - LDFLAGS="$save_LDFLAGS" - LDFLAGS="$LDFLAGS -shared -Wl,-M,conftest.map" - # Sun ld doesn't understand wildcards here. - echo '{ global: globalsymbol; local: *; };' > conftest.map - if test x$gcc_no_link = xyes; then + if test x$libjava_cv_anon_version_script = xno; then + case "$target_os" in + solaris2*) + LDFLAGS="$save_LDFLAGS" + LDFLAGS="$LDFLAGS -shared -Wl,-M,conftest.map" + # Sun ld doesn't understand wildcards here. + echo '{ global: globalsymbol; local: *; };' > conftest.map + if test x$gcc_no_link = xyes; then as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5 fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -24580,10 +24596,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ;; - esac + ;; + esac + fi + CFLAGS="$save_CFLAGS"; LDFLAGS="$save_LDFLAGS" fi - CFLAGS="$save_CFLAGS"; LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libjava_cv_anon_version_script" >&5 diff -Naur gcc-4.6.0.orig/libjava/configure.ac gcc-4.6.0/libjava/configure.ac --- gcc-4.6.0.orig/libjava/configure.ac 2011-02-14 14:28:00.000000000 +0000 +++ gcc-4.6.0/libjava/configure.ac 2011-03-28 17:09:27.398261000 +0000 @@ -1800,26 +1800,38 @@ # See if linker supports anonymous version scripts. AC_CACHE_CHECK([whether ld supports anonymous version scripts], [libjava_cv_anon_version_script], - [save_CFLAGS="$CFLAGS"; save_LDFLAGS="$LDFLAGS" - libjava_cv_anon_version_script=no - CFLAGS="$CFLAGS -fPIC"; - LDFLAGS="$LDFLAGS -shared -Wl,--version-script,conftest.map" - echo '{ global: globalsymb*; local: *; };' > conftest.map - AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},, - [libjava_cv_anon_version_script=gnu], []) - if test x$libjava_cv_anon_version_script = xno; then - case "$target_os" in - solaris2*) - LDFLAGS="$save_LDFLAGS" - LDFLAGS="$LDFLAGS -shared -Wl,-M,conftest.map" - # Sun ld doesn't understand wildcards here. - echo '{ global: globalsymbol; local: *; };' > conftest.map - AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},, - [libjava_cv_anon_version_script=sun], []) - ;; - esac + [AC_ARG_ENABLE(symvers, + AS_HELP_STRING([--disable-symvers], + [disable symbol versioning for libjava]), + [case "$enableval" in + yes) libjava_cv_anon_version_script=yes ;; + no) libjava_cv_anon_version_script=no ;; + *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]);; + esac], + [libjava_cv_anon_version_script=yes] + ) + if test x$libjava_cv_anon_version_script = xyes; then + save_CFLAGS="$CFLAGS"; save_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS -fPIC"; + LDFLAGS="$LDFLAGS -shared -Wl,--version-script,conftest.map" + echo '{ global: globalsymb*; local: *; };' > conftest.map + AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},, + [libjava_cv_anon_version_script=gnu], + [libjava_cv_anon_version_script=no]) + if test x$libjava_cv_anon_version_script = xno; then + case "$target_os" in + solaris2*) + LDFLAGS="$save_LDFLAGS" + LDFLAGS="$LDFLAGS -shared -Wl,-M,conftest.map" + # Sun ld doesn't understand wildcards here. + echo '{ global: globalsymbol; local: *; };' > conftest.map + AC_TRY_LINK(void globalsymbol (void) {} void localsymbol (void) {},, + [libjava_cv_anon_version_script=sun], []) + ;; + esac + fi + CFLAGS="$save_CFLAGS"; LDFLAGS="$save_LDFLAGS" fi - CFLAGS="$save_CFLAGS"; LDFLAGS="$save_LDFLAGS" ]) AM_CONDITIONAL(ANONVERSCRIPT, test "$libjava_cv_anon_version_script" != no) AM_CONDITIONAL(ANONVERSCRIPT_GNU, test "$libjava_cv_anon_version_script" = gnu) diff -Naur gcc-4.6.0.orig/libjava/testsuite/libjava.jni/jni.exp gcc-4.6.0/libjava/testsuite/libjava.jni/jni.exp --- gcc-4.6.0.orig/libjava/testsuite/libjava.jni/jni.exp 2011-01-06 18:56:58.000000000 +0000 +++ gcc-4.6.0/libjava/testsuite/libjava.jni/jni.exp 2011-04-15 17:17:18.420139000 +0000 @@ -280,6 +280,11 @@ lappend cxxflags "-shared-libgcc" } + # Tru64 UNIX needs -liconv linked explicitly since gcc does the linking. + if { [istarget "alpha*-dec-osf*"] } { + lappend cxxflags $libiconv + } + return $cxxflags } diff -Naur gcc-4.6.0.orig/libquadmath/configure gcc-4.6.0/libquadmath/configure --- gcc-4.6.0.orig/libquadmath/configure 2011-02-17 19:57:18.000000000 +0000 +++ gcc-4.6.0/libquadmath/configure 2011-03-28 17:09:27.398261000 +0000 @@ -747,6 +747,7 @@ enable_libtool_lock enable_maintainer_mode enable_multilib +enable_symvers enable_generated_files_in_srcdir ' ac_precious_vars='build_alias @@ -1391,6 +1392,7 @@ --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --enable-multilib build many library versions (default) + --disable-symvers disable symbol versioning for libquadmath --enable-generated-files-in-srcdir put copies of generated files in source dir intended for creating source tarballs for users without @@ -10511,7 +10513,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10514 "configure" +#line 10516 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10617,7 +10619,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10620 "configure" +#line 10622 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12339,19 +12341,27 @@ # Check for symbol versioning (copied from libssp). { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symbol versioning is supported" >&5 $as_echo_n "checking whether symbol versioning is supported... " >&6; } -if test x$gcc_no_link = xyes; then - # If we cannot link, we cannot build shared libraries, so do not use - # symbol versioning. - quadmath_use_symver=no +# Check whether --enable-symvers was given. +if test "${enable_symvers+set}" = set; then : + enableval=$enable_symvers; quadmath_use_symver=$enableval else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" - cat > conftest.map < conftest.map <conftest.$ac_ext @@ -12372,18 +12382,18 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test x$quadmath_use_symver = xno; then - case "$target_os" in - solaris2*) - LDFLAGS="$save_LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map" - # Sun ld cannot handle wildcards and treats all entries as undefined. - cat > conftest.map < conftest.map <conftest.$ac_ext @@ -12404,10 +12414,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ;; - esac + ;; + esac + fi + LDFLAGS="$save_LDFLAGS" fi - LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $quadmath_use_symver" >&5 $as_echo "$quadmath_use_symver" >&6; } diff -Naur gcc-4.6.0.orig/libquadmath/configure.ac gcc-4.6.0/libquadmath/configure.ac --- gcc-4.6.0.orig/libquadmath/configure.ac 2011-02-17 19:57:18.000000000 +0000 +++ gcc-4.6.0/libquadmath/configure.ac 2011-03-28 17:09:27.398261000 +0000 @@ -164,35 +164,42 @@ # Check for symbol versioning (copied from libssp). AC_MSG_CHECKING([whether symbol versioning is supported]) -if test x$gcc_no_link = xyes; then - # If we cannot link, we cannot build shared libraries, so do not use - # symbol versioning. - quadmath_use_symver=no -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" - cat > conftest.map < conftest.map < conftest.map < conftest.map < - - int main () - { - __float128 r; - - r = strtoflt128 ("1.2345678", NULL); - - return 0; - } - - -File: libquadmath.info, Node: quadmath_snprintf, Prev: strtoflt128, Up: I/O Library Routines - -3.2 `quadmath_snprintf' -- Convert to string -============================================ - -The function `quadmath_snprintf' converts a `__float128' floating-point -number into a string. It is a specialized alternative to `snprintf', -where the format string is restricted to a single conversion specifier -with `Q' modifier and conversion specifier `e', `E', `f', `F', `g', -`G', `a' or `A', with no extra characters before or after the -conversion specifier. The `%m$' or `*m$' style must not be used in the -format. - -Syntax - `int quadmath_snprintf (char *s, size_t size, const char *format, - ...)' - -_Arguments_: - S output string - SIZE byte size of the string, including tailing NUL - FORMAT conversion specifier string - -Example - #include - #include - #include - - int main () - { - __float128 r; - int prec = 20; - int width = 46; - char buf[128]; - - r = 2.0q; - r = sqrtq (r); - int n = quadmath_snprintf (buf, sizeof buf, "%+-#*.20Qe", width, r); - if ((size_t) n < sizeof buf) - printf ("%s\n", buf); - /* Prints: +1.41421356237309504880e+00 */ - quadmath_snprintf (buf, sizeof buf, "%Qa", r); - if ((size_t) n < sizeof buf) - printf ("%s\n", buf); - /* Prints: 0x1.6a09e667f3bcc908b2fb1366ea96p+0 */ - n = quadmath_snprintf (NULL, 0, "%+-#46.*Qe", prec, r); - if (n > -1) - { - char *str = malloc (n + 1); - if (str) - { - quadmath_snprintf (str, n + 1, "%+-#46.*Qe", prec, r); - printf ("%s\n", str); - /* Prints: +1.41421356237309504880e+00 */ - } - free (str); - } - return 0; - } - - - On some targets when supported by the C library hooks are installed -for `printf' family of functions, so that `printf ("%Qe", 1.2Q);' etc. -works too. - - -File: libquadmath.info, Node: GNU Free Documentation License, Next: Reporting Bugs, Prev: I/O Library Routines, Up: Top - -GNU Free Documentation License -****************************** - - Version 1.3, 3 November 2008 - - Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. - `http://fsf.org/' - - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - 0. PREAMBLE - - The purpose of this License is to make a manual, textbook, or other - functional and useful document "free" in the sense of freedom: to - assure everyone the effective freedom to copy and redistribute it, - with or without modifying it, either commercially or - noncommercially. Secondarily, this License preserves for the - author and publisher a way to get credit for their work, while not - being considered responsible for modifications made by others. - - This License is a kind of "copyleft", which means that derivative - works of the document must themselves be free in the same sense. - It complements the GNU General Public License, which is a copyleft - license designed for free software. - - We have designed this License in order to use it for manuals for - free software, because free software needs free documentation: a - free program should come with manuals providing the same freedoms - that the software does. But this License is not limited to - software manuals; it can be used for any textual work, regardless - of subject matter or whether it is published as a printed book. - We recommend this License principally for works whose purpose is - instruction or reference. - - 1. APPLICABILITY AND DEFINITIONS - - This License applies to any manual or other work, in any medium, - that contains a notice placed by the copyright holder saying it - can be distributed under the terms of this License. Such a notice - grants a world-wide, royalty-free license, unlimited in duration, - to use that work under the conditions stated herein. The - "Document", below, refers to any such manual or work. Any member - of the public is a licensee, and is addressed as "you". You - accept the license if you copy, modify or distribute the work in a - way requiring permission under copyright law. - - A "Modified Version" of the Document means any work containing the - Document or a portion of it, either copied verbatim, or with - modifications and/or translated into another language. - - A "Secondary Section" is a named appendix or a front-matter section - of the Document that deals exclusively with the relationship of the - publishers or authors of the Document to the Document's overall - subject (or to related matters) and contains nothing that could - fall directly within that overall subject. (Thus, if the Document - is in part a textbook of mathematics, a Secondary Section may not - explain any mathematics.) The relationship could be a matter of - historical connection with the subject or with related matters, or - of legal, commercial, philosophical, ethical or political position - regarding them. - - The "Invariant Sections" are certain Secondary Sections whose - titles are designated, as being those of Invariant Sections, in - the notice that says that the Document is released under this - License. If a section does not fit the above definition of - Secondary then it is not allowed to be designated as Invariant. - The Document may contain zero Invariant Sections. If the Document - does not identify any Invariant Sections then there are none. - - The "Cover Texts" are certain short passages of text that are - listed, as Front-Cover Texts or Back-Cover Texts, in the notice - that says that the Document is released under this License. A - Front-Cover Text may be at most 5 words, and a Back-Cover Text may - be at most 25 words. - - A "Transparent" copy of the Document means a machine-readable copy, - represented in a format whose specification is available to the - general public, that is suitable for revising the document - straightforwardly with generic text editors or (for images - composed of pixels) generic paint programs or (for drawings) some - widely available drawing editor, and that is suitable for input to - text formatters or for automatic translation to a variety of - formats suitable for input to text formatters. A copy made in an - otherwise Transparent file format whose markup, or absence of - markup, has been arranged to thwart or discourage subsequent - modification by readers is not Transparent. An image format is - not Transparent if used for any substantial amount of text. A - copy that is not "Transparent" is called "Opaque". - - Examples of suitable formats for Transparent copies include plain - ASCII without markup, Texinfo input format, LaTeX input format, - SGML or XML using a publicly available DTD, and - standard-conforming simple HTML, PostScript or PDF designed for - human modification. Examples of transparent image formats include - PNG, XCF and JPG. Opaque formats include proprietary formats that - can be read and edited only by proprietary word processors, SGML or - XML for which the DTD and/or processing tools are not generally - available, and the machine-generated HTML, PostScript or PDF - produced by some word processors for output purposes only. - - The "Title Page" means, for a printed book, the title page itself, - plus such following pages as are needed to hold, legibly, the - material this License requires to appear in the title page. For - works in formats which do not have any title page as such, "Title - Page" means the text near the most prominent appearance of the - work's title, preceding the beginning of the body of the text. - - The "publisher" means any person or entity that distributes copies - of the Document to the public. - - A section "Entitled XYZ" means a named subunit of the Document - whose title either is precisely XYZ or contains XYZ in parentheses - following text that translates XYZ in another language. (Here XYZ - stands for a specific section name mentioned below, such as - "Acknowledgements", "Dedications", "Endorsements", or "History".) - To "Preserve the Title" of such a section when you modify the - Document means that it remains a section "Entitled XYZ" according - to this definition. - - The Document may include Warranty Disclaimers next to the notice - which states that this License applies to the Document. These - Warranty Disclaimers are considered to be included by reference in - this License, but only as regards disclaiming warranties: any other - implication that these Warranty Disclaimers may have is void and - has no effect on the meaning of this License. - - 2. VERBATIM COPYING - - You may copy and distribute the Document in any medium, either - commercially or noncommercially, provided that this License, the - copyright notices, and the license notice saying this License - applies to the Document are reproduced in all copies, and that you - add no other conditions whatsoever to those of this License. You - may not use technical measures to obstruct or control the reading - or further copying of the copies you make or distribute. However, - you may accept compensation in exchange for copies. If you - distribute a large enough number of copies you must also follow - the conditions in section 3. - - You may also lend copies, under the same conditions stated above, - and you may publicly display copies. - - 3. COPYING IN QUANTITY - - If you publish printed copies (or copies in media that commonly - have printed covers) of the Document, numbering more than 100, and - the Document's license notice requires Cover Texts, you must - enclose the copies in covers that carry, clearly and legibly, all - these Cover Texts: Front-Cover Texts on the front cover, and - Back-Cover Texts on the back cover. Both covers must also clearly - and legibly identify you as the publisher of these copies. The - front cover must present the full title with all words of the - title equally prominent and visible. You may add other material - on the covers in addition. Copying with changes limited to the - covers, as long as they preserve the title of the Document and - satisfy these conditions, can be treated as verbatim copying in - other respects. - - If the required texts for either cover are too voluminous to fit - legibly, you should put the first ones listed (as many as fit - reasonably) on the actual cover, and continue the rest onto - adjacent pages. - - If you publish or distribute Opaque copies of the Document - numbering more than 100, you must either include a - machine-readable Transparent copy along with each Opaque copy, or - state in or with each Opaque copy a computer-network location from - which the general network-using public has access to download - using public-standard network protocols a complete Transparent - copy of the Document, free of added material. If you use the - latter option, you must take reasonably prudent steps, when you - begin distribution of Opaque copies in quantity, to ensure that - this Transparent copy will remain thus accessible at the stated - location until at least one year after the last time you - distribute an Opaque copy (directly or through your agents or - retailers) of that edition to the public. - - It is requested, but not required, that you contact the authors of - the Document well before redistributing any large number of - copies, to give them a chance to provide you with an updated - version of the Document. - - 4. MODIFICATIONS - - You may copy and distribute a Modified Version of the Document - under the conditions of sections 2 and 3 above, provided that you - release the Modified Version under precisely this License, with - the Modified Version filling the role of the Document, thus - licensing distribution and modification of the Modified Version to - whoever possesses a copy of it. In addition, you must do these - things in the Modified Version: - - A. Use in the Title Page (and on the covers, if any) a title - distinct from that of the Document, and from those of - previous versions (which should, if there were any, be listed - in the History section of the Document). You may use the - same title as a previous version if the original publisher of - that version gives permission. - - B. List on the Title Page, as authors, one or more persons or - entities responsible for authorship of the modifications in - the Modified Version, together with at least five of the - principal authors of the Document (all of its principal - authors, if it has fewer than five), unless they release you - from this requirement. - - C. State on the Title page the name of the publisher of the - Modified Version, as the publisher. - - D. Preserve all the copyright notices of the Document. - - E. Add an appropriate copyright notice for your modifications - adjacent to the other copyright notices. - - F. Include, immediately after the copyright notices, a license - notice giving the public permission to use the Modified - Version under the terms of this License, in the form shown in - the Addendum below. - - G. Preserve in that license notice the full lists of Invariant - Sections and required Cover Texts given in the Document's - license notice. - - H. Include an unaltered copy of this License. - - I. Preserve the section Entitled "History", Preserve its Title, - and add to it an item stating at least the title, year, new - authors, and publisher of the Modified Version as given on - the Title Page. If there is no section Entitled "History" in - the Document, create one stating the title, year, authors, - and publisher of the Document as given on its Title Page, - then add an item describing the Modified Version as stated in - the previous sentence. - - J. Preserve the network location, if any, given in the Document - for public access to a Transparent copy of the Document, and - likewise the network locations given in the Document for - previous versions it was based on. These may be placed in - the "History" section. You may omit a network location for a - work that was published at least four years before the - Document itself, or if the original publisher of the version - it refers to gives permission. - - K. For any section Entitled "Acknowledgements" or "Dedications", - Preserve the Title of the section, and preserve in the - section all the substance and tone of each of the contributor - acknowledgements and/or dedications given therein. - - L. Preserve all the Invariant Sections of the Document, - unaltered in their text and in their titles. Section numbers - or the equivalent are not considered part of the section - titles. - - M. Delete any section Entitled "Endorsements". Such a section - may not be included in the Modified Version. - - N. Do not retitle any existing section to be Entitled - "Endorsements" or to conflict in title with any Invariant - Section. - - O. Preserve any Warranty Disclaimers. - - If the Modified Version includes new front-matter sections or - appendices that qualify as Secondary Sections and contain no - material copied from the Document, you may at your option - designate some or all of these sections as invariant. To do this, - add their titles to the list of Invariant Sections in the Modified - Version's license notice. These titles must be distinct from any - other section titles. - - You may add a section Entitled "Endorsements", provided it contains - nothing but endorsements of your Modified Version by various - parties--for example, statements of peer review or that the text - has been approved by an organization as the authoritative - definition of a standard. - - You may add a passage of up to five words as a Front-Cover Text, - and a passage of up to 25 words as a Back-Cover Text, to the end - of the list of Cover Texts in the Modified Version. Only one - passage of Front-Cover Text and one of Back-Cover Text may be - added by (or through arrangements made by) any one entity. If the - Document already includes a cover text for the same cover, - previously added by you or by arrangement made by the same entity - you are acting on behalf of, you may not add another; but you may - replace the old one, on explicit permission from the previous - publisher that added the old one. - - The author(s) and publisher(s) of the Document do not by this - License give permission to use their names for publicity for or to - assert or imply endorsement of any Modified Version. - - 5. COMBINING DOCUMENTS - - You may combine the Document with other documents released under - this License, under the terms defined in section 4 above for - modified versions, provided that you include in the combination - all of the Invariant Sections of all of the original documents, - unmodified, and list them all as Invariant Sections of your - combined work in its license notice, and that you preserve all - their Warranty Disclaimers. - - The combined work need only contain one copy of this License, and - multiple identical Invariant Sections may be replaced with a single - copy. If there are multiple Invariant Sections with the same name - but different contents, make the title of each such section unique - by adding at the end of it, in parentheses, the name of the - original author or publisher of that section if known, or else a - unique number. Make the same adjustment to the section titles in - the list of Invariant Sections in the license notice of the - combined work. - - In the combination, you must combine any sections Entitled - "History" in the various original documents, forming one section - Entitled "History"; likewise combine any sections Entitled - "Acknowledgements", and any sections Entitled "Dedications". You - must delete all sections Entitled "Endorsements." - - 6. COLLECTIONS OF DOCUMENTS - - You may make a collection consisting of the Document and other - documents released under this License, and replace the individual - copies of this License in the various documents with a single copy - that is included in the collection, provided that you follow the - rules of this License for verbatim copying of each of the - documents in all other respects. - - You may extract a single document from such a collection, and - distribute it individually under this License, provided you insert - a copy of this License into the extracted document, and follow - this License in all other respects regarding verbatim copying of - that document. - - 7. AGGREGATION WITH INDEPENDENT WORKS - - A compilation of the Document or its derivatives with other - separate and independent documents or works, in or on a volume of - a storage or distribution medium, is called an "aggregate" if the - copyright resulting from the compilation is not used to limit the - legal rights of the compilation's users beyond what the individual - works permit. When the Document is included in an aggregate, this - License does not apply to the other works in the aggregate which - are not themselves derivative works of the Document. - - If the Cover Text requirement of section 3 is applicable to these - copies of the Document, then if the Document is less than one half - of the entire aggregate, the Document's Cover Texts may be placed - on covers that bracket the Document within the aggregate, or the - electronic equivalent of covers if the Document is in electronic - form. Otherwise they must appear on printed covers that bracket - the whole aggregate. - - 8. TRANSLATION - - Translation is considered a kind of modification, so you may - distribute translations of the Document under the terms of section - 4. Replacing Invariant Sections with translations requires special - permission from their copyright holders, but you may include - translations of some or all Invariant Sections in addition to the - original versions of these Invariant Sections. You may include a - translation of this License, and all the license notices in the - Document, and any Warranty Disclaimers, provided that you also - include the original English version of this License and the - original versions of those notices and disclaimers. In case of a - disagreement between the translation and the original version of - this License or a notice or disclaimer, the original version will - prevail. - - If a section in the Document is Entitled "Acknowledgements", - "Dedications", or "History", the requirement (section 4) to - Preserve its Title (section 1) will typically require changing the - actual title. - - 9. TERMINATION - - You may not copy, modify, sublicense, or distribute the Document - except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense, or distribute it is void, - and will automatically terminate your rights under this License. - - However, if you cease all violation of this License, then your - license from a particular copyright holder is reinstated (a) - provisionally, unless and until the copyright holder explicitly - and finally terminates your license, and (b) permanently, if the - copyright holder fails to notify you of the violation by some - reasonable means prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is - reinstated permanently if the copyright holder notifies you of the - violation by some reasonable means, this is the first time you have - received notice of violation of this License (for any work) from - that copyright holder, and you cure the violation prior to 30 days - after your receipt of the notice. - - Termination of your rights under this section does not terminate - the licenses of parties who have received copies or rights from - you under this License. If your rights have been terminated and - not permanently reinstated, receipt of a copy of some or all of - the same material does not give you any rights to use it. - - 10. FUTURE REVISIONS OF THIS LICENSE - - The Free Software Foundation may publish new, revised versions of - the GNU Free Documentation License from time to time. Such new - versions will be similar in spirit to the present version, but may - differ in detail to address new problems or concerns. See - `http://www.gnu.org/copyleft/'. - - Each version of the License is given a distinguishing version - number. If the Document specifies that a particular numbered - version of this License "or any later version" applies to it, you - have the option of following the terms and conditions either of - that specified version or of any later version that has been - published (not as a draft) by the Free Software Foundation. If - the Document does not specify a version number of this License, - you may choose any version ever published (not as a draft) by the - Free Software Foundation. If the Document specifies that a proxy - can decide which future versions of this License can be used, that - proxy's public statement of acceptance of a version permanently - authorizes you to choose that version for the Document. - - 11. RELICENSING - - "Massive Multiauthor Collaboration Site" (or "MMC Site") means any - World Wide Web server that publishes copyrightable works and also - provides prominent facilities for anybody to edit those works. A - public wiki that anybody can edit is an example of such a server. - A "Massive Multiauthor Collaboration" (or "MMC") contained in the - site means any set of copyrightable works thus published on the MMC - site. - - "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0 - license published by Creative Commons Corporation, a not-for-profit - corporation with a principal place of business in San Francisco, - California, as well as future copyleft versions of that license - published by that same organization. - - "Incorporate" means to publish or republish a Document, in whole or - in part, as part of another Document. - - An MMC is "eligible for relicensing" if it is licensed under this - License, and if all works that were first published under this - License somewhere other than this MMC, and subsequently - incorporated in whole or in part into the MMC, (1) had no cover - texts or invariant sections, and (2) were thus incorporated prior - to November 1, 2008. - - The operator of an MMC Site may republish an MMC contained in the - site under CC-BY-SA on the same site at any time before August 1, - 2009, provided the MMC is eligible for relicensing. - - -ADDENDUM: How to use this License for your documents -==================================================== - -To use this License in a document you have written, include a copy of -the License in the document and put the following copyright and license -notices just after the title page: - - Copyright (C) YEAR YOUR NAME. - Permission is granted to copy, distribute and/or modify this document - under the terms of the GNU Free Documentation License, Version 1.3 - or any later version published by the Free Software Foundation; - with no Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. A copy of the license is included in the section entitled ``GNU - Free Documentation License''. - - If you have Invariant Sections, Front-Cover Texts and Back-Cover -Texts, replace the "with...Texts." line with this: - - with the Invariant Sections being LIST THEIR TITLES, with - the Front-Cover Texts being LIST, and with the Back-Cover Texts - being LIST. - - If you have Invariant Sections without Cover Texts, or some other -combination of the three, merge those two alternatives to suit the -situation. - - If your document contains nontrivial examples of program code, we -recommend releasing these examples in parallel under your choice of -free software license, such as the GNU General Public License, to -permit their use in free software. - - -File: libquadmath.info, Node: Reporting Bugs, Prev: GNU Free Documentation License, Up: Top - -4 Reporting Bugs -**************** - -Bugs in the GCC Quad-Precision Math Library implementation should be -reported via `http://gcc.gnu.org/bugs.html'. - - - -Tag Table: -Node: Top1660 -Node: Typedef and constants2394 -Node: Math Library Routines3812 -Node: I/O Library Routines7617 -Node: strtoflt1287942 -Node: quadmath_snprintf8702 -Node: GNU Free Documentation License10893 -Node: Reporting Bugs36059 - -End Tag Table diff -Naur gcc-4.6.0.orig/libquadmath/printf/printf_fp.c gcc-4.6.0/libquadmath/printf/printf_fp.c --- gcc-4.6.0.orig/libquadmath/printf/printf_fp.c 2011-02-16 13:54:30.000000000 +0000 +++ gcc-4.6.0/libquadmath/printf/printf_fp.c 2011-03-26 09:24:53.704105000 +0000 @@ -1197,7 +1197,7 @@ if (*copywc == decimalwc) memcpy (cp, decimal, decimal_len), cp += decimal_len; else if (*copywc == thousands_sepwc) - mempcpy (cp, thousands_sep, thousands_sep_len), cp += thousands_sep_len; + memcpy (cp, thousands_sep, thousands_sep_len), cp += thousands_sep_len; else *cp++ = (char) *copywc; } diff -Naur gcc-4.6.0.orig/libssp/configure gcc-4.6.0/libssp/configure --- gcc-4.6.0.orig/libssp/configure 2011-02-13 11:45:53.000000000 +0000 +++ gcc-4.6.0/libssp/configure 2011-03-28 17:09:27.398261000 +0000 @@ -734,6 +734,7 @@ enable_maintainer_mode enable_multilib enable_dependency_tracking +enable_symvers enable_shared enable_static with_pic @@ -1372,6 +1373,7 @@ --enable-multilib build many library versions (default) --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors + --disable-symvers disable symbol versioning for libssp --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] @@ -4098,19 +4100,27 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symbol versioning is supported" >&5 $as_echo_n "checking whether symbol versioning is supported... " >&6; } -if test x$gcc_no_link = xyes; then - # If we cannot link, we cannot build shared libraries, so do not use - # symbol versioning. - ssp_use_symver=no +# Check whether --enable-symvers was given. +if test "${enable_symvers+set}" = set; then : + enableval=$enable_symvers; ssp_use_symver=$enableval else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" - cat > conftest.map < conftest.map <conftest.$ac_ext @@ -4131,18 +4141,18 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - if test x$ssp_use_symver = xno; then - case "$target_os" in - solaris2*) - LDFLAGS="$save_LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared -Wl,-M,./conftest.map" - # Sun ld cannot handle wildcards and treats all entries as undefined. - cat > conftest.map < conftest.map <conftest.$ac_ext @@ -4163,10 +4173,11 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ;; - esac + ;; + esac + fi + LDFLAGS="$save_LDFLAGS" fi - LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ssp_use_symver" >&5 $as_echo "$ssp_use_symver" >&6; } @@ -10639,7 +10650,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10642 "configure" +#line 10653 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10745,7 +10756,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10748 "configure" +#line 10759 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff -Naur gcc-4.6.0.orig/libssp/configure.ac gcc-4.6.0/libssp/configure.ac --- gcc-4.6.0.orig/libssp/configure.ac 2010-12-06 00:50:04.000000000 +0000 +++ gcc-4.6.0/libssp/configure.ac 2011-03-28 17:09:27.398261000 +0000 @@ -72,35 +72,42 @@ fi AC_MSG_CHECKING([whether symbol versioning is supported]) -if test x$gcc_no_link = xyes; then - # If we cannot link, we cannot build shared libraries, so do not use - # symbol versioning. - ssp_use_symver=no -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -fPIC -shared -Wl,--version-script,./conftest.map" - cat > conftest.map < conftest.map < conftest.map < conftest.map < -The GNU C++ Library API Reference

@@ -21,25 +21,25 @@

The API documentation, rendered into HTML, can be viewed online:

@@ -47,7 +47,7 @@ gcc.org site in a directory located at <URL:ftp://gcc.gnu.org/pub/gcc/libstdc++/doxygen/>. You will almost certainly need to use one of the - mirror sites to download + mirror sites to download the tarball. After unpacking, simply load libstdc++-html-*/index.html into a browser.

diff -Naur gcc-4.6.0.orig/libstdc++-v3/doc/html/bk02.html gcc-4.6.0/libstdc++-v3/doc/html/bk02.html --- gcc-4.6.0.orig/libstdc++-v3/doc/html/bk02.html 2011-02-10 00:54:53.000000000 +0000 +++ gcc-4.6.0/libstdc++-v3/doc/html/bk02.html 2011-05-05 23:39:58.659199000 +0000 @@ -1,3 +1,3 @@ -<meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.2"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="manual/backwards.html" title="Backwards Compatibility"/><link rel="next" href="api.html" title="The GNU C++ Library API Reference"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="article"><a href="api.html">The GNU C++ Library API Reference</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr><tr><td align="left" valign="top">Backwards Compatibility </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> The GNU C++ Library API Reference</td></tr></table></div></body></html> +<html xmlns="http://www.w3.org/1999/xhtml"><head><title/><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="manual/backwards.html" title="Backwards Compatibility"/><link rel="next" href="api.html" title="The GNU C++ Library API Reference"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="article"><a href="api.html">The GNU C++ Library API Reference</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="manual/backwards.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="api.html">Next</a></td></tr><tr><td align="left" valign="top">Backwards Compatibility </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> The GNU C++ Library API Reference</td></tr></table></div></body></html> diff -Naur gcc-4.6.0.orig/libstdc++-v3/doc/html/bk03.html gcc-4.6.0/libstdc++-v3/doc/html/bk03.html --- gcc-4.6.0.orig/libstdc++-v3/doc/html/bk03.html 2011-02-10 00:54:53.000000000 +0000 +++ gcc-4.6.0/libstdc++-v3/doc/html/bk03.html 2011-05-05 23:39:58.659199000 +0000 @@ -1,3 +1,3 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><title/><meta name="generator" content="DocBook XSL-NS Stylesheets V1.75.2"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="api.html" title="The GNU C++ Library API Reference"/><link rel="next" href="faq.html" title="Frequently Asked Questions"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr><tr><td align="left" valign="top">The GNU C++ Library API Reference </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> Frequently Asked Questions</td></tr></table></div></body></html> +<html xmlns="http://www.w3.org/1999/xhtml"><head><title/><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"/><link rel="home" href="spine.html" title="The GNU C++ Library"/><link rel="up" href="spine.html" title="The GNU C++ Library"/><link rel="prev" href="api.html" title="The GNU C++ Library API Reference"/><link rel="next" href="faq.html" title="Frequently Asked Questions"/></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"/></tr><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><th width="60%" align="center"> </th><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr></table><hr/></div><div class="book"><div class="titlepage"><hr/></div><div class="toc"><p><strong>Table of Contents</strong></p><dl><dt><span class="article"><a href="faq.html">Frequently Asked Questions</a></span></dt></dl></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td align="left"><a accesskey="p" href="api.html">Prev</a> </td><td align="center"> </td><td align="right"> <a accesskey="n" href="faq.html">Next</a></td></tr><tr><td align="left" valign="top">The GNU C++ Library API Reference </td><td align="center"><a accesskey="h" href="spine.html">Home</a></td><td align="right" valign="top"> Frequently Asked Questions</td></tr></table></div></body></html> diff -Naur gcc-4.6.0.orig/libstdc++-v3/doc/html/faq.html gcc-4.6.0/libstdc++-v3/doc/html/faq.html --- gcc-4.6.0.orig/libstdc++-v3/doc/html/faq.html 2011-02-10 00:54:53.000000000 +0000 +++ gcc-4.6.0/libstdc++-v3/doc/html/faq.html 2011-05-05 23:39:58.659199000 +0000 @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Frequently Asked Questions

1.1. What is libstdc++?
1.2. Why should I use libstdc++? @@ -105,7 +105,7 @@ What happened to the older libg++? I need that!
1.7. What if I have more questions? -

1.1.

+

1.1.

What is libstdc++?

The GNU Standard C++ Library v3 is an ongoing project to @@ -114,8 +114,8 @@ exactly how far the project has come, or just want the latest bleeding-edge code, the up-to-date source is available over anonymous SVN, and can even be browsed over - the web. -

1.2.

+ the web. +

1.2.

Why should I use libstdc++?

The completion of the ISO C++ standardization gave the C++ @@ -129,9 +129,9 @@ (gcc, g++, etc) is widely considered to be one of the leading compilers in the world. Its development is overseen by the - GCC team. All of + GCC team. All of the rapid development and near-legendary - portability + portability that are the hallmarks of an open-source project are being applied to libstdc++.

@@ -141,7 +141,7 @@ vector<>, iostreams, and algorithms.) Programmers will no longer need to roll their own nor be worried about platform-specific incompatibilities. -

1.3.

+

1.3.

Who's in charge of it?

The libstdc++ project is contributed to by several developers @@ -153,15 +153,15 @@ Development and discussion is held on the libstdc++ mailing list. Subscribing to the list, or searching the list archives, is open to everyone. You can read instructions for - doing so on the homepage. + doing so on the homepage. If you have questions, ideas, code, or are just curious, sign up! -

1.4.

+

1.4.

When is libstdc++ going to be finished?

Nathan Myers gave the best of all possible answers, responding to a Usenet article asking this question: Sooner, if you help. -

1.5.

+

1.5.

How do I contribute to the effort?

Here is a page devoted to @@ -172,7 +172,7 @@ anybody who is willing to help write documentation, for example, or has found a bug in code that we all thought was working and is willing to provide details, is more than welcome! -

1.6.

+

1.6.

What happened to the older libg++? I need that!

The most recent libg++ README states that libg++ is no longer @@ -180,7 +180,7 @@ projects, and is only being kicked along to support older code.

More information in the backwards compatibility documentation -

1.7.

+

1.7.

What if I have more questions?

If you have read the README file, and your question remains @@ -201,17 +201,17 @@ How is that different from the GNU {Lesser,Library} GPL?

2.4. I see. So, what restrictions are there on programs that use the library? -

2.1.

+

2.1.

What are the license terms for libstdc++?

See our license description for these and related questions. -

2.2.

+

2.2.

So any program which uses libstdc++ falls under the GPL?

No. The special exception permits use of the library in proprietary applications. -

2.3.

+

2.3.

How is that different from the GNU {Lesser,Library} GPL?

The LGPL requires that users be able to replace the LGPL code with a @@ -221,7 +221,7 @@ are expanded inside the code that uses the library. So to allow people to replace the library code, someone using the library would have to distribute their own source, rendering the LGPL equivalent to the GPL. -

2.4.

+

2.4.

I see. So, what restrictions are there on programs that use the library?

None. We encourage such programs to be released as open source, @@ -234,7 +234,7 @@ What's libsupc++?

3.6. This library is HUGE! -

3.1.

How do I install libstdc++? +

3.1.

How do I install libstdc++?

Often libstdc++ comes pre-installed as an integral part of many existing Linux and Unix systems, as well as many embedded @@ -247,11 +247,11 @@ documentation for detailed instructions. You may wish to browse those files ahead of time to get a feel for what's required. -

3.2.

How does one get current libstdc++ sources? +

3.2.

How does one get current libstdc++ sources?

Libstdc++ sources for all official releases can be obtained as part of the GCC sources, available from various sites and - mirrors. A full list of + mirrors. A full list of download sites is provided on the main GCC site.

Current libstdc++ sources can always be checked out of the main @@ -262,7 +262,7 @@ Subversion, or SVN, is one of several revision control packages. It was selected for GNU projects because it's free (speech), free (beer), and very high - quality. The Subversion + quality. The Subversion home page has a better description.

The anonymous client checkout feature of SVN is @@ -270,20 +270,20 @@ the latest libstdc++ sources.

For more information - see SVN + see SVN details. -

3.3.

How do I know if it works? +

3.3.

How do I know if it works?

Libstdc++ comes with its own validation testsuite, which includes conformance testing, regression testing, ABI testing, and performance testing. Please consult the - testing + testing documentation for more details.

If you find bugs in the testsuite programs themselves, or if you think of a new test program that should be added to the suite, please write up your idea and send it to the list! -

3.4.

How do I insure that the dynamically linked library will be found? +

3.4.

How do I insure that the dynamically linked library will be found?

Depending on your platform and library version, the error message might be similar to one of the following: @@ -318,7 +318,7 @@

Using LD_LIBRARY_PATH is not always the best solution, Finding Dynamic or Shared Libraries in the manual gives some alternatives. -

3.5.

+

3.5.

What's libsupc++?

If the only functions from libstdc++.a @@ -335,7 +335,7 @@ using anything from the rest of the library, such as IOStreams or vectors, then you'll still need pieces from libstdc++.a. -

3.6.

+

3.6.

This library is HUGE!

Usually the size of libraries on disk isn't noticeable. When a @@ -382,7 +382,7 @@ Recent GNU/Linux glibc required?

4.8. Can't use wchar_t/wstring on FreeBSD -

4.1.

+

4.1.

Can libstdc++ be used with non-GNU compilers?

Perhaps. @@ -402,7 +402,7 @@ been known to work with versions of the EDG C++ compiler, and vendor-specific proprietary C++ compilers such as the Intel ICC C++ compiler. -

4.2.

+

4.2.

No 'long long' type on Solaris?

By default we try to support the C99 long long type. @@ -414,7 +414,7 @@ commonly reported platform affected was Solaris.

This has been fixed for libstdc++ releases greater than 3.0.3. -

4.3.

+

4.3.

_XOPEN_SOURCE and _GNU_SOURCE are always defined?

On Solaris, g++ (but not gcc) always defines the preprocessor macro _XOPEN_SOURCE. On GNU/Linux, the same happens @@ -440,16 +440,16 @@ g++ -E -dM - < /dev/null" to display a list of predefined macros for any particular installation.

This has been discussed on the mailing lists - quite a bit. + quite a bit.

This method is something of a wart. We'd like to find a cleaner solution, but nobody yet has contributed the time. -

4.4.

+

4.4.

Mac OS X ctype.h is broken! How can I fix it?

This is a long-standing bug in the OS X support. Fortunately, the patch is quite simple, and well-known. - Here's a + Here's a link to the solution. -

4.5.

+

4.5.

Threading is broken on i386?

Support for atomic integer operations is/was broken on i386 @@ -459,7 +459,7 @@ on an i686, then you would encounter no problems. Only when actually running the code on a i386 will the problem appear.

This is fixed in 3.2.2. -

4.6.

+

4.6.

MIPS atomic operations

The atomic locking routines for MIPS targets requires MIPS II @@ -469,7 +469,7 @@

The mips*-*-linux* port continues to use the MIPS II routines, and more work in this area is expected. -

4.7.

+

4.7.

Recent GNU/Linux glibc required?

When running on GNU/Linux, libstdc++ 3.2.1 (shared library version 5.0.1) and later uses localization and formatting code from the system @@ -480,7 +480,7 @@

The guideline is simple: the more recent the C++ library, the more recent the C library. (This is also documented in the main GCC installation instructions.) -

4.8.

+

4.8.

Can't use wchar_t/wstring on FreeBSD

Older versions of FreeBSD's C library do not have sufficient @@ -499,7 +499,7 @@ Bugs in the ISO C++ language or library specification

5.3. Bugs in the compiler (gcc/g++) and not libstdc++ -

5.1.

+

5.1.

What works already?

Short answer: Pretty much everything works @@ -513,7 +513,7 @@ C++98, TR1, and C++0x. -

5.2.

+

5.2.

Bugs in the ISO C++ language or library specification

Unfortunately, there are some. @@ -521,14 +521,14 @@ For those people who are not part of the ISO Library Group (i.e., nearly all of us needing to read this page in the first place), a public list of the library defects is occasionally - published here. + published here. Some of these issues have resulted in code changes in libstdc++.

If you think you've discovered a new bug that is not listed, please post a message describing your problem to or the Usenet group comp.lang.c++.moderated. -

5.3.

+

5.3.

Bugs in the compiler (gcc/g++) and not libstdc++

On occasion, the compiler is wrong. Please be advised that this @@ -541,7 +541,7 @@ these lists with terms describing your issue.

Before reporting a bug, please examine the - bugs database with the + bugs database with the category set to g++.

6.1. Reopening a stream fails @@ -563,7 +563,7 @@ list::size() is O(n)!
6.9. Aw, that's easy to fix! -

6.1.

+

6.1.

Reopening a stream fails

One of the most-reported non-bug reports. Executing a sequence like: @@ -590,7 +590,7 @@ Update: for GCC 4.0 we implemented the resolution of DR #409 and open() now calls clear() on success! -

6.2.

+

6.2.

-Weffc++ complains too much

Many warnings are emitted when -Weffc++ is used. Making @@ -602,7 +602,7 @@ We do, however, try to have libstdc++ sources as clean as possible. If you see some simple changes that pacify -Weffc++ without other drawbacks, send us a patch. -

6.3.

+

6.3.

Ambiguous overloads after including an old-style header

Another problem is the rel_ops namespace and the template @@ -611,10 +611,10 @@ (e.g., using them and the <iterator> header), then you will suddenly be faced with huge numbers of ambiguity errors. This was discussed on the -v3 list; Nathan Myers - sums + sums things up here. The collisions with vector/string iterator types have been fixed for 3.1. -

6.4.

+

6.4.

The g++-3 headers are not ours

If you are using headers in @@ -630,7 +630,7 @@ 'v'?). Starting with version 3.2 the headers are installed in ${prefix}/include/c++/${version} as this prevents headers from previous versions being found by mistake. -

6.5.

+

6.5.

Errors about *Concept and constraints in the STL

@@ -647,7 +647,7 @@ checks, is available in the Diagnostics. chapter of the manual. -

6.6.

+

6.6.

Program crashes when using library code in a dynamically-loaded library

@@ -666,12 +666,12 @@
    // link the executable
    g++ -fPIC -rdynamic -o foo ... -L. -lfoo -ldl
-    

6.7.

+    

6.7.

Memory leaks in containers

A few people have reported that the standard containers appear to leak memory when tested with memory checkers such as - valgrind. + valgrind. The library's default allocators keep free memory in a pool for later reuse, rather than returning it to the OS. Although this memory is always reachable by the library and is never @@ -679,18 +679,18 @@ want to test the library for memory leaks please read Tips for memory leak hunting first. -

6.8.

+

6.8.

list::size() is O(n)!

See the Containers chapter. -

6.9.

+

6.9.

Aw, that's easy to fix!

If you have found a bug in the library and you think you have a working fix, then send it in! The main GCC site has a page - on submitting + on submitting patches that covers the procedure, but for libstdc++ you should also send the patch to our mailing list in addition to the GCC patches mailing list. The libstdc++ @@ -718,7 +718,7 @@ What's an ABI and why is it so messy?

7.8. How do I make std::vector<T>::capacity() == std::vector<T>::size? -

7.1.

+

7.1.

string::iterator is not char*; vector<T>::iterator is not T*

If you have code that depends on container<T> iterators @@ -737,7 +737,7 @@ certain expressions to &*i. Future revisions of the Standard are expected to bless this usage for vector<> (but not for basic_string<>). -

7.2.

+

7.2.

What's next after libstdc++?

Hopefully, not much. The goal of libstdc++ is to produce a @@ -748,12 +748,12 @@ There is an effort underway to add significant extensions to the standard library specification. The latest version of this effort is described in - + The C++ Library Technical Report 1. -

7.3.

+

7.3.

What about the STL from SGI?

- The STL from SGI, + The STL from SGI, version 3.3, was the final merge of the STL codebase. The code in libstdc++ contains many fixes and changes, and the SGI code is no longer under active @@ -773,23 +773,23 @@

The FAQ for SGI's STL (one jump off of their main page) is still recommended reading. -

7.4.

+

7.4.

Extensions and Backward Compatibility

See the link on backwards compatibility and link on evolution. -

7.5.

+

7.5.

Does libstdc++ support TR1?

Yes.

The C++ Standard Library Technical Report adds many new features to the library. The latest version of this effort is described in - + Technical Report 1.

The implementation status of TR1 in libstdc++ can be tracked on the TR1 status page. -

7.6.

How do I get a copy of the ISO C++ Standard? +

7.6.

How do I get a copy of the ISO C++ Standard?

Copies of the full ISO 14882 standard are available on line via the ISO mirror site for committee members. Non-members, or those @@ -798,17 +798,17 @@ get a copy of the standard from their respective national standards organization. In the USA, this national standards organization is ANSI and their website is - right here. (And if + right here. (And if you've already registered with them, clicking this link will take you to directly to the place where you can - buy the standard on-line. + buy the standard on-line.

Who is your country's member body? Visit the - ISO homepage and find out! + ISO homepage and find out!

The 2003 version of the standard (the 1998 version plus TC1) is available in print, ISBN 0-470-84674-7. -

7.7.

+

7.7.

What's an ABI and why is it so messy?

ABI stands for Application Binary @@ -856,7 +856,7 @@ so they may later be changed. Deciding which, and implementing the decisions, must happen before you can reasonably document a candidate C++ ABI that encompasses the standard library. -

7.8.

+

7.8.

How do I make std::vector<T>::capacity() == std::vector<T>::size?

The standard idiom for deallocating a vector<T>'s diff -Naur gcc-4.6.0.orig/libstdc++-v3/doc/html/manual/abi.html gcc-4.6.0/libstdc++-v3/doc/html/manual/abi.html --- gcc-4.6.0.orig/libstdc++-v3/doc/html/manual/abi.html 2011-02-10 00:54:53.000000000 +0000 +++ gcc-4.6.0/libstdc++-v3/doc/html/manual/abi.html 2011-05-05 23:39:58.659199000 +0000 @@ -1,6 +1,6 @@ -ABI Policy and Guidelines