[Bug tree-optimization/83080] New: ICE at -Os and above with -Wall on C++ code: Segmentation fault

su at cs dot ucdavis.edu gcc-bugzilla@gcc.gnu.org
Mon Nov 20 18:52:00 GMT 2017


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

            Bug ID: 83080
           Summary: ICE at -Os and above with -Wall on C++ code:
                    Segmentation fault
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

This appears to be a recent regression. 

$ g++tk -v
Using built-in specs.
COLLECT_GCC=g++tk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 8.0.0 20171120 (experimental) [trunk revision 254954] (GCC)
$
$ g++tk -O1 -c -Wall tmp.cpp
$ g++-7.2.0 -Os -c -Wall tmp.cpp
$
$ g++tk -Os -c -Wall tmp.cpp
tmp.cpp: In constructor ‘A::A()’:
tmp.cpp:9:9: warning: array subscript 0 is above array bounds of ‘int [0]’
[-Warray-bounds]
   b[0][0] = 0;
   ~~~~~~^
during GIMPLE pass: vrp
tmp.cpp:7:1: internal compiler error: Segmentation fault
 A::A ()
 ^
0xe6ccef crash_signal
        ../../gcc-source-trunk/gcc/toplev.c:325
0x9abc34 contains_struct_check(tree_node const*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc-source-trunk/gcc/tree.h:3459
0x9abc34 wi::to_wide(tree_node const*)
        ../../gcc-source-trunk/gcc/tree.h:5247
0x111c4c8 vrp_prop::check_array_ref(unsigned int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/tree-vrp.c:4811
0x112ea0f vrp_prop::check_array_ref(unsigned int, tree_node*, bool)
        ../../gcc-source-trunk/gcc/tree-vrp.c:4780
0x112ea0f check_array_bounds
        ../../gcc-source-trunk/gcc/tree-vrp.c:4984
0x1158ec2 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
        ../../gcc-source-trunk/gcc/tree.c:11122
0x115931e walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, default_hash_traits<tree_node*> >*, tree_node*
(*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*), void*,
hash_set<tree_node*, default_hash_traits<tree_node*> >*))
        ../../gcc-source-trunk/gcc/tree.c:11439
0xbc59c7 walk_gimple_op(gimple*, tree_node* (*)(tree_node**, int*, void*),
walk_stmt_info*)
        ../../gcc-source-trunk/gcc/gimple-walk.c:221
0x111e542 vrp_prop::check_all_array_refs()
        ../../gcc-source-trunk/gcc/tree-vrp.c:5030
0x111fff3 vrp_prop::vrp_finalize(bool)
        ../../gcc-source-trunk/gcc/tree-vrp.c:6791
0x112ec14 execute_vrp
        ../../gcc-source-trunk/gcc/tree-vrp.c:6864
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$

---------------------

struct A
{ 
  A ();
  int b[1][0];
};

A::A ()
{ 
  b[0][0] = 0;
}


More information about the Gcc-bugs mailing list