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

            Bug ID: 64778
           Summary: ICE on invalid code on x86_64-linux-gnu: tree check:
                    expected class ‘type’, have ‘exceptional’ (error_mark)
                    in create_tmp_from_val, at gimplify.c:491
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

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

It is a regression from 4.9.x.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-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 5.0.0 20150122 (experimental) [trunk revision 220011] (GCC) 

$ 
$ gcc-4.9 -c small.c
small.c: In function ‘foo’:
small.c:4:13: error: expected expression before ‘,’ token
   a ^= foo (,);
             ^
small.c:4:8: error: too many arguments to function ‘foo’
   a ^= foo (,);
        ^
small.c:1:5: note: declared here
 int foo (int p)
     ^
small.c:4: confused by earlier errors, bailing out
$ 
$ gcc-trunk -c small.c
small.c: In function ‘foo’:
small.c:4:13: error: expected expression before ‘,’ token
   a ^= foo (,);
             ^
small.c:4:8: error: too many arguments to function ‘foo’
   a ^= foo (,);
        ^
small.c:1:5: note: declared here
 int foo (int p)
     ^
small.c:4:8: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in create_tmp_from_val, at gimplify.c:491
   a ^= foo (,);
        ^
0xce76c7 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
    ../../gcc-trunk/gcc/tree.c:9341
0x89cb90 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
    ../../gcc-trunk/gcc/tree.h:2969
0x89cb90 create_tmp_from_val
    ../../gcc-trunk/gcc/gimplify.c:491
0x89cb90 lookup_tmp_var
    ../../gcc-trunk/gcc/gimplify.c:527
0x89cb90 internal_get_tmp_var
    ../../gcc-trunk/gcc/gimplify.c:557
0x896299 get_initialized_tmp_var(tree_node*, gimple_statement_base**,
gimple_statement_base**)
    ../../gcc-trunk/gcc/gimplify.c:594
0x896299 gimplify_save_expr
    ../../gcc-trunk/gcc/gimplify.c:4882
0x896299 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc-trunk/gcc/gimplify.c:8183
0x89a1f6 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc-trunk/gcc/gimplify.c:5514
0x89a9f1 gimplify_compound_expr
    ../../gcc-trunk/gcc/gimplify.c:4837
0x897063 gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc-trunk/gcc/gimplify.c:7886
0x89a1f6 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc-trunk/gcc/gimplify.c:5514
0x89738b gimplify_statement_list
    ../../gcc-trunk/gcc/gimplify.c:1483
0x89738b gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc-trunk/gcc/gimplify.c:8312
0x89a1f6 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc-trunk/gcc/gimplify.c:5514
0x89afc5 gimplify_bind_expr
    ../../gcc-trunk/gcc/gimplify.c:1132
0x8957ac gimplify_expr(tree_node**, gimple_statement_base**,
gimple_statement_base**, bool (*)(tree_node*), int)
    ../../gcc-trunk/gcc/gimplify.c:8094
0x89a1f6 gimplify_stmt(tree_node**, gimple_statement_base**)
    ../../gcc-trunk/gcc/gimplify.c:5514
0x89ba7b gimplify_body(tree_node*, bool)
    ../../gcc-trunk/gcc/gimplify.c:9048
0x89c066 gimplify_function_tree(tree_node*)
    ../../gcc-trunk/gcc/gimplify.c:9202
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.
$ 


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


int foo (int p)
{
  int a; 
  a ^= foo (,);
  return a; 
}

Reply via email to