OSDN Git Service

Fix for PR c++/43375
authordodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 20 Mar 2010 08:55:32 +0000 (08:55 +0000)
committerdodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 20 Mar 2010 08:55:32 +0000 (08:55 +0000)
gcc/cp/ChangeLog:
PR c++/43375
* method.c (make_alias_for): Avoid crashing when DECL_LANG_SPECIFIC
is NULL.
* decl2.c (vague_linkage_p): Likewise.

gcc/testsuite/g++.dg/ChangeLog:
PR c++/43375
* g++.dg/abi/mangle42.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157590 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/cp/method.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/mangle42.C [new file with mode: 0644]

index eecdd1a..41fb792 100644 (file)
@@ -1,3 +1,10 @@
+2010-03-20  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/43375
+       * method.c (make_alias_for): Avoid crashing when DECL_LANG_SPECIFIC
+       is NULL.
+       * decl2.c (vague_linkage_p): Likewise.
+
 2010-03-18  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/43418
index 81d7ee3..4e4930a 100644 (file)
@@ -1655,7 +1655,8 @@ vague_linkage_p (tree decl)
   return (DECL_COMDAT (decl)
          || (((TREE_CODE (decl) == FUNCTION_DECL
                && DECL_DECLARED_INLINE_P (decl))
-              || DECL_TEMPLATE_INSTANTIATION (decl))
+              || (DECL_LANG_SPECIFIC (decl)
+                  && DECL_TEMPLATE_INSTANTIATION (decl)))
              && TREE_PUBLIC (decl)));
 }
 
index a93ad06..5ed98bc 100644 (file)
@@ -221,12 +221,15 @@ make_alias_for (tree target, tree newid)
   TREE_THIS_VOLATILE (alias) = TREE_THIS_VOLATILE (target);
   TREE_PUBLIC (alias) = 0;
   DECL_INTERFACE_KNOWN (alias) = 1;
-  DECL_NOT_REALLY_EXTERN (alias) = 1;
+  if (DECL_LANG_SPECIFIC (alias))
+    {
+      DECL_NOT_REALLY_EXTERN (alias) = 1;
+      DECL_USE_TEMPLATE (alias) = 0;
+      DECL_TEMPLATE_INFO (alias) = NULL;
+    }
   DECL_EXTERNAL (alias) = 0;
   DECL_ARTIFICIAL (alias) = 1;
-  DECL_USE_TEMPLATE (alias) = 0;
   DECL_TEMPLATE_INSTANTIATED (alias) = 0;
-  DECL_TEMPLATE_INFO (alias) = NULL;
   if (TREE_CODE (alias) == FUNCTION_DECL)
     {
       DECL_SAVED_FUNCTION_DATA (alias) = NULL;
index 8e5ca1f..f0d88f0 100644 (file)
@@ -1,3 +1,8 @@
+2010-03-20  Dodji Seketeli  <dodji@redhat.com>
+
+       PR c++/43375
+       * g++.dg/abi/mangle42.C: New test.
+
 2010-03-19  Andrew Pinski  <andrew_pinski@caviumnetworks.com>
 
        PR C/43211
diff --git a/gcc/testsuite/g++.dg/abi/mangle42.C b/gcc/testsuite/g++.dg/abi/mangle42.C
new file mode 100644 (file)
index 0000000..730781b
--- /dev/null
@@ -0,0 +1,14 @@
+// Origin: PR c++/43375
+// { dg-do compile { target i?86-*-* x86_64-*-* } }
+// { dg-options "-msse2 -std=gnu++0x" }
+
+typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+typedef int __v4si __attribute__ ((__vector_size__ (16)));
+__v4sf my_asin(__v4sf x)
+{
+  static const __v4si g_Mask{0x7fffffff,
+                            0x00000000,
+                            0x7fffffff,
+                            0x7fffffff };
+  return __builtin_ia32_andnps ((__v4sf) g_Mask, x);
+}