ia64 bootstrap failure, C++ front-end and md builtin function conflict

Jim Wilson wilson@cygnus.com
Mon Nov 27 17:00:00 GMT 2000


I am getting an odd looking error message when a bootstrap tries to build
libstdc++.

/blp/wilson/GCC/X-blp/gcc/include/ia64intrin.h:44: too few arguments to 
   function `int __sync_fetch_and_add_si(int*, int, void, ...)'
../include/bits/atomicity.h:31: at this point in file

The problem here is that we used to mark the end of an argument list with
an argument of void_type_node.  The C and C++ front ends now use void_list_node
to mark the end of the list, where void_list_node is a list node containing
void_type_node.  Unfortunately, the machine dependent builtin functions are
still constructing argument lists using void_type_node.  The result is that
the C++ front end looks for void_list_node, doesn't find it, and ends up
thinking that the function is varargs with a last named argument which is
void type.  The C front end still works however, because it is still checking
for void_type_node instead of void_list_node.

I tried to fix this by changing the config/ia64/ia64.c file to use
void_list_node for the variable endlink in ia64_init_builtins, but I ran into
a problem.  This variable is declared in c-common.h, and only defined in the
C/C++ front ends.  So if I make this change, then I can build libstdc++, but I
can no longer build the Fortran front end.

This is no good.  We can fix this by changing the C++ front end to check for
void_type_node instead of void_list_node.  We can also fix this by making
void_list_node available to all front ends.  There are probably other ways
to fix this too.

I believe that only the ia64 and ia32 (i386) ports have machine dependent
builtin functions.  I can prove that the ia64 backend is broken.  I haven't
proven that the ia32 backend is broken, but it likely is also.

Simple testcase for ia64:

extern int __sync_val_compare_and_swap_si (int *, int, int);

void
sub (int *a, int b, int c)
{
  __sync_val_compare_and_swap_si (a, b, c);
}

Script started on Mon Nov 27 16:45:41 2000
bletchleypark$./cc1plus tmp2.c
 void sub(int*, int, int)
tmp2.c:1: too few arguments to function `int 
   __sync_val_compare_and_swap_si(int*, int, int, void, ...)'

tmp2.c:6: at this point in file
 void sub(int*, int, int)
tmp2.c:6: Internal error: Segmentation fault.
confused by earlier errors, bailing out
bletchleypark$exit
exit

Script done on Mon Nov 27 16:45:45 2000


More information about the Gcc-bugs mailing list