new regression, likely caused by pointer-plus branch merge extracted from Wine /home/marcus/projects/gcc/BIN/bin/gcc -m32 -O2 -c vertexbuffer.i vertexbuffer.i: In function 'f': vertexbuffer.i:1: internal compiler error: in build2_stat, at tree.c:3074
Created attachment 13734 [details] vertexbuffer.i gcc -O2 -c vertexbuffer.i
This is IV-opts going funny I think as we get pointer+pointer (and yes real pointer SSA_NAMES and no casts).
This code itself is very weird and I don't know if it is really defined or not. We have basically: char *f(char *a, char *b) { return a + (int)b; } How can that even be defined. Anyways the following fixes the problem: Index: tree-ssa-address.c =================================================================== --- tree-ssa-address.c (revision 125776) +++ tree-ssa-address.c (working copy) @@ -423,9 +423,9 @@ /* Add ELT to base. */ type = TREE_TYPE (parts->base); - parts->base = fold_build2 (PLUS_EXPR, type, + parts->base = fold_build2 (POINTER_PLUS_EXPR, type, parts->base, - fold_convert (type, elt)); + fold_convert (sizetype, elt)); } /* Finds the most expensive multiplication in ADDR that can be Though I have not tested it at all.
The testcase indeed looks undefined (but valid).
i have tested it and it works. (i have also fixed the Wine code ;)
Mine.
This makes bootstrap fail on alphaev68-linux: /src/gcc-2007.06.27/build/./gcc/xgcc -B/src/gcc-2007.06.27/build/./gcc/ -B/usr/local/alphaev68-unknown-linux-gnu/bin/ -B/usr/local/alphaev68-unknown-linux-gnu/lib/ -isystem /usr/local/alphaev68-unknown-linux-gnu/include -isystem /usr/local/alphaev68-unknown-linux-gnu/sys-include -g -fkeep-inline-functions -O2 -O2 -g -O2 -mieee -DIN_GCC -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -mieee -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../.././gcc -I../../../libgcc -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include -o _gcov_execl.o -MT _gcov_execl.o -MD -MP -MF _gcov_execl.dep -DL_gcov_execl -c ../../../libgcc/../gcc/libgcov.c ../../../libgcc/../gcc/libgcov.c: In function '__gcov_execl': ../../../libgcc/../gcc/libgcov.c:838: internal compiler error: in build2_stat, at tree.c:3074 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. make[3]: *** [_gcov_execl.o] Error 1 make[3]: Leaving directory `/src/gcc-2007.06.27/build/alphaev68-unknown-linux-gnu/libgcc' This happens as soon as varargs are used: $ cat test.c void f(int x, ...) { __builtin_va_list ap; __builtin_va_start(ap, x); } $ /src/gcc-2007.06.27/build/gcc/xgcc -B/src/gcc-2007.06.27/build/gcc/ -c test.c test.c: In function 'f': test.c:3: internal compiler error: in build2_stat, at tree.c:3074 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Subject: Re: [4.3 Regression] ICE in build2_stat, at tree.c:3074 On 27 Jun 2007 15:37:26 -0000, falk at debian dot org <gcc-bugzilla@gcc.gnu.org> wrote: > > > ------- Comment #7 from falk at debian dot org 2007-06-27 15:37 ------- > This makes bootstrap fail on alphaev68-linux: This is a different bug, related to the alpha backend was not fix up for pointer plus. Please file seperately. Thanks, Andrew Pinski
Andrew, do you want to convert to sizetype or to ptrdiff_t? Does it matter?
(In reply to comment #9) > Andrew, do you want to convert to sizetype or to ptrdiff_t? Does it matter? sizetype is correct for POINTER_PLUS_EXPR. We don't have a ptrdiff_t internally inside GCC as far as I know, only ssizetype (the signed version of sizetype). I am testing this patch right now and should be done in about 2 hours.
Subject: Bug 32399 Author: pinskia Date: Sat Aug 4 00:33:31 2007 New Revision: 127196 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=127196 Log: 2007-08-03 Andrew Pinski <andrew_pinski@playstation.sony.com> PR middle-end/32399 * tree-ssa-address.c (add_to_parts): Use POINTER_PLUS_EXPR when adding to the base and convert ELT to sizetype instead of type. 2007-08-03 Andrew Pinski <andrew_pinski@playstation.sony.com> RP middle-end/32399 * gcc.c-torture/compile/pr32399.c: New testcase. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr32399.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-ssa-address.c
Fixed.