Bug 39308 - ICE when compiling with -O[s123] -floop-interchange
Summary: ICE when compiling with -O[s123] -floop-interchange
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 21:49 UTC by Daniel J.
Modified: 2009-02-27 16:43 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Preprocessed C source (from bzip2 sources) (8.74 KB, text/plain)
2009-02-25 21:49 UTC, Daniel J.
Details
1422_pr39308.diff (294 bytes, patch)
2009-02-26 20:10 UTC, sebpop@gmail.com
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel J. 2009-02-25 21:49:12 UTC
In almost any nontrivial C project, using GCC 4.4 SVN (rev 144432) results in an ICE when building with any nonzero value of -O and -floop-interchange.
Comment 1 Daniel J. 2009-02-25 21:49:49 UTC
Created attachment 17362 [details]
Preprocessed C source (from bzip2 sources)
Comment 2 Richard Biener 2009-02-26 10:05:49 UTC
Works for me.  What is the ICE?
Comment 3 Daniel J. 2009-02-26 14:27:09 UTC
$ gcc -O1 -floop-interchange -c huffman.c.pre

huffman.c: In function 'BZ2_hbCreateDecodeTables':
huffman.c:170: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.

$ gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.4.0_pre9999/work/gcc-4.4.0-9999/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.0-pre9999 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo SVN' --with-ppl --with-cloog
Thread model: posix
gcc version 4.4.0-pre9999 built 20090225 (experimental) rev. 144432 (Gentoo SVN)

I tried incrementally adding each optimization option flag that 'man gcc' says -O1 enables, but got a clean compile each time. Only with -O1 does the segfault get triggered.
Comment 4 Richard Biener 2009-02-26 14:40:35 UTC
Still works for me.  I suggest you file a bug with Gentoo, they may have local
patches applied.
Comment 5 Daniel J. 2009-02-26 17:00:19 UTC
Vanilla SVN, no patching. Still getting ICE segfault.

./configure --prefix=/usr/local --bindir=/usr/local/x86_64-pc-linux-gnu/gcc-bin/4.4.0-pre9999 --includedir=/usr/local/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include --datadir=/usr/local/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999 --mandir=/usr/local/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/man --infodir=/usr/local/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/info --with-gxx-include-dir=/usr/local/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --disable-libgcj --enable-languages=c --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-pkgversion="SVN" --with-ppl --with-cloog
$ make && make install

$ /usr/local/x86_64-pc-linux-gnu/gcc-bin/4.4.0-pre9999/gcc -v
Using built-in specs.
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/usr/local --bindir=/usr/local/x86_64-pc-linux-gnu/gcc-bin/4.4.0-pre9999 --includedir=/usr/local/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include --datadir=/usr/local/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999 --mandir=/usr/local/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/man --infodir=/usr/local/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/info --with-gxx-include-dir=/usr/local/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --disable-libgcj --enable-languages=c --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-pkgversion=SVN --with-ppl --with-cloog
Thread model: posix
gcc version 4.4.0 20090225 (experimental) (SVN)

$ /usr/local/x86_64-pc-linux-gnu/gcc-bin/4.4.0-pre9999/gcc -O1 -floop-interchange -c huffman.c.pre
huffman.c: In function 'BZ2_hbCreateDecodeTables':
huffman.c:170: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 6 Daniel J. 2009-02-26 18:53:05 UTC
Richard, can you post your `gcc -v` so I can make sure my config options are the same as yours?  Also, are you using cloog-ppl from git?  I am using 0.15 from ftp://gcc.gnu.org/pub/gcc/infrastructure/ .
Comment 7 Sebastian Pop 2009-02-26 19:20:48 UTC
Your testcase works for me too on trunk rev 144404.

I suggest that you do the following:

$ gdb build/gcc/cc1
(gdb) run -O2 -floop-interchange .../huffman.c.pre
...
(gdb) bt

and report the backtrace you get on the ICE.

Sebastian
Comment 8 Sebastian Pop 2009-02-26 19:22:37 UTC
I tried with the following compiler:

$ ./xgcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --enable-languages=c,fortran --disable-bootstrap : (reconfigured)  : (reconfigured) 
Thread model: posix
gcc version 4.4.0 20090224 (experimental) (GCC) 
Comment 9 Daniel J. 2009-02-26 19:46:16 UTC
Thanks, Sebastian.  I followed your directions, except I used -O1 instead of -O2. Here's the backtrace:

#0  is_gimple_val (t=0x0) at ../.././gcc/gimple.c:2853
#1  0x000000000055dec4 in force_gimple_operand (expr=0x0, stmts=0x7fffdc78a538, simple=1 '\001', var=0x0) at ../.././gcc/gimplify.c:7592
#2  0x000000000097fc22 in build_scop_loop_nests (scop=0x12ce530) at ../.././gcc/graphite.c:2387
#3  0x0000000000981f1a in limit_scops () at ../.././gcc/graphite.c:6081
#4  0x0000000000983de7 in graphite_transform_loops () at ../.././gcc/graphite.c:6124
#5  0x00000000006cd137 in graphite_transforms () at ../.././gcc/tree-ssa-loop.c:298
#6  0x00000000005b87ca in execute_one_pass (pass=0xe8ab60) at ../.././gcc/passes.c:1277
#7  0x00000000005b89b0 in execute_pass_list (pass=0xe8ab60) at ../.././gcc/passes.c:1326
#8  0x00000000005b89c5 in execute_pass_list (pass=0xe8a8c0) at ../.././gcc/passes.c:1327
#9  0x00000000005b89c5 in execute_pass_list (pass=0xe89d80) at ../.././gcc/passes.c:1327
#10 0x0000000000678bca in tree_rest_of_compilation (fndecl=0x7fbcd2977100) at ../.././gcc/tree-optimize.c:420
#11 0x0000000000789665 in cgraph_expand_function (node=0x7fbcd2977700) at ../.././gcc/cgraphunit.c:1047
#12 0x000000000078ab00 in cgraph_optimize () at ../.././gcc/cgraphunit.c:1106
#13 0x0000000000413dcb in c_write_global_declarations () at ../.././gcc/c-decl.c:8102
#14 0x000000000064301e in toplev_main (argc=<value optimized out>, argv=<value optimized out>) at ../.././gcc/toplev.c:981
#15 0x00007fbcd315c60d in __libc_start_main () from /lib/libc.so.6
#16 0x0000000000405229 in _start ()
Comment 10 sebpop@gmail.com 2009-02-26 20:10:37 UTC
Subject: Re:  ICE when compiling with -O[s123] 
	-floop-interchange

Hi,

Can you try this patch.  It should fix your problem.  I will bootstrap
and test the
patch and send it for review.

Thanks,
Sebastian Pop
--
AMD - GNU Tools



On Thu, Feb 26, 2009 at 13:46, il dot basso dot buffo at gmail dot com
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #9 from il dot basso dot buffo at gmail dot com  2009-02-26 19:46 -------
> Thanks, Sebastian.  I followed your directions, except I used -O1 instead of
> -O2. Here's the backtrace:
>
> #0  is_gimple_val (t=0x0) at ../.././gcc/gimple.c:2853
> #1  0x000000000055dec4 in force_gimple_operand (expr=0x0, stmts=0x7fffdc78a538,
> simple=1 '\001', var=0x0) at ../.././gcc/gimplify.c:7592
> #2  0x000000000097fc22 in build_scop_loop_nests (scop=0x12ce530) at
> ../.././gcc/graphite.c:2387
> #3  0x0000000000981f1a in limit_scops () at ../.././gcc/graphite.c:6081
> #4  0x0000000000983de7 in graphite_transform_loops () at
> ../.././gcc/graphite.c:6124
> #5  0x00000000006cd137 in graphite_transforms () at
> ../.././gcc/tree-ssa-loop.c:298
> #6  0x00000000005b87ca in execute_one_pass (pass=0xe8ab60) at
> ../.././gcc/passes.c:1277
> #7  0x00000000005b89b0 in execute_pass_list (pass=0xe8ab60) at
> ../.././gcc/passes.c:1326
> #8  0x00000000005b89c5 in execute_pass_list (pass=0xe8a8c0) at
> ../.././gcc/passes.c:1327
> #9  0x00000000005b89c5 in execute_pass_list (pass=0xe89d80) at
> ../.././gcc/passes.c:1327
> #10 0x0000000000678bca in tree_rest_of_compilation (fndecl=0x7fbcd2977100) at
> ../.././gcc/tree-optimize.c:420
> #11 0x0000000000789665 in cgraph_expand_function (node=0x7fbcd2977700) at
> ../.././gcc/cgraphunit.c:1047
> #12 0x000000000078ab00 in cgraph_optimize () at ../.././gcc/cgraphunit.c:1106
> #13 0x0000000000413dcb in c_write_global_declarations () at
> ../.././gcc/c-decl.c:8102
> #14 0x000000000064301e in toplev_main (argc=<value optimized out>, argv=<value
> optimized out>) at ../.././gcc/toplev.c:981
> #15 0x00007fbcd315c60d in __libc_start_main () from /lib/libc.so.6
> #16 0x0000000000405229 in _start ()
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39308
>
>
Comment 11 sebpop@gmail.com 2009-02-26 20:10:37 UTC
Created attachment 17369 [details]
1422_pr39308.diff
Comment 12 Daniel J. 2009-02-26 20:57:25 UTC
Affirmative, this patch seems to do the trick.  Thanks!
Comment 13 Sebastian Pop 2009-02-26 22:01:08 UTC
Subject: Bug 39308

Author: spop
Date: Thu Feb 26 22:00:53 2009
New Revision: 144455

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144455
Log:
2009-02-26  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/39308
	* graphite-clast-to-gimple.c (graphite_loop_normal_form): Do not call
        number_of_iterations_exit from a gcc_assert.


Modified:
    branches/graphite/gcc/ChangeLog.graphite
    branches/graphite/gcc/graphite-clast-to-gimple.c

Comment 14 Sebastian Pop 2009-02-27 16:42:57 UTC
Subject: Bug 39308

Author: spop
Date: Fri Feb 27 16:42:38 2009
New Revision: 144470

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144470
Log:
2009-02-27  Sebastian Pop  <sebastian.pop@amd.com>

	PR middle-end/39308
	* graphite.c (graphite_loop_normal_form): Do not call 
	number_of_iterations_exit from a gcc_assert.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/graphite.c

Comment 15 Sebastian Pop 2009-02-27 16:43:55 UTC
Fixed.