Bug 55381 - [4.8 Regression]: build fails on cris-elf building libgfortran with host-gcc-4.4, ICE compiling matmul_i1.c
Summary: [4.8 Regression]: build fails on cris-elf building libgfortran with host-gcc-...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: 4.8.0
Assignee: Not yet assigned to anyone
URL:
Keywords: build, ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2012-11-18 16:53 UTC by Hans-Peter Nilsson
Modified: 2012-11-25 21:01 UTC (History)
3 users (show)

See Also:
Host: x86_64-unknown-linux-gnu
Target: cris-axis-elf
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
cc1 -fpreprocessed matmul_i1.i -melf -g -O2 -std=gnu99 -version -fcx-fortran-rules -ffunction-sections -fdata-sections -ftree-vectorize -funroll-loops -o matmul_i1.s (13.57 KB, text/plain)
2012-11-18 16:53 UTC, Hans-Peter Nilsson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Nilsson 2012-11-18 16:53:10 UTC
Created attachment 28724 [details]
cc1 -fpreprocessed matmul_i1.i -melf -g -O2  -std=gnu99 -version -fcx-fortran-rules -ffunction-sections -fdata-sections -ftree-vectorize -funroll-loops -o matmul_i1.s

Revision r193595 caused the build for cris-elf to fail as follows, with host-gcc gcc-4.4.3-4.fc12.x86_64 as well as gcc-4.4.4-10.fc12.x86_64:

libtool: compile:  /tmp/hpautotest-gcc0/cris-elf/gccobj/./gcc/xgcc -B/tmp/hpautotest-gcc0/cris-elf/gccobj/./gcc/ -nostdinc -B/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/newlib/ -isystem /tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/newlib/targ-include -isystem /tmp/hpautotest-gcc0/gcc/newlib/libc/include -B/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libgloss/cris -L/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libgloss/libnosys -L/tmp/hpautotest-gcc0/gcc/libgloss/cris -B/tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/bin/ -B/tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/lib/ -isystem /tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/include -isystem /tmp/hpautotest-gcc0/cris-elf/pre/cris-elf/sys-include -DHAVE_CONFIG_H -I. -I/tmp/hpautotest-gcc0/gcc/libgfortran -iquote/tmp/hpautotest-gcc0/gcc/libgfortran/io -I/tmp/hpautotest-gcc0/gcc/libgfortran/../gcc -I/tmp/hpautotest-gcc0/gcc/libgfortran/../gcc/config -I../.././gcc -I/tmp/hpautotest-gcc0/gcc/libgfortran/../libgcc -I../libgcc -std=gnu99 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -Wextra -Wwrite-strings -fcx-fortran-rules -ffunction-sections -fdata-sections -ftree-vectorize -funroll-loops -g -O2 -MT matmul_i1.lo -MD -MP -MF .deps/matmul_i1.Tpo -c /tmp/hpautotest-gcc0/gcc/libgfortran/generated/matmul_i1.c -o matmul_i1.o
/tmp/hpautotest-gcc0/gcc/libgfortran/generated/matmul_i1.c: In function 'matmul_i1':
/tmp/hpautotest-gcc0/gcc/libgfortran/generated/matmul_i1.c:79:1: internal compiler error: Illegal instruction
 matmul_i1 (gfc_array_i1 * const restrict retarray, 
 ^
0x85fbc5 crash_signal
        /tmp/hpautotest-gcc0/gcc/gcc/toplev.c:334
0xb37574 analyze_overlapping_iterations
        /tmp/hpautotest-gcc0/gcc/gcc/tree-data-ref.c:2958
0xb381d1 subscript_dependence_tester_1
        /tmp/hpautotest-gcc0/gcc/gcc/tree-data-ref.c:3510
0xb383aa subscript_dependence_tester
        /tmp/hpautotest-gcc0/gcc/gcc/tree-data-ref.c:3561
0xb398b6 compute_affine_dependence(data_dependence_relation*, loop*)
        /tmp/hpautotest-gcc0/gcc/gcc/tree-data-ref.c:4190
0xb3a38f compute_all_dependences(vec<data_reference*, va_heap, vl_ptr>, vec<data_dependence_relation*, va_heap, vl_ptr>*, vec<loop*, va_heap, vl_ptr>, bool)
        /tmp/hpautotest-gcc0/gcc/gcc/tree-data-ref.c:4259
0xb3a908 compute_data_dependences_for_loop(loop*, bool, vec<loop*, va_heap, vl_ptr>*, vec<data_reference*, va_heap, vl_ptr>*, vec<data_dependence_relation*, va_heap, vl_ptr>*)
        /tmp/hpautotest-gcc0/gcc/gcc/tree-data-ref.c:4545
0xb5de2c vect_analyze_data_refs(_loop_vec_info*, _bb_vec_info*, int*)
        /tmp/hpautotest-gcc0/gcc/gcc/tree-vect-data-refs.c:2975
0x9fcf40 vect_analyze_loop_2
        /tmp/hpautotest-gcc0/gcc/gcc/tree-vect-loop.c:1598
0x9fcf40 vect_analyze_loop(loop*)
        /tmp/hpautotest-gcc0/gcc/gcc/tree-vect-loop.c:1774
0xa1425b vectorize_loops()
        /tmp/hpautotest-gcc0/gcc/gcc/tree-vectorizer.c:114
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [matmul_i1.lo] Error 1
make[3]: Leaving directory `/tmp/hpautotest-gcc0/cris-elf/gccobj/cris-elf/libgfortran'

Committer of r193595 CC:ed.
Preprocessed matmul_i1.c attached.
Comment 1 Hans-Peter Nilsson 2012-11-18 17:04:03 UTC
Random cutnpasted suspicious warning, maybe related:

g++ -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I/tmp/hpautotest-gcc0/gcc/gcc -I/tmp/hpautotest-gcc0/gcc/gcc/build -I/tmp/hpautotest-gcc0/gcc/gcc/../include -I/tmp/hpautotest-gcc0/gcc/gcc/../libcpp/include -I/tmp/hpautotest-gcc0/cris-elf/gccobj/./gmp -I/tmp/hpautotest-gcc0/gcc/gmp -I/tmp/hpautotest-gcc0/cris-elf/gccobj/./mpfr -I/tmp/hpautotest-gcc0/gcc/mpfr -I/tmp/hpautotest-gcc0/gcc/mpc/src  -I/tmp/hpautotest-gcc0/gcc/gcc/../libdecnumber -I/tmp/hpautotest-gcc0/gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I/tmp/hpautotest-gcc0/gcc/gcc/../libbacktrace    \
		-o build/read-rtl.o /tmp/hpautotest-gcc0/gcc/gcc/read-rtl.c
In file included from /tmp/hpautotest-gcc0/gcc/gcc/rtl.h:29,
                 from /tmp/hpautotest-gcc0/gcc/gcc/read-rtl.c:30:
/tmp/hpautotest-gcc0/gcc/gcc/vec.h: In static member function 'static size_t vec<T, A, vl_embed>::embedded_size(unsigned int) [with T = mapping*, A = va_heap]':
/tmp/hpautotest-gcc0/gcc/gcc/vec.h:299:   instantiated from 'static void va_heap::reserve(vec<T, va_heap, vl_embed>*&, unsigned int, bool) [with T = mapping*]'
/tmp/hpautotest-gcc0/gcc/gcc/vec.h:1445:   instantiated from 'bool vec<T, A, vl_ptr>::reserve(unsigned int, bool) [with T = mapping*, A = va_heap]'
/tmp/hpautotest-gcc0/gcc/gcc/vec.h:1540:   instantiated from 'T* vec<T, A, vl_ptr>::safe_push(const T&) [with T = mapping*, A = va_heap]'
/tmp/hpautotest-gcc0/gcc/gcc/read-rtl.c:389:   instantiated from here
/tmp/hpautotest-gcc0/gcc/gcc/vec.h:1069: warning: invalid access to non-static data member 'vec<mapping*, va_heap, vl_embed>::data_'  of NULL object
/tmp/hpautotest-gcc0/gcc/gcc/vec.h:1069: warning: (perhaps the 'offsetof' macro was used incorrectly)
Comment 2 Hans-Peter Nilsson 2012-11-18 19:47:39 UTC
(In reply to comment #0)
> /tmp/hpautotest-gcc0/gcc/libgfortran/generated/matmul_i1.c:79:1: internal
> compiler error: Illegal instruction

Not observed with gcc-4.7.2-2.fc17.x86_64.

BTW, SIGILL sounds like it's forced by gcc in response to something it sees as invalid, that must not be executed.
Comment 3 Hans-Peter Nilsson 2012-11-18 20:17:24 UTC
(In reply to comment #2)
> (In reply to comment #0)
> > /tmp/hpautotest-gcc0/gcc/libgfortran/generated/matmul_i1.c:79:1: internal
> > compiler error: Illegal instruction
> 
> Not observed with gcc-4.7.2-2.fc17.x86_64.

But does happen with "gcc version 4.1.2 20070925 (Red Hat 4.1.2-33)" as well as "gcc version 4.4.5 (Debian 4.4.5-8)".

And those are the gcc versions I have at an arm-length.  There's more at CFarm, but IIRC most of them are gcc-4.4 era and earlier.

Maybe there's some -fpermissive or -fno-strict-aliasing combo to stick there.
I don't really like the thought of raising the minimum gcc version already...
Comment 4 Venkataramanan 2012-11-19 05:45:35 UTC
I could get this problem with my native build. 

gcc version used for build is 4.3.4 [gcc-4_3-branch revision 152973]
Comment 5 Pat Haugen 2012-11-19 17:49:21 UTC
I'm seeing the same failure for PowerPC build of trunk.
Comment 6 Peter Bergner 2012-11-19 22:07:55 UTC
Minimal test case (with minimal options) reduced from matmul_i1.i:

[bergner@igoo pr55381]$ cat pr55381.i 
void
foo (char * dest, char s, long ycount)
{
  long y;
  for (y = 0; y < ycount; y++)
    dest[y] = s;
}
[bergner@igoo pr55381]$ /home/bergner/gcc/build/gcc-fsf-mainline-asan-pthaugen/./gcc/xgcc -B/home/bergner/gcc/build/gcc-fsf-mainline-asan-pthaugen/./gcc/ -ftree-vectorize -O1 -S pr55381.i 
xgcc: internal compiler error: Trace/breakpoint trap (program cc1)
0x100079a3 execute
	/home/bergner/gcc/gcc-fsf-mainline-asan/gcc/gcc.c:2772
0x1000c8d7 do_spec(char const*)
	/home/bergner/gcc/gcc-fsf-mainline-asan/gcc/gcc.c:4245
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

I saw this using a 4.4.6 based compiler.
Comment 7 Andreas Schwab 2012-11-20 13:01:31 UTC
Also broken on ia64 with gcc 4.3.2.

/usr/local/gcc/test/Build/./gcc/xgcc -B/usr/local/gcc/test/Build/./gcc/ -B/usr/ia64-suse-linux/bin/ -B/usr/ia64-suse-linux/lib/ -isystem /usr/ia64-suse-linux/include -isystem /usr/ia64-suse-linux/sys-include    -O2 -g -O2  -O2 -g -DIN_GCC   -DUSE_LIBUNWIND_EXCEPTIONS -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include   -fPIC -DUSE_GAS_SYMVER -g -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector   -fPIC -DUSE_GAS_SYMVER -I. -I. -I../.././gcc -I../../../libgcc -I../../../libgcc/. -I../../../libgcc/../gcc -I../../../libgcc/../include  -DHAVE_CC_TLS  -o _mulvdi3.o -MT _mulvdi3.o -MD -MP -MF _mulvdi3.dep -DL_mulvdi3 -c ../../../libgcc/libgcc2.c -fvisibility=hidden -DHIDE_EXPORTS
../../../libgcc/libgcc2.c: In function ‘__mulvti3’:
../../../libgcc/libgcc2.c:397:1: internal compiler error: Segmentation fault
 }
 ^
0x40000000008bc6cf crash_signal
        ../../gcc/toplev.c:334
0x4000000000cb49bf vec<rtx_def*, va_stack, vl_ptr>::reserve(unsigned int, bool)
        ../../gcc/vec.h:1443
0x4000000000cb49bf vec<rtx_def*, va_stack, vl_ptr>::safe_push(rtx_def* const&)
        ../../gcc/vec.h:1540
0x4000000000cb49bf values_to_stack
        ../../gcc/var-tracking.c:8585
0x4000000001083dcf htab_traverse_noresize
        ../../libiberty/hashtab.c:784
0x4000000000cabdbf process_changed_values
        ../../gcc/var-tracking.c:8704
0x4000000000cac1bf emit_notes_for_changes
        ../../gcc/var-tracking.c:8743
0x4000000000cadaaf emit_notes_for_differences
        ../../gcc/var-tracking.c:8863
0x4000000000cadaaf vt_emit_notes
        ../../gcc/var-tracking.c:9238
0x4000000000cb476f variable_tracking_main_1
        ../../gcc/var-tracking.c:10066
0x4000000000cb476f variable_tracking_main()
        ../../gcc/var-tracking.c:10080
0x4000000000d0254f ia64_reorg
        ../../gcc/config/ia64/ia64.c:9798
0x40000000007fd05f rest_of_handle_machine_reorg
        ../../gcc/reorg.c:4152
Comment 8 Diego Novillo 2012-11-20 16:50:00 UTC
I don't have access to old compilers locally.  I'm trying with a cross from one of the sparc boxes in the farm that has gcc 4.3.2.
Comment 9 Hans-Peter Nilsson 2012-11-20 18:11:10 UTC
(In reply to comment #8)
> I don't have access to old compilers locally.  I'm trying with a cross from one
> of the sparc boxes in the farm that has gcc 4.3.2.

Revision r193667 seems to have fixed this, not unexpectedly.
Comment 10 Hans-Peter Nilsson 2012-11-25 21:01:27 UTC
(In reply to comment #9)
> Revision r193667 seems to have fixed this, not unexpectedly.

...so I just went ahead and closed this PR.