aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSriraman Tallam <tmsriram@google.com>2013-06-08 00:38:09 +0000
committerSriraman Tallam <tmsriram@gcc.gnu.org>2013-06-08 00:38:09 +0000
commit7f678e7ebc55b6bfef2c2a4f0bcaecc82c37ec4c (patch)
treeb0c18312b6bbddd50994cdd1ed939fba03796569 /gcc
parentdac71dd7b5ccfc4d74e062bbd0c3aaf483ab3c9c (diff)
downloadgcc-7f678e7ebc55b6bfef2c2a4f0bcaecc82c37ec4c.zip
gcc-7f678e7ebc55b6bfef2c2a4f0bcaecc82c37ec4c.tar.gz
gcc-7f678e7ebc55b6bfef2c2a4f0bcaecc82c37ec4c.tar.bz2
re PR c++/57548 (calling gnu multiversioned function at file scope causes ICE)
Fixes PR 57548. 2013-06-07 Sriraman Tallam <tmsriram@google.com> PR c++/57548 * cp/call.c (build_over_call): Check if current_function_decl is NULL. * testsuite/g++.dg/ext/pr57548.C: New test. From-SVN: r199842
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cp/call.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/pr57548.C25
4 files changed, 38 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a149b8..31d487a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-06-07 Sriraman Tallam <tmsriram@google.com>
+
+ PR c++/57548
+ * cp/call.c (build_over_call): Check if current_function_decl is
+ NULL.
+
2013-06-07 Jan Hubicka <jh@suse.cz>
* symtab.c (symtab_resolve_alias): Do not remove alias attribute.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 0b6a83f..dfd061a 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -7053,7 +7053,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
otherwise the call should go through the dispatcher. */
if (DECL_FUNCTION_VERSIONED (fn)
- && !targetm.target_option.can_inline_p (current_function_decl, fn))
+ && (current_function_decl == NULL
+ || !targetm.target_option.can_inline_p (current_function_decl, fn)))
{
fn = get_function_version_dispatcher (fn);
if (fn == NULL)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 55a3ce6..65c0770 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-06-07 Sriraman Tallam <tmsriram@google.com>
+
+ PR c++/57548
+ * testsuite/g++.dg/ext/pr57548.C: New test.
+
2013-06-07 Balaji V. Iyer <balaji.v.iyer@intel.com>
PR middle-end/57541
diff --git a/gcc/testsuite/g++.dg/ext/pr57548.C b/gcc/testsuite/g++.dg/ext/pr57548.C
new file mode 100644
index 0000000..1cc728d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/pr57548.C
@@ -0,0 +1,25 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-require-ifunc "" } */
+
+int fum (); // Extra declaration that is merged with the second one.
+int fum () __attribute__ ((target("default")));
+
+
+int fum () __attribute__((target( "mmx")));
+int fum () __attribute__((target( "popcnt")));
+int fum () __attribute__((target( "sse")));
+int fum () __attribute__((target( "sse2")));
+int fum () __attribute__((target( "sse3")));
+int fum () __attribute__((target( "ssse3")));
+int fum () __attribute__((target( "sse4.1")));
+int fum () __attribute__((target( "sse4.2")));
+int fum () __attribute__((target( "avx")));
+int fum () __attribute__((target( "avx2")));
+
+int fum () __attribute__((target("arch=core2")));
+int fum () __attribute__((target("arch=corei7")));
+int fum () __attribute__((target("arch=atom")));
+
+int (*p)() = &fum;
+
+int j = fum();