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

            Bug ID: 69796
           Summary: ICE on invalid code in useless_type_conversion_p, at
                    gimple-expr.c:83
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

The following code causes an ICE when compiled with the current gcc trunk on
x86_64-linux-gnu.  

This is a regression from 5.3.x. 


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160212 (experimental) [trunk revision 233377] (GCC) 
$ 
$ gcc-5.3 -c small.c
small.c: In function ‘fn1’:
small.c:5:3: error: expression statement has incomplete type
   s a;
   ^
small.c:5:5: error: expected ‘;’ before ‘a’
   s a;
     ^
$ 
$ gcc-trunk -c small.c
small.c: In function ‘fn1’:
small.c:5:3: error: expression statement has incomplete type
   s a;
   ^
small.c:5:5: error: expected ‘;’ before ‘a’
   s a;
     ^
small.c: At top level:
small.c:1:10: error: storage size of ‘s’ isn’t known
 struct S s;
          ^
small.c: In function ‘fn1’:
small.c:5:3: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:83
   s a;
   ^
0xda28b7 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-trunk/gcc/tree.c:9688
0x893e70 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-trunk/gcc/tree.h:3129
0x893e70 useless_type_conversion_p(tree_node*, tree_node*)
        ../../gcc-trunk/gcc/gimple-expr.c:83
0xd1e68b tree_ssa_strip_useless_type_conversions(tree_node*)
        ../../gcc-trunk/gcc/tree-ssa.c:1160
0x8bbd97 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-trunk/gcc/gimplify.c:10056
0x8c15f6 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-trunk/gcc/gimplify.c:5643
0x8c2835 gimplify_bind_expr
        ../../gcc-trunk/gcc/gimplify.c:1142
0x8bc8d2 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
        ../../gcc-trunk/gcc/gimplify.c:10362
0x8c15f6 gimplify_stmt(tree_node**, gimple**)
        ../../gcc-trunk/gcc/gimplify.c:5643
0x8c3454 gimplify_body(tree_node*, bool)
        ../../gcc-trunk/gcc/gimplify.c:11294
0x8c3ae6 gimplify_function_tree(tree_node*)
        ../../gcc-trunk/gcc/gimplify.c:11450
0x74cbe7 cgraph_node::analyze()
        ../../gcc-trunk/gcc/cgraphunit.c:625
0x74ff53 analyze_functions
        ../../gcc-trunk/gcc/cgraphunit.c:1080
0x750c38 symbol_table::finalize_compilation_unit()
        ../../gcc-trunk/gcc/cgraphunit.c:2534
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.
$ 


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


struct S s; 

void fn1 ()
{
  s a;
}

Reply via email to