diff --git a/.gitignore b/.gitignore index 599ab06..2bdff75 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ /cloog-0.17.0.tar.gz /isl-0.10.tar.bz2 /gcc-4.8.0-20130106.tar.bz2 +/gcc-4.8.0-20130121.tar.bz2 +/cloog-0.18.0.tar.gz +/isl-0.11.1.tar.bz2 diff --git a/gcc.spec b/gcc.spec index 506eee3..b013f4d 100644 --- a/gcc.spec +++ b/gcc.spec @@ -1,9 +1,9 @@ -%global DATE 20130106 -%global SVNREV 194938 +%global DATE 20130121 +%global SVNREV 195337 %global gcc_version 4.8.0 # Note, gcc_release must be integer, if you want to add suffixes to # %{release}, append them after %{gcc_release} on Release: line. -%global gcc_release 0.3 +%global gcc_release 0.4 %global _unpackaged_files_terminate_build 0 %global multilib_64_archs sparc64 ppc64 s390x x86_64 %ifarch %{ix86} x86_64 ia64 ppc ppc64 alpha @@ -83,9 +83,9 @@ Group: Development/Languages # svn export svn://gcc.gnu.org/svn/gcc/branches/redhat/gcc-4_7-branch@%{SVNREV} gcc-%{version}-%{DATE} # tar cf - gcc-%{version}-%{DATE} | bzip2 -9 > gcc-%{version}-%{DATE}.tar.bz2 Source0: gcc-%{version}-%{DATE}.tar.bz2 -%global isl_version 0.10 +%global isl_version 0.11.1 Source1: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-%{isl_version}.tar.bz2 -%global cloog_version 0.17.0 +%global cloog_version 0.18.0 Source2: ftp://gcc.gnu.org/pub/gcc/infrastructure/cloog-%{cloog_version}.tar.gz %global fastjar_ver 0.97 Source4: http://download.savannah.nongnu.org/releases/fastjar/fastjar-%{fastjar_ver}.tar.gz @@ -196,10 +196,9 @@ Patch9: gcc48-cloog-dl2.patch Patch10: gcc48-pr38757.patch Patch11: gcc48-libstdc++-docs.patch Patch12: gcc48-no-add-needed.patch -Patch13: gcc48-asan-ppc.patch -Patch14: gcc48-pr55341.patch -Patch15: gcc48-pr55608.patch -Patch16: gcc48-pr55844.patch +Patch13: gcc48-pr55608.patch +Patch14: gcc48-pr55742.patch +Patch15: gcc48-pr56022.patch Patch1000: fastjar-0.97-segfault.patch Patch1001: fastjar-0.97-len1.patch @@ -751,10 +750,9 @@ package or when debugging this package. %patch11 -p0 -b .libstdc++-docs~ %endif %patch12 -p0 -b .no-add-needed~ -%patch13 -p0 -b .asan-ppc~ -%patch14 -p0 -b .pr55341~ -%patch15 -p0 -b .pr55608~ -%patch16 -p0 -b .pr55844~ +%patch13 -p0 -b .pr55608~ +%patch14 -p0 -E -b .pr55742~ +%patch15 -p0 -b .pr56022~ %if 0%{?_enable_debug_packages} cat > split-debuginfo.sh <<\EOF @@ -2975,5 +2973,44 @@ fi %{_prefix}/libexec/gcc/%{gcc_target_platform}/%{gcc_version}/plugin %changelog +* Mon Jan 21 2013 Jakub Jelinek 4.8.0-0.4 +- updated from trunk + - PRs ada/864, bootstrap/55792, bootstrap/55961, c++/52343, c++/55663, + c++/55753, c++/55801, c++/55878, c++/55893, c/48418, debug/49888, + debug/53235, debug/53671, debug/54114, debug/54402, debug/55579, + debug/56006, driver/55470, driver/55884, fortran/42769, fortran/45836, + fortran/45900, fortran/47203, fortran/52865, fortran/53876, + fortran/54286, fortran/54678, fortran/54990, fortran/54992, + fortran/55072, fortran/55341, fortran/55618, fortran/55758, + fortran/55763, fortran/55806, fortran/55852, fortran/55868, + fortran/55935, fortran/55983, libmudflap/53359, libstdc++/51007, + libstdc++/55043, libstdc++/55233, libstdc++/55594, libstdc++/55728, + libstdc++/55847, libstdc++/55861, libstdc++/55908, lto/45375, + middle-end/55114, middle-end/55851, middle-end/55882, + middle-end/55890, middle-end/56015, other/55973, other/55982, + rtl-optimization/52573, rtl-optimization/53827, + rtl-optimization/55153, rtl-optimization/55547, + rtl-optimization/55672, rtl-optimization/55829, + rtl-optimization/55833, rtl-optimization/55845, + rtl-optimization/56005, sanitizer/55488, sanitizer/55679, + sanitizer/55844, target/42661, target/43961, target/54461, + target/54908, target/55301, target/55433, target/55565, + target/55718, target/55719, target/55876, target/55897, + target/55940, target/55948, target/55974, target/55981, + target/56058, testsuite/54622, testsuite/55994, + tree-optimization/44061, tree-optimization/48189, + tree-optimization/48766, tree-optimization/52631, + tree-optimization/53465, tree-optimization/54120, + tree-optimization/54767, tree-optimization/55273, + tree-optimization/55569, tree-optimization/55823, + tree-optimization/55862, tree-optimization/55875, + tree-optimization/55888, tree-optimization/55920, + tree-optimization/55921, tree-optimization/55955, + tree-optimization/55964, tree-optimization/55995, + tree-optimization/56029, tree-optimization/55264 +- fix up multiversioning (PR c++/55742) +- fix up ICE with target attribute (PR middle-end/56022) +- update isl to 0.11.1 and cloog to 0.18.0 + * Sun Jan 6 2013 Jakub Jelinek 4.8.0-0.3 - new package diff --git a/gcc48-asan-ppc.patch b/gcc48-asan-ppc.patch deleted file mode 100644 index 30ab38f..0000000 --- a/gcc48-asan-ppc.patch +++ /dev/null @@ -1,145 +0,0 @@ -2012-12-21 Jakub Jelinek - - * varasm.c (output_constant_def_contents): For asan_protect_global - protected strings, adjust DECL_ALIGN if needed, before testing for - anchored symbols. - (place_block_symbol): Adjust size for asan protected STRING_CSTs if - TREE_CONSTANT_POOL_ADDRESS_P. Increase alignment for asan protected - normal decls. - (output_object_block): For asan protected decls, emit asan padding - after their contents. - * asan.c (asan_protect_global): Don't check TREE_ASM_WRITTEN here. - (asan_finish_file): Test it here instead. - ---- gcc/varasm.c.jj 2012-12-20 19:10:19.856526720 +0100 -+++ gcc/varasm.c 2012-12-21 10:37:44.481999545 +0100 -@@ -3252,6 +3252,7 @@ output_constant_def_contents (rtx symbol - tree decl = SYMBOL_REF_DECL (symbol); - tree exp = DECL_INITIAL (decl); - unsigned int align; -+ bool asan_protected = false; - - /* Make sure any other constants whose addresses appear in EXP - are assigned label numbers. */ -@@ -3260,6 +3261,14 @@ output_constant_def_contents (rtx symbol - /* We are no longer deferring this constant. */ - TREE_ASM_WRITTEN (decl) = TREE_ASM_WRITTEN (exp) = 1; - -+ if (flag_asan && TREE_CODE (exp) == STRING_CST -+ && asan_protect_global (exp)) -+ { -+ asan_protected = true; -+ DECL_ALIGN (decl) = MAX (DECL_ALIGN (decl), -+ ASAN_RED_ZONE_SIZE * BITS_PER_UNIT); -+ } -+ - /* If the constant is part of an object block, make sure that the - decl has been positioned within its block, but do not write out - its definition yet. output_object_blocks will do that later. */ -@@ -3267,15 +3276,8 @@ output_constant_def_contents (rtx symbol - place_block_symbol (symbol); - else - { -- bool asan_protected = false; - align = DECL_ALIGN (decl); - switch_to_section (get_constant_section (exp, align)); -- if (flag_asan && TREE_CODE (exp) == STRING_CST -- && asan_protect_global (exp)) -- { -- asan_protected = true; -- align = MAX (align, ASAN_RED_ZONE_SIZE * BITS_PER_UNIT); -- } - if (align > BITS_PER_UNIT) - ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (align / BITS_PER_UNIT)); - assemble_constant_contents (exp, XSTR (symbol, 0), align); -@@ -6968,6 +6970,10 @@ place_block_symbol (rtx symbol) - decl = SYMBOL_REF_DECL (symbol); - alignment = DECL_ALIGN (decl); - size = get_constant_size (DECL_INITIAL (decl)); -+ if (flag_asan -+ && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST -+ && asan_protect_global (DECL_INITIAL (decl))) -+ size += asan_red_zone_size (size); - } - else - { -@@ -6975,7 +6981,11 @@ place_block_symbol (rtx symbol) - alignment = DECL_ALIGN (decl); - size = tree_low_cst (DECL_SIZE_UNIT (decl), 1); - if (flag_asan && asan_protect_global (decl)) -- size += asan_red_zone_size (size); -+ { -+ size += asan_red_zone_size (size); -+ alignment = MAX (alignment, -+ ASAN_RED_ZONE_SIZE * BITS_PER_UNIT); -+ } - } - - /* Calculate the object's offset from the start of the block. */ -@@ -7114,16 +7124,34 @@ output_object_block (struct object_block - } - else if (TREE_CONSTANT_POOL_ADDRESS_P (symbol)) - { -+ HOST_WIDE_INT size; - decl = SYMBOL_REF_DECL (symbol); - assemble_constant_contents (DECL_INITIAL (decl), XSTR (symbol, 0), - DECL_ALIGN (decl)); -- offset += get_constant_size (DECL_INITIAL (decl)); -+ size = get_constant_size (DECL_INITIAL (decl)); -+ offset += size; -+ if (flag_asan -+ && TREE_CODE (DECL_INITIAL (decl)) == STRING_CST -+ && asan_protect_global (DECL_INITIAL (decl))) -+ { -+ size = asan_red_zone_size (size); -+ assemble_zeros (size); -+ offset += size; -+ } - } - else - { -+ HOST_WIDE_INT size; - decl = SYMBOL_REF_DECL (symbol); - assemble_variable_contents (decl, XSTR (symbol, 0), false); -- offset += tree_low_cst (DECL_SIZE_UNIT (decl), 1); -+ size = tree_low_cst (DECL_SIZE_UNIT (decl), 1); -+ offset += size; -+ if (flag_asan && asan_protect_global (decl)) -+ { -+ size = asan_red_zone_size (size); -+ assemble_zeros (size); -+ offset += size; -+ } - } - } - } ---- gcc/asan.c.jj 2012-12-20 11:38:14.000000000 +0100 -+++ gcc/asan.c 2012-12-21 10:49:45.364823759 +0100 -@@ -463,7 +463,6 @@ asan_protect_global (tree decl) - || DECL_THREAD_LOCAL_P (decl) - /* Externs will be protected elsewhere. */ - || DECL_EXTERNAL (decl) -- || !TREE_ASM_WRITTEN (decl) - || !DECL_RTL_SET_P (decl) - /* Comdat vars pose an ABI problem, we can't know if - the var that is selected by the linker will have -@@ -1699,7 +1698,8 @@ asan_finish_file (void) - tree fn = builtin_decl_implicit (BUILT_IN_ASAN_INIT); - append_to_statement_list (build_call_expr (fn, 0), &asan_ctor_statements); - FOR_EACH_DEFINED_VARIABLE (vnode) -- if (asan_protect_global (vnode->symbol.decl)) -+ if (TREE_ASM_WRITTEN (vnode->symbol.decl) -+ && asan_protect_global (vnode->symbol.decl)) - ++gcount; - htab_t const_desc_htab = constant_pool_htab (); - htab_traverse (const_desc_htab, count_string_csts, &gcount); -@@ -1721,7 +1721,8 @@ asan_finish_file (void) - DECL_IGNORED_P (var) = 1; - vec_alloc (v, gcount); - FOR_EACH_DEFINED_VARIABLE (vnode) -- if (asan_protect_global (vnode->symbol.decl)) -+ if (TREE_ASM_WRITTEN (vnode->symbol.decl) -+ && asan_protect_global (vnode->symbol.decl)) - asan_add_global (vnode->symbol.decl, TREE_TYPE (type), v); - struct asan_add_string_csts_data aascd; - aascd.type = TREE_TYPE (type); diff --git a/gcc48-pr55341.patch b/gcc48-pr55341.patch deleted file mode 100644 index 10cdabb..0000000 --- a/gcc48-pr55341.patch +++ /dev/null @@ -1,74 +0,0 @@ -2012-12-19 Jakub Jelinek - - PR fortran/55341 - * asan.c (asan_clear_shadow): New function. - (asan_emit_stack_protection): Use it. - ---- gcc/asan.c.jj 2012-12-13 00:05:04.000000000 +0100 -+++ gcc/asan.c 2012-12-19 12:25:57.676365851 +0100 -@@ -270,6 +270,45 @@ asan_shadow_cst (unsigned char shadow_by - return GEN_INT (trunc_int_for_mode (val, SImode)); - } - -+/* Clear shadow memory at SHADOW_MEM, LEN bytes. Can't call a library call here -+ though. */ -+ -+static void -+asan_clear_shadow (rtx shadow_mem, HOST_WIDE_INT len) -+{ -+ rtx insn, insns, top_label, end, addr, tmp, jump; -+ -+ start_sequence (); -+ clear_storage (shadow_mem, GEN_INT (len), BLOCK_OP_NORMAL); -+ insns = get_insns (); -+ end_sequence (); -+ for (insn = insns; insn; insn = NEXT_INSN (insn)) -+ if (CALL_P (insn)) -+ break; -+ if (insn == NULL_RTX) -+ { -+ emit_insn (insns); -+ return; -+ } -+ -+ gcc_assert ((len & 3) == 0); -+ top_label = gen_label_rtx (); -+ addr = force_reg (Pmode, XEXP (shadow_mem, 0)); -+ shadow_mem = adjust_automodify_address (shadow_mem, SImode, addr, 0); -+ end = force_reg (Pmode, plus_constant (Pmode, addr, len)); -+ emit_label (top_label); -+ -+ emit_move_insn (shadow_mem, const0_rtx); -+ tmp = expand_simple_binop (Pmode, PLUS, addr, GEN_INT (4), addr, -+ true, OPTAB_LIB_WIDEN); -+ if (tmp != addr) -+ emit_move_insn (addr, tmp); -+ emit_cmp_and_jump_insns (addr, end, LT, NULL_RTX, Pmode, true, top_label); -+ jump = get_last_insn (); -+ gcc_assert (JUMP_P (jump)); -+ add_reg_note (jump, REG_BR_PROB, GEN_INT (REG_BR_PROB_BASE * 80 / 100)); -+} -+ - /* Insert code to protect stack vars. The prologue sequence should be emitted - directly, epilogue sequence returned. BASE is the register holding the - stack base, against which OFFSETS array offsets are relative to, OFFSETS -@@ -404,8 +443,7 @@ asan_emit_stack_protection (rtx base, HO - (last_offset - prev_offset) - >> ASAN_SHADOW_SHIFT); - prev_offset = last_offset; -- clear_storage (shadow_mem, GEN_INT (last_size >> ASAN_SHADOW_SHIFT), -- BLOCK_OP_NORMAL); -+ asan_clear_shadow (shadow_mem, last_size >> ASAN_SHADOW_SHIFT); - last_offset = offset; - last_size = 0; - } -@@ -418,8 +456,7 @@ asan_emit_stack_protection (rtx base, HO - shadow_mem = adjust_address (shadow_mem, VOIDmode, - (last_offset - prev_offset) - >> ASAN_SHADOW_SHIFT); -- clear_storage (shadow_mem, GEN_INT (last_size >> ASAN_SHADOW_SHIFT), -- BLOCK_OP_NORMAL); -+ asan_clear_shadow (shadow_mem, last_size >> ASAN_SHADOW_SHIFT); - } - - do_pending_stack_adjust (); diff --git a/gcc48-pr55742.patch b/gcc48-pr55742.patch new file mode 100644 index 0000000..a88c2e8 --- /dev/null +++ b/gcc48-pr55742.patch @@ -0,0 +1,1288 @@ +2013-01-21 Jakub Jelinek + + PR c++/55742 + * config/i386/i386.c (ix86_valid_target_attribute_inner_p): Diagnose + invalid args instead of ICEing on it. + (ix86_valid_target_attribute_tree): Return error_mark_node if + ix86_valid_target_attribute_inner_p failed. + (ix86_valid_target_attribute_p): Return false only if + ix86_valid_target_attribute_tree returned error_mark_node. Allow + target("default") attribute. + (sorted_attr_string): Change argument from const char * to tree, + merge in all target attribute arguments rather than just one. + Formatting fix. Use XNEWVEC instead of xmalloc and XDELETEVEC + instead of free. Avoid using strcat. + (ix86_mangle_function_version_assembler_name): Mangle + target("default") as if no target attribute is present. Adjust + sorted_attr_string caller. Avoid leaking memory. Use XNEWVEC + instead of xmalloc and XDELETEVEC instead of free. + (ix86_function_versions): Don't return true if one of the decls + doesn't have target attribute. If they don't and one of the decls + is DECL_FUNCTION_VERSIONED, report an error. Adjust + sorted_attr_string caller. Use XDELETEVEC instead of free. + (ix86_supports_function_versions): Remove. + (make_name): Fix up formatting. + (make_dispatcher_decl): Remove resolver_name and its initialization. + Avoid leaking memory. + (is_function_default_version): Return true if there is + target("default") attribute rather than no target attribute at all. + (make_resolver_func): Avoid leaking memory. + (ix86_generate_version_dispatcher_body): Likewise. + (TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS): Remove. + * target.def (supports_function_versions): Remove. + * doc/tm.texi.in (SUPPORTS_FUNCTION_VERSIONS): Remove. + * doc/tm.texi: Regenerated. + + * c-common.c (handle_target_attribute): Revert 2012-12-26 change. + + * g++.dg/mv1.C: Moved to... + * g++.dg/ext/mv1.C: ... here. Adjust test. + * g++.dg/mv2.C: Moved to... + * g++.dg/ext/mv2.C: ... here. Adjust test. + * g++.dg/mv3.C: Moved to... + * g++.dg/ext/mv3.C: ... here. + * g++.dg/mv4.C: Moved to... + * g++.dg/ext/mv4.C: ... here. + * g++.dg/mv5.C: Moved to... + * g++.dg/ext/mv5.C: ... here. Adjust test. + * g++.dg/mv6.C: Moved to... + * g++.dg/ext/mv6.C: ... here. Adjust test. + * g++.dg/ext/mv7.C: New test. + * g++.dg/ext/mv8.C: New test. + * g++.dg/ext/mv9.C: New test. + * g++.dg/ext/mv10.C: New test. + * g++.dg/ext/mv11.C: New test. + +--- gcc/config/i386/i386.c.jj 2013-01-21 10:57:08.325945469 +0100 ++++ gcc/config/i386/i386.c 2013-01-21 12:02:59.384701394 +0100 +@@ -4223,7 +4223,10 @@ ix86_valid_target_attribute_inner_p (tre + } + + else if (TREE_CODE (args) != STRING_CST) +- gcc_unreachable (); ++ { ++ error ("attribute % argument not a string"); ++ return false; ++ } + + /* Handle multiple arguments separated by commas. */ + next_optstr = ASTRDUP (TREE_STRING_POINTER (args)); +@@ -4368,7 +4371,7 @@ ix86_valid_target_attribute_tree (tree a + /* Process each of the options on the chain. */ + if (! ix86_valid_target_attribute_inner_p (args, option_strings, + &enum_opts_set)) +- return NULL_TREE; ++ return error_mark_node; + + /* If the changed options are different from the default, rerun + ix86_option_override_internal, and then save the options away. +@@ -4433,6 +4436,15 @@ ix86_valid_target_attribute_p (tree fnde + { + struct cl_target_option cur_target; + bool ret = true; ++ ++ /* attribute((target("default"))) does nothing, beyond ++ affecting multi-versioning. */ ++ if (TREE_VALUE (args) ++ && TREE_CODE (TREE_VALUE (args)) == STRING_CST ++ && TREE_CHAIN (args) == NULL_TREE ++ && strcmp (TREE_STRING_POINTER (TREE_VALUE (args)), "default") == 0) ++ return true; ++ + tree old_optimize = build_optimization_node (); + tree new_target, new_optimize; + tree func_optimize = DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl); +@@ -4449,10 +4461,10 @@ ix86_valid_target_attribute_p (tree fnde + new_target = ix86_valid_target_attribute_tree (args); + new_optimize = build_optimization_node (); + +- if (!new_target) ++ if (new_target == error_mark_node) + ret = false; + +- else if (fndecl) ++ else if (fndecl && new_target) + { + DECL_FUNCTION_SPECIFIC_TARGET (fndecl) = new_target; + +@@ -28946,26 +28958,44 @@ attr_strcmp (const void *v1, const void + return strcmp (c1, c2); + } + +-/* STR is the argument to target attribute. This function tokenizes ++/* ARGLIST is the argument to target attribute. This function tokenizes + the comma separated arguments, sorts them and returns a string which + is a unique identifier for the comma separated arguments. It also + replaces non-identifier characters "=,-" with "_". */ + + static char * +-sorted_attr_string (const char *str) ++sorted_attr_string (tree arglist) + { ++ tree arg; ++ size_t str_len_sum = 0; + char **args = NULL; + char *attr_str, *ret_str; + char *attr = NULL; + unsigned int argnum = 1; + unsigned int i; + +- for (i = 0; i < strlen (str); i++) +- if (str[i] == ',') +- argnum++; +- +- attr_str = (char *)xmalloc (strlen (str) + 1); +- strcpy (attr_str, str); ++ for (arg = arglist; arg; arg = TREE_CHAIN (arg)) ++ { ++ const char *str = TREE_STRING_POINTER (TREE_VALUE (arg)); ++ size_t len = strlen (str); ++ str_len_sum += len + 1; ++ if (arg != arglist) ++ argnum++; ++ for (i = 0; i < strlen (str); i++) ++ if (str[i] == ',') ++ argnum++; ++ } ++ ++ attr_str = XNEWVEC (char, str_len_sum); ++ str_len_sum = 0; ++ for (arg = arglist; arg; arg = TREE_CHAIN (arg)) ++ { ++ const char *str = TREE_STRING_POINTER (TREE_VALUE (arg)); ++ size_t len = strlen (str); ++ memcpy (attr_str + str_len_sum, str, len); ++ attr_str[str_len_sum + len] = TREE_CHAIN (arg) ? ',' : '\0'; ++ str_len_sum += len + 1; ++ } + + /* Replace "=,-" with "_". */ + for (i = 0; i < strlen (attr_str); i++) +@@ -28986,18 +29016,20 @@ sorted_attr_string (const char *str) + attr = strtok (NULL, ","); + } + +- qsort (args, argnum, sizeof (char*), attr_strcmp); ++ qsort (args, argnum, sizeof (char *), attr_strcmp); + +- ret_str = (char *)xmalloc (strlen (str) + 1); +- strcpy (ret_str, args[0]); +- for (i = 1; i < argnum; i++) ++ ret_str = XNEWVEC (char, str_len_sum); ++ str_len_sum = 0; ++ for (i = 0; i < argnum; i++) + { +- strcat (ret_str, "_"); +- strcat (ret_str, args[i]); ++ size_t len = strlen (args[i]); ++ memcpy (ret_str + str_len_sum, args[i], len); ++ ret_str[str_len_sum + len] = i < argnum - 1 ? '_' : '\0'; ++ str_len_sum += len + 1; + } + +- free (args); +- free (attr_str); ++ XDELETEVEC (args); ++ XDELETEVEC (attr_str); + return ret_str; + } + +@@ -29009,8 +29041,8 @@ static tree + ix86_mangle_function_version_assembler_name (tree decl, tree id) + { + tree version_attr; +- const char *orig_name, *version_string, *attr_str; +- char *assembler_name; ++ const char *orig_name, *version_string; ++ char *attr_str, *assembler_name; + + if (DECL_DECLARED_INLINE_P (decl) + && lookup_attribute ("gnu_inline", +@@ -29034,9 +29066,11 @@ ix86_mangle_function_version_assembler_n + version_string + = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (version_attr))); + +- attr_str = sorted_attr_string (version_string); +- assembler_name = (char *) xmalloc (strlen (orig_name) +- + strlen (attr_str) + 2); ++ if (strcmp (version_string, "default") == 0) ++ return id; ++ ++ attr_str = sorted_attr_string (TREE_VALUE (version_attr)); ++ assembler_name = XNEWVEC (char, strlen (orig_name) + strlen (attr_str) + 2); + + sprintf (assembler_name, "%s.%s", orig_name, attr_str); + +@@ -29044,7 +29078,10 @@ ix86_mangle_function_version_assembler_n + if (DECL_ASSEMBLER_NAME_SET_P (decl)) + SET_DECL_RTL (decl, NULL); + +- return get_identifier (assembler_name); ++ tree ret = get_identifier (assembler_name); ++ XDELETEVEC (attr_str); ++ XDELETEVEC (assembler_name); ++ return ret; + } + + /* This function returns true if FN1 and FN2 are versions of the same function, +@@ -29055,10 +29092,9 @@ static bool + ix86_function_versions (tree fn1, tree fn2) + { + tree attr1, attr2; +- const char *attr_str1, *attr_str2; + char *target1, *target2; + bool result; +- ++ + if (TREE_CODE (fn1) != FUNCTION_DECL + || TREE_CODE (fn2) != FUNCTION_DECL) + return false; +@@ -29070,15 +29106,35 @@ ix86_function_versions (tree fn1, tree f + if (attr1 == NULL_TREE && attr2 == NULL_TREE) + return false; + +- /* If one function does not have a target attribute, these are versions. */ ++ /* Diagnose missing target attribute if one of the decls is already ++ multi-versioned. */ + if (attr1 == NULL_TREE || attr2 == NULL_TREE) +- return true; +- +- attr_str1 = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr1))); +- attr_str2 = TREE_STRING_POINTER (TREE_VALUE (TREE_VALUE (attr2))); ++ { ++ if (DECL_FUNCTION_VERSIONED (fn1) || DECL_FUNCTION_VERSIONED (fn2)) ++ { ++ if (attr2 != NULL_TREE) ++ { ++ tree tem = fn1; ++ fn1 = fn2; ++ fn2 = tem; ++ attr1 = attr2; ++ } ++ error_at (DECL_SOURCE_LOCATION (fn2), ++ "missing % attribute for multi-versioned %D", ++ fn2); ++ error_at (DECL_SOURCE_LOCATION (fn1), ++ "previous declaration of %D", fn1); ++ /* Prevent diagnosing of the same error multiple times. */ ++ DECL_ATTRIBUTES (fn2) ++ = tree_cons (get_identifier ("target"), ++ copy_node (TREE_VALUE (attr1)), ++ DECL_ATTRIBUTES (fn2)); ++ } ++ return false; ++ } + +- target1 = sorted_attr_string (attr_str1); +- target2 = sorted_attr_string (attr_str2); ++ target1 = sorted_attr_string (TREE_VALUE (attr1)); ++ target2 = sorted_attr_string (TREE_VALUE (attr2)); + + /* The sorted target strings must be different for fn1 and fn2 + to be versions. */ +@@ -29087,20 +29143,12 @@ ix86_function_versions (tree fn1, tree f + else + result = true; + +- free (target1); +- free (target2); ++ XDELETEVEC (target1); ++ XDELETEVEC (target2); + + return result; + } + +-/* This target supports function multiversioning. */ +- +-static bool +-ix86_supports_function_versions (void) +-{ +- return true; +-} +- + static tree + ix86_mangle_decl_assembler_name (tree decl, tree id) + { +@@ -29141,10 +29189,10 @@ make_name (tree decl, const char *suffix + + /* Use '.' to concatenate names as it is demangler friendly. */ + if (make_unique) +- snprintf (global_var_name, name_len, "%s.%s.%s", name, +- unique_name, suffix); ++ snprintf (global_var_name, name_len, "%s.%s.%s", name, unique_name, ++ suffix); + else +- snprintf (global_var_name, name_len, "%s.%s", name, suffix); ++ snprintf (global_var_name, name_len, "%s.%s", name, suffix); + + return global_var_name; + } +@@ -29159,7 +29207,7 @@ static tree + make_dispatcher_decl (const tree decl) + { + tree func_decl; +- char *func_name, *resolver_name; ++ char *func_name; + tree fn_type, func_type; + bool is_uniq = false; + +@@ -29167,14 +29215,13 @@ make_dispatcher_decl (const tree decl) + is_uniq = true; + + func_name = make_name (decl, "ifunc", is_uniq); +- resolver_name = make_name (decl, "resolver", is_uniq); +- gcc_assert (resolver_name); + + fn_type = TREE_TYPE (decl); + func_type = build_function_type (TREE_TYPE (fn_type), + TYPE_ARG_TYPES (fn_type)); + + func_decl = build_fn_decl (func_name, func_type); ++ XDELETEVEC (func_name); + TREE_USED (func_decl) = 1; + DECL_CONTEXT (func_decl) = NULL_TREE; + DECL_INITIAL (func_decl) = error_mark_node; +@@ -29196,9 +29243,14 @@ make_dispatcher_decl (const tree decl) + static bool + is_function_default_version (const tree decl) + { +- return (TREE_CODE (decl) == FUNCTION_DECL +- && DECL_FUNCTION_VERSIONED (decl) +- && lookup_attribute ("target", DECL_ATTRIBUTES (decl)) == NULL_TREE); ++ if (TREE_CODE (decl) != FUNCTION_DECL ++ || !DECL_FUNCTION_VERSIONED (decl)) ++ return false; ++ tree attr = lookup_attribute ("target", DECL_ATTRIBUTES (decl)); ++ gcc_assert (attr); ++ attr = TREE_VALUE (TREE_VALUE (attr)); ++ return (TREE_CODE (attr) == STRING_CST ++ && strcmp (TREE_STRING_POINTER (attr), "default") == 0); + } + + /* Make a dispatcher declaration for the multi-versioned function DECL. +@@ -29392,6 +29444,7 @@ make_resolver_func (const tree default_d + /* Create the alias for dispatch to resolver here. */ + /*cgraph_create_function_alias (dispatch_decl, decl);*/ + cgraph_same_body_alias (NULL, dispatch_decl, decl); ++ XDELETEVEC (resolver_name); + return decl; + } + +@@ -29453,7 +29506,7 @@ ix86_generate_version_dispatcher_body (v + } + + dispatch_function_versions (resolver_decl, &fn_ver_vec, &empty_bb); +- ++ fn_ver_vec.release (); + rebuild_cgraph_edges (); + pop_cfun (); + return resolver_decl; +@@ -42441,10 +42494,6 @@ ix86_memmodel_check (unsigned HOST_WIDE_ + #undef TARGET_OPTION_FUNCTION_VERSIONS + #define TARGET_OPTION_FUNCTION_VERSIONS ix86_function_versions + +-#undef TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS +-#define TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS \ +- ix86_supports_function_versions +- + #undef TARGET_CAN_INLINE_P + #define TARGET_CAN_INLINE_P ix86_can_inline_p + +--- gcc/target.def.jj 2013-01-11 09:02:32.000000000 +0100 ++++ gcc/target.def 2013-01-21 11:25:29.145124702 +0100 +@@ -2831,14 +2831,6 @@ DEFHOOK + bool, (tree decl1, tree decl2), + hook_bool_tree_tree_false) + +-/* This function returns true if the target supports function +- multiversioning. */ +-DEFHOOK +-(supports_function_versions, +- "", +- bool, (void), +- hook_bool_void_false) +- + /* Function to determine if one function can inline another function. */ + #undef HOOK_PREFIX + #define HOOK_PREFIX "TARGET_" +--- gcc/doc/tm.texi.in.jj 2013-01-11 09:02:26.000000000 +0100 ++++ gcc/doc/tm.texi.in 2013-01-21 11:25:57.789962584 +0100 +@@ -9768,11 +9768,6 @@ different target specific attributes, th + different target machines. + @end deftypefn + +-@hook TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS +-This target hook returns @code{true} if the target supports function +-multiversioning. +-@end deftypefn +- + @hook TARGET_CAN_INLINE_P + This target hook returns @code{false} if the @var{caller} function + cannot inline @var{callee}, based on target specific information. By +--- gcc/doc/tm.texi.jj 2013-01-11 09:02:26.000000000 +0100 ++++ gcc/doc/tm.texi 2013-01-21 11:26:08.647897014 +0100 +@@ -9907,11 +9907,6 @@ different target specific attributes, th + different target machines. + @end deftypefn + +-@deftypefn {Target Hook} bool TARGET_OPTION_SUPPORTS_FUNCTION_VERSIONS (void) +-This target hook returns @code{true} if the target supports function +-multiversioning. +-@end deftypefn +- + @deftypefn {Target Hook} bool TARGET_CAN_INLINE_P (tree @var{caller}, tree @var{callee}) + This target hook returns @code{false} if the @var{caller} function + cannot inline @var{callee}, based on target specific information. By +--- gcc/c-family/c-common.c.jj 2013-01-21 10:56:55.165014693 +0100 ++++ gcc/c-family/c-common.c 2013-01-21 10:59:04.305285038 +0100 +@@ -8759,12 +8759,8 @@ handle_target_attribute (tree *node, tre + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } +- /* Do not strip invalid target attributes for targets which support function +- multiversioning as the target string is used to determine versioned +- functions. */ + else if (! targetm.target_option.valid_attribute_p (*node, name, args, +- flags) +- && ! targetm.target_option.supports_function_versions ()) ++ flags)) + *no_add_attrs = true; + + return NULL_TREE; +--- gcc/testsuite/g++.dg/mv1.C.jj 2013-01-21 10:56:54.564017815 +0100 ++++ gcc/testsuite/g++.dg/mv1.C 2013-01-21 11:35:42.260684508 +0100 +@@ -1,130 +0,0 @@ +-/* Test case to check if Multiversioning works. */ +-/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +-/* { dg-require-ifunc "" } */ +-/* { dg-options "-O2 -fPIC" } */ +- +-#include +- +-/* Default version. */ +-int foo (); +-/* The other versions of foo. Mix up the ordering and +- check if the dispatching does it in the order of priority. */ +-/* Check combination of target attributes. */ +-int foo () __attribute__ ((target("arch=corei7,popcnt"))); +-/* The target operands in this declaration and the definition are re-ordered. +- This should still work. */ +-int foo () __attribute__ ((target("ssse3,avx2"))); +- +-/* Check for all target attributes for which dispatchers are available. */ +-/* Check arch= */ +-int foo () __attribute__((target("arch=core2"))); +-int foo () __attribute__((target("arch=corei7"))); +-int foo () __attribute__((target("arch=atom"))); +-/* Check ISAs */ +-int foo () __attribute__((target("avx"))); +-int foo () __attribute__ ((target("arch=core2,sse4.2"))); +-/* Check more arch=. */ +-int foo () __attribute__((target("arch=amdfam10"))); +-int foo () __attribute__((target("arch=bdver1"))); +-int foo () __attribute__((target("arch=bdver2"))); +- +-int (*p)() = &foo; +-int main () +-{ +- int val = foo (); +- assert (val == (*p)()); +- +- /* Check in the exact same order in which the dispatching +- is expected to happen. */ +- if (__builtin_cpu_is ("bdver1")) +- assert (val == 1); +- else if (__builtin_cpu_is ("bdver2")) +- assert (val == 2); +- else if (__builtin_cpu_supports ("avx2") +- && __builtin_cpu_supports ("ssse3")) +- assert (val == 3); +- else if (__builtin_cpu_supports ("avx")) +- assert (val == 4); +- else if (__builtin_cpu_is ("corei7") +- && __builtin_cpu_supports ("popcnt")) +- assert (val == 5); +- else if (__builtin_cpu_is ("corei7")) +- assert (val == 6); +- else if (__builtin_cpu_is ("amdfam10h")) +- assert (val == 7); +- else if (__builtin_cpu_is ("core2") +- && __builtin_cpu_supports ("sse4.2")) +- assert (val == 8); +- else if (__builtin_cpu_is ("core2")) +- assert (val == 9); +- else if (__builtin_cpu_is ("atom")) +- assert (val == 10); +- else +- assert (val == 0); +- +- return 0; +-} +- +-int foo () +-{ +- return 0; +-} +- +-int __attribute__ ((target("arch=corei7,popcnt"))) +-foo () +-{ +- return 5; +-} +-int __attribute__ ((target("avx2,ssse3"))) +-foo () +-{ +- return 3; +-} +- +-int __attribute__ ((target("arch=core2"))) +-foo () +-{ +- return 9; +-} +- +-int __attribute__ ((target("arch=corei7"))) +-foo () +-{ +- return 6; +-} +- +-int __attribute__ ((target("arch=atom"))) +-foo () +-{ +- return 10; +-} +- +-int __attribute__ ((target("avx"))) +-foo () +-{ +- return 4; +-} +- +-int __attribute__ ((target("arch=core2,sse4.2"))) +-foo () +-{ +- return 8; +-} +- +-int __attribute__ ((target("arch=amdfam10"))) +-foo () +-{ +- return 7; +-} +- +-int __attribute__ ((target("arch=bdver1"))) +-foo () +-{ +- return 1; +-} +- +-int __attribute__ ((target("arch=bdver2"))) +-foo () +-{ +- return 2; +-} +--- gcc/testsuite/g++.dg/ext/mv1.C.jj 2013-01-21 11:36:16.084491175 +0100 ++++ gcc/testsuite/g++.dg/ext/mv1.C 2013-01-21 11:42:52.975315718 +0100 +@@ -0,0 +1,132 @@ ++/* Test case to check if Multiversioning works. */ ++/* { dg-do run { target i?86-*-* x86_64-*-* } } */ ++/* { dg-require-ifunc "" } */ ++/* { dg-options "-O2 -fPIC" } */ ++ ++#include ++ ++/* Default version. */ ++int foo (); // Extra declaration that is merged with the second one. ++int foo () __attribute__ ((target("default"))); ++/* The other versions of foo. Mix up the ordering and ++ check if the dispatching does it in the order of priority. */ ++/* Check combination of target attributes. */ ++int foo () __attribute__ ((target("arch=corei7,popcnt"))); ++/* The target operands in this declaration and the definition are re-ordered. ++ This should still work. */ ++int foo () __attribute__ ((target("ssse3,avx2"))); ++ ++/* Check for all target attributes for which dispatchers are available. */ ++/* Check arch= */ ++int foo () __attribute__((target("arch=core2"))); ++int foo () __attribute__((target("arch=corei7"))); ++int foo () __attribute__((target("arch=atom"))); ++/* Check ISAs */ ++int foo () __attribute__((target("avx"))); ++int foo () __attribute__ ((target("arch=core2,sse4.2"))); ++/* Check more arch=. */ ++int foo () __attribute__((target("arch=amdfam10"))); ++int foo () __attribute__((target("arch=bdver1"))); ++int foo () __attribute__((target("arch=bdver2"))); ++ ++int (*p)() = &foo; ++int main () ++{ ++ int val = foo (); ++ assert (val == (*p)()); ++ ++ /* Check in the exact same order in which the dispatching ++ is expected to happen. */ ++ if (__builtin_cpu_is ("bdver1")) ++ assert (val == 1); ++ else if (__builtin_cpu_is ("bdver2")) ++ assert (val == 2); ++ else if (__builtin_cpu_supports ("avx2") ++ && __builtin_cpu_supports ("ssse3")) ++ assert (val == 3); ++ else if (__builtin_cpu_supports ("avx")) ++ assert (val == 4); ++ else if (__builtin_cpu_is ("corei7") ++ && __builtin_cpu_supports ("popcnt")) ++ assert (val == 5); ++ else if (__builtin_cpu_is ("corei7")) ++ assert (val == 6); ++ else if (__builtin_cpu_is ("amdfam10h")) ++ assert (val == 7); ++ else if (__builtin_cpu_is ("core2") ++ && __builtin_cpu_supports ("sse4.2")) ++ assert (val == 8); ++ else if (__builtin_cpu_is ("core2")) ++ assert (val == 9); ++ else if (__builtin_cpu_is ("atom")) ++ assert (val == 10); ++ else ++ assert (val == 0); ++ ++ return 0; ++} ++ ++int __attribute__ ((target("default"))) ++foo () ++{ ++ return 0; ++} ++ ++int __attribute__ ((target("arch=corei7,popcnt"))) ++foo () ++{ ++ return 5; ++} ++int __attribute__ ((target("avx2,ssse3"))) ++foo () ++{ ++ return 3; ++} ++ ++int __attribute__ ((target("arch=core2"))) ++foo () ++{ ++ return 9; ++} ++ ++int __attribute__ ((target("arch=corei7"))) ++foo () ++{ ++ return 6; ++} ++ ++int __attribute__ ((target("arch=atom"))) ++foo () ++{ ++ return 10; ++} ++ ++int __attribute__ ((target("avx"))) ++foo () ++{ ++ return 4; ++} ++ ++int __attribute__ ((target("arch=core2,sse4.2"))) ++foo () ++{ ++ return 8; ++} ++ ++int __attribute__ ((target("arch=amdfam10"))) ++foo () ++{ ++ return 7; ++} ++ ++int __attribute__ ((target("arch=bdver1"))) ++foo () ++{ ++ return 1; ++} ++ ++int __attribute__ ((target("arch=bdver2"))) ++foo () ++{ ++ return 2; ++} +--- gcc/testsuite/g++.dg/mv2.C.jj 2013-01-21 10:56:54.465018354 +0100 ++++ gcc/testsuite/g++.dg/mv2.C 2013-01-21 11:35:45.088666745 +0100 +@@ -1,118 +0,0 @@ +-/* Test case to check if Multiversioning chooses the correct +- dispatching order when versions are for various ISAs. */ +-/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +-/* { dg-require-ifunc "" } */ +-/* { dg-options "-O2" } */ +- +-#include +- +-/* Default version. */ +-int foo (); +-/* The dispatch checks should be in the exact reverse order of the +- declarations below. */ +-int foo () __attribute__ ((target ("mmx"))); +-int foo () __attribute__ ((target ("sse"))); +-int foo () __attribute__ ((target ("sse2"))); +-int foo () __attribute__ ((target ("sse3"))); +-int foo () __attribute__ ((target ("ssse3"))); +-int foo () __attribute__ ((target ("sse4.1"))); +-int foo () __attribute__ ((target ("sse4.2"))); +-int foo () __attribute__ ((target ("popcnt"))); +-int foo () __attribute__ ((target ("avx"))); +-int foo () __attribute__ ((target ("avx2"))); +- +-int main () +-{ +- int val = foo (); +- +- if (__builtin_cpu_supports ("avx2")) +- assert (val == 1); +- else if (__builtin_cpu_supports ("avx")) +- assert (val == 2); +- else if (__builtin_cpu_supports ("popcnt")) +- assert (val == 3); +- else if (__builtin_cpu_supports ("sse4.2")) +- assert (val == 4); +- else if (__builtin_cpu_supports ("sse4.1")) +- assert (val == 5); +- else if (__builtin_cpu_supports ("ssse3")) +- assert (val == 6); +- else if (__builtin_cpu_supports ("sse3")) +- assert (val == 7); +- else if (__builtin_cpu_supports ("sse2")) +- assert (val == 8); +- else if (__builtin_cpu_supports ("sse")) +- assert (val == 9); +- else if (__builtin_cpu_supports ("mmx")) +- assert (val == 10); +- else +- assert (val == 0); +- +- return 0; +-} +- +-int +-foo () +-{ +- return 0; +-} +- +-int __attribute__ ((target("mmx"))) +-foo () +-{ +- return 10; +-} +- +-int __attribute__ ((target("sse"))) +-foo () +-{ +- return 9; +-} +- +-int __attribute__ ((target("sse2"))) +-foo () +-{ +- return 8; +-} +- +-int __attribute__ ((target("sse3"))) +-foo () +-{ +- return 7; +-} +- +-int __attribute__ ((target("ssse3"))) +-foo () +-{ +- return 6; +-} +- +-int __attribute__ ((target("sse4.1"))) +-foo () +-{ +- return 5; +-} +- +-int __attribute__ ((target("sse4.2"))) +-foo () +-{ +- return 4; +-} +- +-int __attribute__ ((target("popcnt"))) +-foo () +-{ +- return 3; +-} +- +-int __attribute__ ((target("avx"))) +-foo () +-{ +- return 2; +-} +- +-int __attribute__ ((target("avx2"))) +-foo () +-{ +- return 1; +-} +--- gcc/testsuite/g++.dg/ext/mv2.C.jj 2013-01-21 11:36:16.085491165 +0100 ++++ gcc/testsuite/g++.dg/ext/mv2.C 2013-01-21 10:58:57.000000000 +0100 +@@ -0,0 +1,118 @@ ++/* Test case to check if Multiversioning chooses the correct ++ dispatching order when versions are for various ISAs. */ ++/* { dg-do run { target i?86-*-* x86_64-*-* } } */ ++/* { dg-require-ifunc "" } */ ++/* { dg-options "-O2" } */ ++ ++#include ++ ++/* Default version. */ ++int foo () __attribute__ ((target ("default"))); ++/* The dispatch checks should be in the exact reverse order of the ++ declarations below. */ ++int foo () __attribute__ ((target ("mmx"))); ++int foo () __attribute__ ((target ("sse"))); ++int foo () __attribute__ ((target ("sse2"))); ++int foo () __attribute__ ((target ("sse3"))); ++int foo () __attribute__ ((target ("ssse3"))); ++int foo () __attribute__ ((target ("sse4.1"))); ++int foo () __attribute__ ((target ("sse4.2"))); ++int foo () __attribute__ ((target ("popcnt"))); ++int foo () __attribute__ ((target ("avx"))); ++int foo () __attribute__ ((target ("avx2"))); ++ ++int main () ++{ ++ int val = foo (); ++ ++ if (__builtin_cpu_supports ("avx2")) ++ assert (val == 1); ++ else if (__builtin_cpu_supports ("avx")) ++ assert (val == 2); ++ else if (__builtin_cpu_supports ("popcnt")) ++ assert (val == 3); ++ else if (__builtin_cpu_supports ("sse4.2")) ++ assert (val == 4); ++ else if (__builtin_cpu_supports ("sse4.1")) ++ assert (val == 5); ++ else if (__builtin_cpu_supports ("ssse3")) ++ assert (val == 6); ++ else if (__builtin_cpu_supports ("sse3")) ++ assert (val == 7); ++ else if (__builtin_cpu_supports ("sse2")) ++ assert (val == 8); ++ else if (__builtin_cpu_supports ("sse")) ++ assert (val == 9); ++ else if (__builtin_cpu_supports ("mmx")) ++ assert (val == 10); ++ else ++ assert (val == 0); ++ ++ return 0; ++} ++ ++int __attribute__ ((target("default"))) ++foo () ++{ ++ return 0; ++} ++ ++int __attribute__ ((target("mmx"))) ++foo () ++{ ++ return 10; ++} ++ ++int __attribute__ ((target("sse"))) ++foo () ++{ ++ return 9; ++} ++ ++int __attribute__ ((target("sse2"))) ++foo () ++{ ++ return 8; ++} ++ ++int __attribute__ ((target("sse3"))) ++foo () ++{ ++ return 7; ++} ++ ++int __attribute__ ((target("ssse3"))) ++foo () ++{ ++ return 6; ++} ++ ++int __attribute__ ((target("sse4.1"))) ++foo () ++{ ++ return 5; ++} ++ ++int __attribute__ ((target("sse4.2"))) ++foo () ++{ ++ return 4; ++} ++ ++int __attribute__ ((target("popcnt"))) ++foo () ++{ ++ return 3; ++} ++ ++int __attribute__ ((target("avx"))) ++foo () ++{ ++ return 2; ++} ++ ++int __attribute__ ((target("avx2"))) ++foo () ++{ ++ return 1; ++} +--- gcc/testsuite/g++.dg/mv3.C.jj 2013-01-18 21:23:45.000000000 +0100 ++++ gcc/testsuite/g++.dg/mv3.C 2013-01-21 11:35:52.400626435 +0100 +@@ -1,36 +0,0 @@ +-/* Test case to check if a call to a multiversioned function +- is replaced with a direct call to the particular version when +- the most specialized version's target attributes match the +- caller. +- +- In this program, foo is multiversioned but there is no default +- function. This is an error if the call has to go through a +- dispatcher. However, the call to foo in bar can be replaced +- with a direct call to the popcnt version of foo. Hence, this +- test should pass. */ +- +-/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +-/* { dg-options "-O2" } */ +- +- +-int __attribute__ ((target ("sse"))) +-foo () +-{ +- return 1; +-} +-int __attribute__ ((target ("popcnt"))) +-foo () +-{ +- return 0; +-} +- +-int __attribute__ ((target ("popcnt"))) +-bar () +-{ +- return foo (); +-} +- +-int main () +-{ +- return bar (); +-} +--- gcc/testsuite/g++.dg/ext/mv3.C.jj 2013-01-21 11:36:16.086491156 +0100 ++++ gcc/testsuite/g++.dg/ext/mv3.C 2013-01-18 21:23:45.000000000 +0100 +@@ -0,0 +1,36 @@ ++/* Test case to check if a call to a multiversioned function ++ is replaced with a direct call to the particular version when ++ the most specialized version's target attributes match the ++ caller. ++ ++ In this program, foo is multiversioned but there is no default ++ function. This is an error if the call has to go through a ++ dispatcher. However, the call to foo in bar can be replaced ++ with a direct call to the popcnt version of foo. Hence, this ++ test should pass. */ ++ ++/* { dg-do run { target i?86-*-* x86_64-*-* } } */ ++/* { dg-options "-O2" } */ ++ ++ ++int __attribute__ ((target ("sse"))) ++foo () ++{ ++ return 1; ++} ++int __attribute__ ((target ("popcnt"))) ++foo () ++{ ++ return 0; ++} ++ ++int __attribute__ ((target ("popcnt"))) ++bar () ++{ ++ return foo (); ++} ++ ++int main () ++{ ++ return bar (); ++} +--- gcc/testsuite/g++.dg/mv4.C.jj 2013-01-18 21:23:45.000000000 +0100 ++++ gcc/testsuite/g++.dg/mv4.C 2013-01-21 11:35:54.308616223 +0100 +@@ -1,24 +0,0 @@ +-/* Test case to check if the compiler generates an error message +- when the default version of a multiversioned function is absent +- and its pointer is taken. */ +- +-/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ +-/* { dg-require-ifunc "" } */ +-/* { dg-options "-O2" } */ +- +-int __attribute__ ((target ("sse"))) +-foo () +-{ +- return 1; +-} +-int __attribute__ ((target ("popcnt"))) +-foo () +-{ +- return 0; +-} +- +-int main () +-{ +- int (*p)() = &foo; /* { dg-error "use of multiversioned function without a default" {} } */ +- return (*p)(); +-} +--- gcc/testsuite/g++.dg/ext/mv4.C.jj 2013-01-21 11:36:16.088491133 +0100 ++++ gcc/testsuite/g++.dg/ext/mv4.C 2013-01-18 21:23:45.000000000 +0100 +@@ -0,0 +1,24 @@ ++/* Test case to check if the compiler generates an error message ++ when the default version of a multiversioned function is absent ++ and its pointer is taken. */ ++ ++/* { dg-do compile { target i?86-*-* x86_64-*-* } } */ ++/* { dg-require-ifunc "" } */ ++/* { dg-options "-O2" } */ ++ ++int __attribute__ ((target ("sse"))) ++foo () ++{ ++ return 1; ++} ++int __attribute__ ((target ("popcnt"))) ++foo () ++{ ++ return 0; ++} ++ ++int main () ++{ ++ int (*p)() = &foo; /* { dg-error "use of multiversioned function without a default" {} } */ ++ return (*p)(); ++} +--- gcc/testsuite/g++.dg/mv5.C.jj 2013-01-21 10:56:54.582017723 +0100 ++++ gcc/testsuite/g++.dg/mv5.C 2013-01-21 11:35:56.027606185 +0100 +@@ -1,25 +0,0 @@ +-/* Test case to check if multiversioned functions are still generated if they are +- marked comdat with inline keyword. */ +- +-/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +-/* { dg-require-ifunc "" } */ +-/* { dg-options "-O2" } */ +- +- +-/* Default version. */ +-inline int +-foo () +-{ +- return 0; +-} +- +-inline int __attribute__ ((target ("popcnt"))) +-foo () +-{ +- return 0; +-} +- +-int main () +-{ +- return foo (); +-} +--- gcc/testsuite/g++.dg/ext/mv5.C.jj 2013-01-21 11:36:16.089491123 +0100 ++++ gcc/testsuite/g++.dg/ext/mv5.C 2013-01-21 10:58:57.000000000 +0100 +@@ -0,0 +1,25 @@ ++/* Test case to check if multiversioned functions are still generated if they are ++ marked comdat with inline keyword. */ ++ ++/* { dg-do run { target i?86-*-* x86_64-*-* } } */ ++/* { dg-require-ifunc "" } */ ++/* { dg-options "-O2" } */ ++ ++ ++/* Default version. */ ++inline int __attribute__ ((target ("default"))) ++foo () ++{ ++ return 0; ++} ++ ++inline int __attribute__ ((target ("popcnt"))) ++foo () ++{ ++ return 0; ++} ++ ++int main () ++{ ++ return foo (); ++} +--- gcc/testsuite/g++.dg/mv6.C.jj 2013-01-21 10:56:54.504018081 +0100 ++++ gcc/testsuite/g++.dg/mv6.C 2013-01-21 11:35:57.514597697 +0100 +@@ -1,27 +0,0 @@ +-/* Test to check if member version multiversioning works correctly. */ +- +-/* { dg-do run { target i?86-*-* x86_64-*-* } } */ +-/* { dg-require-ifunc "" } */ +-/* { dg-options "-march=x86-64" } */ +- +-class Foo +-{ +- public: +- /* Default version of foo. */ +- int foo () +- { +- return 0; +- } +- /* corei7 version of foo. */ +- __attribute__ ((target("arch=corei7"))) +- int foo () +- { +- return 0; +- } +-}; +- +-int main () +-{ +- Foo f; +- return f.foo (); +-} +--- gcc/testsuite/g++.dg/ext/mv6.C.jj 2013-01-21 11:36:16.090491117 +0100 ++++ gcc/testsuite/g++.dg/ext/mv6.C 2013-01-21 10:58:57.000000000 +0100 +@@ -0,0 +1,28 @@ ++/* Test to check if member version multiversioning works correctly. */ ++ ++/* { dg-do run { target i?86-*-* x86_64-*-* } } */ ++/* { dg-require-ifunc "" } */ ++/* { dg-options "-march=x86-64" } */ ++ ++class Foo ++{ ++ public: ++ /* Default version of foo. */ ++ __attribute__ ((target("default"))) ++ int foo () ++ { ++ return 0; ++ } ++ /* corei7 version of foo. */ ++ __attribute__ ((target("arch=corei7"))) ++ int foo () ++ { ++ return 0; ++ } ++}; ++ ++int main () ++{ ++ Foo f; ++ return f.foo (); ++} +--- gcc/testsuite/g++.dg/ext/mv7.C.jj 2013-01-21 11:39:21.789460493 +0100 ++++ gcc/testsuite/g++.dg/ext/mv7.C 2013-01-21 11:45:05.098589632 +0100 +@@ -0,0 +1,12 @@ ++// { dg-do compile { target i?86-*-* x86_64-*-* } } ++// { dg-options "" } ++ ++__attribute__((target ("default"))) ++void foo (void) // { dg-error "previously defined here" } ++{ ++} ++ ++__attribute__((target (128))) ++void foo (void) // { dg-error "(not a string|redefinition)" } ++{ ++} +--- gcc/testsuite/g++.dg/ext/mv8.C.jj 2013-01-21 11:41:17.147836101 +0100 ++++ gcc/testsuite/g++.dg/ext/mv8.C 2013-01-21 11:45:13.493544256 +0100 +@@ -0,0 +1,7 @@ ++// { dg-do compile { target i?86-*-* x86_64-*-* } } ++// { dg-options "" } ++ ++__attribute__((target (11,12))) ++void foo (void) // { dg-error "not a string" } ++{ ++} +--- gcc/testsuite/g++.dg/ext/mv9.C.jj 2013-01-21 11:44:31.634774921 +0100 ++++ gcc/testsuite/g++.dg/ext/mv9.C 2013-01-21 11:45:18.275516266 +0100 +@@ -0,0 +1,9 @@ ++// { dg-do compile { target i?86-*-* x86_64-*-* } } ++// { dg-options "" } ++ ++void foo (); ++void foo () __attribute__((target ("sse4"))); ++void foo () __attribute__((target ("default"))); // { dg-error "previous declaration" } ++void foo () // { dg-error "attribute for multi-versioned" } ++{ ++} +--- gcc/testsuite/g++.dg/ext/mv10.C.jj 2013-01-21 12:12:29.354541630 +0100 ++++ gcc/testsuite/g++.dg/ext/mv10.C 2013-01-21 12:12:56.207392886 +0100 +@@ -0,0 +1,12 @@ ++// { dg-do assemble { target i?86-*-* x86_64-*-* } } ++// { dg-options "" } ++ ++__attribute__((target ("popcnt"), used)) ++void foo (void) ++{ ++} ++ ++__attribute__((target ("popcnt","avx"), used)) ++void foo (void) ++{ ++} +--- gcc/testsuite/g++.dg/ext/mv11.C.jj 2013-01-21 12:16:26.381285535 +0100 ++++ gcc/testsuite/g++.dg/ext/mv11.C 2013-01-21 12:17:33.380918996 +0100 +@@ -0,0 +1,23 @@ ++// { dg-do compile { target i?86-*-* x86_64-*-* } } ++// { dg-options "-msse2" } ++ ++int foo () __attribute__ ((target("default"))); ++int foo () __attribute__ ((target("sse2"))); ++ ++int ++main () ++{ ++ return foo (); ++} ++ ++int __attribute__ ((target("default"))) ++foo () ++{ ++ return 0; ++} ++ ++int __attribute__ ((target("sse2"))) ++foo () ++{ ++ return 0; ++} diff --git a/gcc48-pr55844.patch b/gcc48-pr55844.patch deleted file mode 100644 index f4e7f7b..0000000 --- a/gcc48-pr55844.patch +++ /dev/null @@ -1,15 +0,0 @@ -2012-12-19 Jakub Jelinek - - PR sanitizer/55844 - * c-c++-common/asan/null-deref-1.c: Add -fno-shrink-wrap to - dg-options. - ---- gcc/testsuite/c-c++-common/asan/null-deref-1.c.jj 2012-12-13 00:02:50.000000000 +0100 -+++ gcc/testsuite/c-c++-common/asan/null-deref-1.c 2012-12-19 12:30:05.354962160 +0100 -@@ -1,5 +1,5 @@ - /* { dg-do run } */ --/* { dg-options "-fno-omit-frame-pointer" } */ -+/* { dg-options "-fno-omit-frame-pointer -fno-shrink-wrap" } */ - /* { dg-additional-options "-mno-omit-leaf-frame-pointer" { target { i?86-*-* x86_64-*-* } } } */ - /* { dg-shouldfail "asan" } */ - diff --git a/sources b/sources index b2fdb99..71effe7 100644 --- a/sources +++ b/sources @@ -1,4 +1,4 @@ +be78a47bd82523250eb3e91646db5b3d cloog-0.18.0.tar.gz 2659f09c2e43ef8b7d4406321753f1b2 fastjar-0.97.tar.gz -0aa3302c81f65ca62c114e5264f8a802 cloog-0.17.0.tar.gz -c1ece653891bb2a5f55ca25e3f4e8f35 isl-0.10.tar.bz2 -b9be0ed1988a3624a5f405666f72d220 gcc-4.8.0-20130106.tar.bz2 +bce1586384d8635a76d2f017fb067cd2 isl-0.11.1.tar.bz2 +f9dd93bbd1ad08bbbd71d2e3c36b0da0 gcc-4.8.0-20130121.tar.bz2