This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
C++ frontend can not handle vector pointer constant parameter
- From: Sa Liu <SALIU at de dot ibm dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 2 Aug 2007 19:19:07 +0200
- Subject: C++ frontend can not handle vector pointer constant parameter
Hi all,
I have detected a bug in C++ frontend.
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.
I have a test case to show the incorrect behavior 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);
}
The error also occurs on other machines supporting vector type. I suppose
that some flags for the qualifier are not properly set.
Does someone knowing frontend well could provide any help?
Thanks!
Sa