With gcc mainline (20030707) and the patch for 11043, when building a combined tree for arc-
elf32, I get:
Making all in stdio
make: Entering directory `/home/dara/mainline/objdir/arc-elf32/newlib/libc/stdio'
/home/dara/mainline/objdir/gcc/xgcc -B/home/dara/mainline/objdir/gcc/ -nostdinc -B/home/
dara/mainline/objdir/arc-elf32/newlib/ -isystem /home/dara/mainline/objdir/arc-elf32/newlib/
targ-include -isystem /home/dara/mainline/src/newlib/libc/include -B/usr/local/arc-elf32/arc-
elf32/bin/ -B/usr/local/arc-elf32/arc-elf32/lib/ -isystem /usr/local/arc-elf32/arc-elf32/include
-isystem /usr/local/arc-elf32/arc-elf32/sys-include -L/home/dara/mainline/objdir/ld -
DPACKAGE=\"newlib\" -DVERSION=\"1.11.0\" -I. -I../../../../../src/newlib/libc/stdio -O2 -fno-
builtin -O2 -g -O2 -O2 -O2 -save-temps -fshort-enums -c ../../../../../src/newlib/libc/stdio/
../../../../../src/newlib/libc/stdio/vfprintf.c: In function `_vfprintf_r':
../../../../../src/newlib/libc/stdio/vfprintf.c:767: internal compiler error: in build, at tree.c:2378
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [vfprintf.o] Error 1
make: Leaving directory `/home/dara/mainline/objdir/arc-elf32/newlib/libc/stdio'
Testcase also failes with -O0.
Created attachment 4369 [details]
testcase from newlib
I can confirm this on the mainline (20030709):
Here is the simplified case:
typedef __builtin_va_list __gnuc_va_list;
typedef __gnuc_va_list va_list;
_vfprintf_r(int i , va_list ap)
Suspending until ARC gets a maintainer.
FWIW it's still present on mainline (20030821).
I think the problem is that the "long double" type is 0 aka not defined as something or arc does
not support "long double" in __builtin_va_arg yet.
This should be suspended still.
This is caused by a lack of long double support.
Also anything else that requires floating point support will
probably fail as well, since soft-float is not support either.
*** Bug 17240 has been marked as a duplicate of this bug. ***
In continuation with this bug, we figured out that there were a few calls to
build with unary operators without side effects. The exact place in tree.c where
this fails had the following comment .
/* The only one-operand cases we handle here are those with side-effects.
Others are handled with build1. So don't bother checked if the
arg has side-effects since we'll already have set it.
??? This really should use build1 too. */
if (TREE_CODE_CLASS (code) != 's')
In the case for all these aborts the nodes being passed were unary operators,
for example (INDIRECT_REF which has a code of 'r' ) which is not a side effect
The following patch fixes this .
2004-09-04 Ramana Radhakrishnan <firstname.lastname@example.org>
* Fix calls to build for unary operators without sideeffects for ARC.
--- arc.c.orig 2004-09-04 16:00:15.000000000 +0530
+++ arc.c 2004-09-04 16:00:42.000000000 +0530
@@ -2284,8 +2284,8 @@
tree type_ptr_ptr = build_pointer_type (type_ptr);
- addr = build (INDIRECT_REF, type_ptr,
- build (NOP_EXPR, type_ptr_ptr, valist));
+ addr = build1 (INDIRECT_REF, type_ptr,
+ build1 (NOP_EXPR, type_ptr_ptr, valist));
incr = build (PLUS_EXPR, TREE_TYPE (valist),
valist, build_int_2 (UNITS_PER_WORD, 0));
@@ -2305,12 +2305,12 @@
/* AP = (TYPE *)(((int)AP + 7) & -8) */
- addr = build (NOP_EXPR, integer_type_node, valist);
+ addr = build1 (NOP_EXPR, integer_type_node, valist);
addr = fold (build (PLUS_EXPR, integer_type_node, addr,
build_int_2 (7, 0)));
addr = fold (build (BIT_AND_EXPR, integer_type_node, addr,
build_int_2 (-8, 0)));
- addr = fold (build (NOP_EXPR, TREE_TYPE (valist), addr));
+ addr = fold (build1 (NOP_EXPR, TREE_TYPE (valist), addr));
/* The increment is always rounded_size past the aligned pointer. */
and continues with the build.
I should note that is only for 3.4 as 3.5 changes how fold works and now build1 is really called when
build is called with one parameter.
Subject: Bug 11476
Module name: gcc
Changes by: email@example.com 2004-09-11 21:15:21
gcc : ChangeLog
gcc/config/arc : arc.c
2004-09-11 Ramana Radhakrishnan <firstname.lastname@example.org>
* gcc/config/arc/arc.c (arc_va_args): Call build1 instead
of build for unary tree operators.
Fixed. I should note this does not need fixing on the mainline because of the change in build and that
the code which did this was removed.