[Bug c++/32970] New: C++ frontend can not handle vector pointer constant parameter

2007-08-02 Thread saliu at de dot ibm dot com
When compiling a function with parameter of a pointer to a vector constant 
type, the compiler calls a recursive function and is not able to get out. 

Concretely, in gcc/cp/mangle.c file, in function write_type:

  if (write_CV_qualifiers_for_type (type) > 0)
/* If TYPE was CV-qualified, we just wrote the qualifiers; now
   mangle the unqualified type.  The recursive call is needed here
   since both the qualified and unqualified types are substitution
   candidates.  */
write_type (TYPE_MAIN_VARIANT (type));

But TYPE_MAIN_VARIANT (type) has been set as type itself in gcc/tree.c 
function make_node_stat:
   case tcc_type:
...
  TYPE_MAIN_VARIANT (t) = t;

Therefor the write_type function runs into a dead recursion.

The bug was detected on spu, and the same error appears on PowerPC and Intel
too.

The following is a test case on Intel:

void bar(
int __attribute__((vector_size(16))) * a,
int __attribute__((vector_size(16))) * const b);

int instance(void)
{
   int __attribute__((vector_size(16))) a[1], b[1];

   bar(a, b);
}


-- 
   Summary: C++ frontend can not handle vector pointer constant
parameter
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: saliu at de dot ibm dot com
 GCC build triplet: powerpc64-unknown-linux-gnu
  GCC host triplet: powerpc64-unknown-linux-gnu
GCC target triplet: spu-unknown-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32970



[Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter

2007-08-07 Thread saliu at de dot ibm dot com


--- Comment #2 from saliu at de dot ibm dot com  2007-08-07 11:31 ---
Is this really a regression from 4.1.1? 
I got the same error on 4.1.1, before the patch r117696 was applied.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32970



[Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter

2007-08-08 Thread saliu at de dot ibm dot com


--- Comment #4 from saliu at de dot ibm dot com  2007-08-08 13:38 ---
Okey, I have a Red Hat GCC 4.1.1, which might be different from the FSF one.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32970



[Bug c++/32970] [4.3 Regression] C++ frontend can not handle vector pointer constant parameter

2007-08-10 Thread saliu at de dot ibm dot com


--- Comment #5 from saliu at de dot ibm dot com  2007-08-10 10:13 ---
This patch can fix the problem:

Index: gcc/tree.c
===
--- gcc.orig/tree.c
+++ gcc/tree.c
@@ -7609,8 +7609,11 @@ reconstruct_complex_type (tree type, tre
   else
 return bottom;

-  TYPE_READONLY (outer) = TYPE_READONLY (type);
-  TYPE_VOLATILE (outer) = TYPE_VOLATILE (type);
+  if  (TYPE_READONLY (type))
+build_qualified_type(outer, TYPE_QUAL_CONST);
+
+  if (TYPE_VOLATILE (type))
+build_qualified_type(outer, TYPE_QUAL_VOLATILE);

   return outer;
 }


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32970