This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH [C++]: fix crash due to reconstruct_complex_type


The following patch fixes a crash in g++ when a function takes a const
parameter of vector pointer type.  Tested on powerpc-linux with no
testsuite regressions.  A test case is included.

I was unable to find a PR for this problem, despite it being a
regression between gcc 4.1.1 and 4.1.2.  If there is one, I can add the
PR number to the ChangeLog entry.

Okay for mainline?

Ben

2007-08-16  Sa Liu  <saliu@de.ibm.com>
            Ulrich Weigand  <uweigand@de.ibm.com>

        * tree.c (reconstruct_complex_type): For a pointer to a vector,
        use build_qualified_type to retain qualifiers of the base type.

Index: tree.c
===================================================================
--- tree.c      (revision 127568)
+++ tree.c      (working copy)
@@ -7609,10 +7609,7 @@ reconstruct_complex_type (tree type, tre
   else
     return bottom;
 
-  TYPE_READONLY (outer) = TYPE_READONLY (type);
-  TYPE_VOLATILE (outer) = TYPE_VOLATILE (type);
-
-  return outer;
+  return build_qualified_type (outer, TYPE_QUALS (type));
 }
 
 /* Returns a vector tree node given a mode (integer, vector, or BLKmode) and

2007-08-16  Ben Elliston  <bje@au.ibm.com>

        * g++.dg/ext/altivec-14.C: New test.

Index: testsuite/g++.dg/ext/altivec-14.C
===================================================================
--- testsuite/g++.dg/ext/altivec-14.C   (revision 0)
+++ testsuite/g++.dg/ext/altivec-14.C   (revision 0)
@@ -0,0 +1,13 @@
+/* { dg-do compile { target powerpc*-*-* } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-maltivec" } */
+
+void f (__attribute__((altivec(vector__))) signed int * a,
+       __attribute__((altivec(vector__))) signed int * const b);
+
+int
+foo (void)
+{
+  __attribute__((altivec(vector__))) signed int a[1], b[1];
+  f (a, b);
+}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]