Bug 53571 - [4.7 regression] ICE with -O{2,3} -floop-parallelize-all in cloog_domain_stride()
Summary: [4.7 regression] ICE with -O{2,3} -floop-parallelize-all in cloog_domain_str...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.6.3
: P2 normal
Target Milestone: 4.8.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-04 08:00 UTC by Kacper Kowalik
Modified: 2014-06-12 13:11 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.5.3, 4.8.0
Known to fail: 4.6.3, 4.7.0, 4.7.4
Last reconfirmed: 2012-06-04 00:00:00


Attachments
reduced testcase (275 bytes, text/x-c)
2012-06-04 08:00 UTC, Kacper Kowalik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kacper Kowalik 2012-06-04 08:00:47 UTC
Created attachment 27552 [details]
reduced testcase

0x00007ffff7bcc1d5 in cloog_domain_stride () from /usr/lib64/libcloog.so.0
(gdb) bt
#0  0x00007ffff7bcc1d5 in cloog_domain_stride () from /usr/lib64/libcloog.so.0
#1  0x00007ffff7bc1ecf in ?? () from /usr/lib64/libcloog.so.0
#2  0x00007ffff7bc171b in cloog_loop_generate () from /usr/lib64/libcloog.so.0
#3  0x00007ffff7bd2f69 in cloog_program_generate () from /usr/lib64/libcloog.so.0
#4  0x0000000000d593ec in scop_to_clast ()
#5  0x0000000000d5961e in gloog ()
#6  0x0000000000d55763 in graphite_transform_loops ()
#7  0x000000000091a269 in graphite_transforms ()
#8  0x0000000000759059 in execute_one_pass ()
#9  0x0000000000759233 in execute_pass_list ()
#10 0x0000000000759254 in execute_pass_list ()
#11 0x0000000000759254 in execute_pass_list ()
#12 0x0000000000759254 in execute_pass_list ()
#13 0x000000000088eae1 in tree_rest_of_compilation ()
#14 0x0000000000a49d0b in cgraph_expand_function ()
#15 0x0000000000a49eca in cgraph_expand_all_functions ()
#16 0x0000000000a4a533 in cgraph_optimize ()
#17 0x0000000000a48b22 in cgraph_finalize_compilation_unit ()
#18 0x000000000049de30 in c_write_global_declarations ()
#19 0x000000000083006e in compile_file ()
#20 0x0000000000832000 in do_compile ()
#21 0x0000000000832146 in toplev_main ()
#22 0x0000000000521118 in main ()

Downstream bug: https://bugs.gentoo.org/show_bug.cgi?id=361953
Comment 1 Richard Biener 2012-06-04 10:07:39 UTC
Please specify the cloog/ppl versions you are using.  What target is this on?
Comment 2 Kacper Kowalik 2012-06-04 10:11:09 UTC
(In reply to comment #1)
> Please specify the cloog/ppl versions you are using.  What target is this on?

dev-libs/cloog-ppl-0.15.10
dev-libs/ppl-0.11.2-r1

Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /dev/shm/portage/sys-devel/gcc-4.6.3/work/gcc-4.6.3/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.6.3 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.6.3/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-ppl-version-check --with-cloog-include=/usr/include/cloog-ppl --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.6.3/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.6.3 p1.3, pie-0.5.1'
Thread model: posix
gcc version 4.6.3 (Gentoo 4.6.3 p1.3, pie-0.5.1)
Comment 3 Kacper Kowalik 2012-06-04 18:23:12 UTC
Git bisect show this revision as a culprit:
http://gcc.gnu.org/viewcvs?view=revision&revision=163142
Comment 4 Tobias Burnus 2012-06-05 21:03:03 UTC
(In reply to comment #1)
> Please specify the cloog/ppl versions you are using.  What target is this on?

I can reproduce it with the current GCC trunk on openSUSE Factory (x86-64) [package libcloog0-debuginfo-0.15.10+ppl-9.8].

Program received signal SIGSEGV, Segmentation fault.

#0  0x00002aaaaace1656 in cloog_domain_stride (domain=<optimized out>, strided_level=<optimized out>, 
    nb_par=<optimized out>, stride=0x7fffffffd5e0, offset=0x7fffffffd5d0) at source/ppl/domain.c:2813
#1  0x00002aaaaacd7b21 in cloog_loop_stride_1 (nb_par=2, level=1, loop=0x15a8c20) at source/loop.c:1077
#2  cloog_loop_generate_general (loop=0x0, level=1, scalar=1, scaldims=0x158b000, nb_scattdims=3, 
    nb_par=<optimized out>, options=0x1596780) at source/loop.c:1371
#3  0x00002aaaaacd71f3 in cloog_loop_generate_scalar (options=0x1596780, nb_par=2, nb_scattdims=3, 
    scaldims=0x158b000, scalar=0, level=1, loop=0x159c930) at source/loop.c:1489
#4  cloog_loop_generate (loop=<optimized out>, context=0x0, level=1, scalar=0, scaldims=0x158b000, 
    nb_scattdims=3, nb_par=2, options=0x1596780) at source/loop.c:1573
#5  0x00002aaaaace834b in cloog_program_generate (program=0x1595d00, options=0x1596780) at source/program.c:687
#6  0x0000000000cd34b5 in scop_to_clast (scop=0x158e890)
    at /home/tob/projects/gcc-git/gcc/gcc/graphite-clast-to-gimple.c:1551
#7  0x0000000000cd36d5 in gloog (scop=0x158e890, bb_pbb_mapping=0x158e4f0)
    at /home/tob/projects/gcc-git/gcc/gcc/graphite-clast-to-gimple.c:1632
#8  0x0000000000cd078e in graphite_transform_loops () at /home/tob/projects/gcc-git/gcc/gcc/graphite.c:276
#9  0x00000000009e2c87 in graphite_transforms () at /home/tob/projects/gcc-git/gcc/gcc/tree-ssa-loop.c:254

The failing line is:
      cloog_vector_gcd (U->p[0], U->NbColumns, stride);
The problem is that U->p == NULL.

And U is initialized via cloog_solve_diophantine,
  cloog_matrix_hermite (temp, &hermi, &unimod);
  rank = cloog_dio_get_first_diagonal_zero (hermi);
  nbc = temp->NbColumns;
...
  *u = cloog_dio_init_U (unimodinv, hermi->NbColumns, rank);

In the latter, one has:
  if (rank == n)
    return cloog_matrix_alloc (0, 0);

And according to gdb rank==2 (the other arguments are optimized out). Well, and for a 0 argument, cloog_matrix_alloc sets u->p to NULL.
Comment 5 Richard Biener 2012-12-03 15:31:24 UTC
Works with ISL based Graphite, still broken on the 4.7 branch at least.
Comment 6 Jakub Jelinek 2013-04-12 15:17:15 UTC
GCC 4.6.4 has been released and the branch has been closed.
Comment 7 Richard Biener 2014-06-12 13:11:12 UTC
Fixed for 4.8.0.