[Bug tree-optimization/83053] [8 Regression] ICE in vrp_prop::check_array_ref at cc/tree-vrp.c:4811

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Nov 20 09:13:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83053

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
I see in tree-vrp.c:4804:

(gdb) p print_generic_expr(stderr, ref, 0)
*array.0_159[0]$10 = void
(gdb) p debug_tree(ref)
 <array_ref 0x7ffff69f2d20
    type <record_type 0x7ffff69bc9d8 myclass BLK
        size <integer_cst 0x7ffff6813c60 constant 0>
        unit-size <integer_cst 0x7ffff6813c18 constant 0>
        align:8 warn_if_not_align:0 symtab:0 alias-set 8 canonical-type
0x7ffff69bc9d8 context <namespace_decl 0x7ffff69b9da8 myclass_def>
        pointer_to_this <pointer_type 0x7ffff69bcc78> chain <type_decl
0x7ffff69e1b48 D.3768>>

    arg:0 <mem_ref 0x7ffff6a06168
        type <array_type 0x7ffff69cae70 type <record_type 0x7ffff69bc9d8
myclass>
            type_2 BLK size <integer_cst 0x7ffff6813c60 0> unit-size
<integer_cst 0x7ffff6813c18 0>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff69cae70 domain <integer_type 0x7ffff69ca738>
            pointer_to_this <pointer_type 0x7ffff69ca5e8>>

        arg:0 <ssa_name 0x7ffff66221f8 type <pointer_type 0x7ffff69ca690>
            visited var <var_decl 0x7ffff69d1360 array.0>
            def_stmt array.0_159 = *array_281._data.data;
            version:159
            ptr-info 0x7ffff6639528>
        arg:1 <integer_cst 0x7ffff69f9258 constant 0>
       
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90:97:0
start:
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90:97:0
finish:
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90:97:0>
    arg:1 <integer_cst 0x7ffff682f288 type <integer_type 0x7ffff6827738
integer(kind=8)> constant 0>
   
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90:97:0
start:
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90:97:0
finish:
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90:97:0>

$ (gdb) p debug_tree((tree)0x7ffff69cae70)
 <array_type 0x7ffff69cae70
    type <record_type 0x7ffff69bc9d8 myclass BLK
        size <integer_cst 0x7ffff6813c60 constant 0>
        unit-size <integer_cst 0x7ffff6813c18 constant 0>
        align:8 warn_if_not_align:0 symtab:0 alias-set 8 canonical-type
0x7ffff69bc9d8 context <namespace_decl 0x7ffff69b9da8 myclass_def>
        pointer_to_this <pointer_type 0x7ffff69bcc78> chain <type_decl
0x7ffff69e1b48 D.3768>>
    type_2 BLK size <integer_cst 0x7ffff6813c60 0> unit-size <integer_cst
0x7ffff6813c18 0>
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff69cae70
    domain <integer_type 0x7ffff69ca738
        type <integer_type 0x7ffff6827738 integer(kind=8) public DI
            size <integer_cst 0x7ffff6813be8 constant 64>
            unit-size <integer_cst 0x7ffff6813c00 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set 11 canonical-type
0x7ffff6827738 precision:64 min <integer_cst 0x7ffff6813e70
-9223372036854775808> max <integer_cst 0x7ffff6813e88 9223372036854775807>
            pointer_to_this <pointer_type 0x7ffff685b888>>
        DI size <integer_cst 0x7ffff6813be8 64> unit-size <integer_cst
0x7ffff6813c00 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
precision:64 min <integer_cst 0x7ffff682f288 0> max <var_decl 0x7ffff69dbbd0
D.3717>>
    pointer_to_this <pointer_type 0x7ffff69ca5e8>>

(gdb) p debug_tree(maxbound)
 <integer_cst 0x7ffff6813e88 type <integer_type 0x7ffff6827738 integer(kind=8)>
constant 9223372036854775807>
$13 = void
(gdb) p debug_tree(eltsize)
 <integer_cst 0x7ffff6813c18 type <integer_type 0x7ffff6827000 sizetype>
constant 0>

Thus there's division by zero and we end up with up_bound_p1 == NULL_TREE.
I'm testing that with r254943 with:

 ./f951
/home/marxin/Programming/gcc/gcc/testsuite/gfortran.dg/actual_array_offset_1.f90
-quiet -dumpbase actual_array_offset_1.f90 -mtune=generic -march=x86-64
-auxbase actual_array_offset_1 -O2 -Warray-bounds=1 -version
-fintrinsic-modules-path finclude -o /tmp/ccU1hBES.s


More information about the Gcc-bugs mailing list