Bug 51044 - [4.7 Regression]: gfortran.dg/alloc_comp_class_2.f90 gfortran.dg/widechar_intrinsics_10.f90 -O1 ICE
Summary: [4.7 Regression]: gfortran.dg/alloc_comp_class_2.f90 gfortran.dg/widechar_in...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: 4.7.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2011-11-08 23:53 UTC by Hans-Peter Nilsson
Modified: 2011-11-30 22:08 UTC (History)
1 user (show)

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


Attachments
gcc47-pr51044.patch (426 bytes, patch)
2011-11-29 10:04 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Nilsson 2011-11-08 23:53:55 UTC
This test previously passed, now it fails.
A patch in the revision range (last_known_working:first_known_failing) r181041:181047 exposed or caused this regression.  Since then up to at least including r181179 it fails as follows:

Running /tmp/hpautotest-gcc1/gcc/gcc/testsuite/gfortran.dg/dg.exp ...
FAIL: gfortran.dg/alloc_comp_class_2.f90  -O1  (internal compiler error)
FAIL: gfortran.dg/alloc_comp_class_2.f90  -O1  (test for excess errors)
WARNING: gfortran.dg/alloc_comp_class_2.f90  -O1  compilation failed to produce executable

The messages in gfortran.log does not yield any further information, but a gdb inspection of the segv yields:

Starting program: /tmp/hpautotest-gcc1/cris-elf/gccobj/gcc/f951 /tmp/hpautotest-gcc1/gcc/gcc/testsuite/gfortran.dg/alloc_comp_class_2.f90 -isystem /tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/./newlib/targ-include -isystem /tmp/hpautotest-gcc1/gcc/newlib/libc/include -melf -quiet -dumpbase alloc_comp_class_2.f90 -auxbase alloc_comp_class_2 -O1 -pedantic-errors -version -fintrinsic-modules-path finclude -o alloc_comp_class_2.s
GNU Fortran (GCC) version 4.7.0 20111108 (experimental) [trunk revision 181179] (cris-elf)
        compiled by GNU C version 4.4.3 20100127 (Red Hat 4.4.3-4), GMP version 4.3.0, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.7.0 20111108 (experimental) [trunk revision 181179] (cris-elf)
        compiled by GNU C version 4.4.3 20100127 (Red Hat 4.4.3-4), GMP version 4.3.0, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

Program received signal SIGSEGV, Segmentation fault.
note_stores (x=0x0, fun=0xafd160 <note_add_store>, data=0x7fffffffd9a0) at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:1477
1477      if (GET_CODE (x) == COND_EXEC)
Missing separate debuginfos, use: debuginfo-install glibc-2.11.1-1.x86_64
(gdb) p x
$1 = (const struct rtx_def *) 0x0
(gdb) bt
#0  note_stores (x=0x0, fun=0xafd160 <note_add_store>, data=0x7fffffffd9a0)
    at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:1477
#1  0x0000000000afd11e in emit_inc_dec_insn_before (mem=<value optimized out>, op=<value optimized out>, 
    dest=<value optimized out>, src=<value optimized out>, srcoff=<value optimized out>, arg=<value optimized out>)
    at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:907
#2  0x000000000085b361 in for_each_rtx (x=0x7ffff7e75998, f=0x85c420 <for_each_inc_dec_find_inc_dec>, 
    data=0x7fffffffdae0) at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:2924
#3  0x000000000085b41e in for_each_inc_dec_find_mem (r=<value optimized out>, d=0x7fffffffd9a0)
    at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:3026
#4  0x000000000085b2df in for_each_rtx_1 (exp=0x7ffff7e69a68, n=<value optimized out>, 
    f=0x85b3f0 <for_each_inc_dec_find_mem>, data=0x7fffffffdae0) at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:2844
#5  0x000000000085b317 in for_each_rtx_1 (exp=0x7ffff7df5510, n=<value optimized out>, 
    f=0x85b3f0 <for_each_inc_dec_find_mem>, data=0x7fffffffdae0) at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:2859
#6  0x000000000085b453 in for_each_inc_dec (x=<value optimized out>, fn=0xafd0c0 <emit_inc_dec_insn_before>, 
    arg=0x7ffff7e78270) at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:3057
#7  0x0000000000afcf7c in check_for_inc_dec_1 (insn_info=0x111d910) at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:930
#8  0x0000000000afcfb8 in delete_dead_store_insn (insn_info=0x111d910) at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:963
#9  0x0000000000afec28 in record_store (body=<value optimized out>, bb_info=<value optimized out>)
    at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:1703
#10 0x0000000000afff28 in scan_insn () at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:2668
#11 dse_step1 () at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:2783
#12 0x0000000000b00908 in rest_of_handle_dse () at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:3970
#13 0x00000000008094a2 in execute_one_pass (pass=0xff75a0) at /tmp/hpautotest-gcc1/gcc/gcc/passes.c:2074
#14 0x00000000008097b5 in execute_pass_list (pass=0xff75a0) at /tmp/hpautotest-gcc1/gcc/gcc/passes.c:2129
#15 0x00000000008097c7 in execute_pass_list (pass=0xff2f80) at /tmp/hpautotest-gcc1/gcc/gcc/passes.c:2130
#16 0x00000000008097c7 in execute_pass_list (pass=0xff2f20) at /tmp/hpautotest-gcc1/gcc/gcc/passes.c:2130
#17 0x00000000008f5038 in tree_rest_of_compilation (fndecl=0x7ffff7e52f00)
    at /tmp/hpautotest-gcc1/gcc/gcc/tree-optimize.c:420
#18 0x00000000005f9f2a in cgraph_expand_function (node=0x7ffff7e55c60)
    at /tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:1819
#19 0x00000000005fd4ca in cgraph_expand_all_functions () at /tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:1886
#20 cgraph_optimize () at /tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:2197
#21 0x00000000005fdc8f in cgraph_finalize_compilation_unit () at /tmp/hpautotest-gcc1/gcc/gcc/cgraphunit.c:1327
#22 0x00000000007bbc1f in write_global_declarations () at /tmp/hpautotest-gcc1/gcc/gcc/langhooks.c:303
#23 0x00000000008890ff in compile_file () at /tmp/hpautotest-gcc1/gcc/gcc/toplev.c:581
#24 do_compile () at /tmp/hpautotest-gcc1/gcc/gcc/toplev.c:1931
#25 0x0000000000889772 in toplev_main (argc=19, argv=0x7fffffffdf68) at /tmp/hpautotest-gcc1/gcc/gcc/toplev.c:2007
#26 0x00000037d421eb1d in __libc_start_main () from /lib64/libc.so.6
#27 0x0000000000474699 in _start ()
(gdb) l
1472    void
1473    note_stores (const_rtx x, void (*fun) (rtx, const_rtx, void *), void *data)
1474    {
1475      int i;
1476
1477      if (GET_CODE (x) == COND_EXEC)
1478        x = COND_EXEC_CODE (x);
1479
1480      if (GET_CODE (x) == SET || GET_CODE (x) == CLOBBER)
1481        {
(gdb) up
#1  0x0000000000afd11e in emit_inc_dec_insn_before (mem=<value optimized out>, op=<value optimized out>, 
    dest=<value optimized out>, src=<value optimized out>, srcoff=<value optimized out>, arg=<value optimized out>)
    at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:907
907           note_stores (PATTERN (cur), note_add_store, &info);
(gdb) p cur
$2 = (struct rtx_def *) 0x7ffff7e78270
(gdb) pr
(set (reg/f:SI 9 r9 [36])
    (plus:SI (reg/f:SI 9 r9 [36])
        (const_int 4 [0x4])))


Authors of one or more suspect patches in revision range CC:ed.
Comment 1 Hans-Peter Nilsson 2011-11-09 00:13:09 UTC
There's another similar regression that appears to be because of the same bug:
FAIL: gfortran.dg/widechar_intrinsics_10.f90  -O1  (internal compiler error)
FAIL: gfortran.dg/widechar_intrinsics_10.f90  -O1  (test for excess errors)
WARNING: gfortran.dg/widechar_intrinsics_10.f90  -O1  compilation failed to produce executable

with gdb saying:

(gdb) r /tmp/hpautotest-gcc1/gcc/gcc/testsuite/gfortran.dg/widechar_intrinsics_10.f90 -isystem /tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/./newlib/targ-include -isystem /tmp/hpautotest-gcc1/gcc/newlib/libc/include -melf -quiet -dumpbase widechar_intrinsics_10.f90 -auxbase widechar_intrinsics_10 -O1 -version -fbackslash -fintrinsic-modules-path finclude -o widechar_intrinsics_10.s
Starting program: /tmp/hpautotest-gcc1/cris-elf/gccobj/gcc/f951 /tmp/hpautotest-gcc1/gcc/gcc/testsuite/gfortran.dg/widechar_intrinsics_10.f90 -isystem /tmp/hpautotest-gcc1/cris-elf/gccobj/cris-elf/./newlib/targ-include -isystem /tmp/hpautotest-gcc1/gcc/newlib/libc/include -melf -quiet -dumpbase widechar_intrinsics_10.f90 -auxbase widechar_intrinsics_10 -O1 -version -fbackslash -fintrinsic-modules-path finclude -o widechar_intrinsics_10.s
GNU Fortran (GCC) version 4.7.0 20111108 (experimental) [trunk revision 181179] (cris-elf)
        compiled by GNU C version 4.4.3 20100127 (Red Hat 4.4.3-4), GMP version 4.3.0, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU Fortran (GCC) version 4.7.0 20111108 (experimental) [trunk revision 181179] (cris-elf)
        compiled by GNU C version 4.4.3 20100127 (Red Hat 4.4.3-4), GMP version 4.3.0, MPFR version 2.4.1, MPC version 0.8
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096

Program received signal SIGSEGV, Segmentation fault.
note_stores (x=0xa5a5a5a5a5a5a5a5, fun=0xafd160 <note_add_store>, data=0x7fffffffda40)
    at /tmp/hpautotest-gcc1/gcc/gcc/rtlanal.c:1477
1477      if (GET_CODE (x) == COND_EXEC)
(gdb) p x
$1 = (const struct rtx_def *) 0xa5a5a5a5a5a5a5a5
(gdb) up
#1  0x0000000000afd11e in emit_inc_dec_insn_before (mem=<value optimized out>, op=<value optimized out>, 
    dest=<value optimized out>, src=<value optimized out>, srcoff=<value optimized out>, arg=<value optimized out>)
    at /tmp/hpautotest-gcc1/gcc/gcc/dse.c:907
907           note_stores (PATTERN (cur), note_add_store, &info);
(gdb) p cur
$2 = (struct rtx_def *) 0x7ffff7d7eb40
(gdb) pr
(set (reg/f:SI 12 r12 [2566])
    (plus:SI (reg/f:SI 12 r12 [2566])
        (const_int 4 [0x4])))
Comment 2 Eric Botcazou 2011-11-09 07:59:31 UTC
> Authors of one or more suspect patches in revision range CC:ed.

I'm not the author of the patch, I only reviewed it.  ChangeLog fixed.
Comment 3 Jakub Jelinek 2011-11-29 10:04:19 UTC
Created attachment 25944 [details]
gcc47-pr51044.patch

Untested fix.
Comment 4 Jakub Jelinek 2011-11-30 22:02:18 UTC
Author: jakub
Date: Wed Nov 30 22:02:14 2011
New Revision: 181861

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181861
Log:
	PR rtl-optimization/51044
	* dse.c (emit_inc_dec_insn_before): Ensure new_insn is an instruction
	rather than just insn body.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/dse.c
Comment 5 Jakub Jelinek 2011-11-30 22:08:26 UTC
Fixed.