https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101171
Bug ID: 101171
Summary: [12 Regression] ICE: tree check: expected class
‘type’, have ‘exceptional’ (error_mark) in
c_expr_sizeof_expr, at c/c-typeck.c:3006
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: anbu1024.me at gmail dot com
Target Milestone: ---
$ cat 34.c
extern void foo(void);
int x = 0x1234;
int bar()
{
if (x != ( sizeof( (enum t) 0x1234) ) )
foo();
}
-------------------------------------------------------------------------------
$ gcc-sp12 --version
gcc (GCC) 12.0.0 20210620 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-------------------------------------------------------------------------------
$ gcc-sp12 34.c
34.c: In function ‘bar’:
34.c:7:29: error: conversion to incomplete type
7 | if (x != ( sizeof( (enum t) 0x1234) ) )
| ^
34.c:7:29: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in c_expr_sizeof_expr, at c/c-typeck.c:3006
0x7a313c tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc-12-20210620/gcc/tree.c:8734
0x65d005 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-12-20210620/gcc/tree.h:3494
0x65d005 c_expr_sizeof_expr(unsigned int, c_expr)
../../gcc-12-20210620/gcc/c/c-typeck.c:3006
0x8c573e c_parser_sizeof_expression
../../gcc-12-20210620/gcc/c/c-parser.c:8299
0x8c573e c_parser_unary_expression
../../gcc-12-20210620/gcc/c/c-parser.c:8196
0x8c6309 c_parser_cast_expression
../../gcc-12-20210620/gcc/c/c-parser.c:8066
0x8c657c c_parser_binary_expression
../../gcc-12-20210620/gcc/c/c-parser.c:7869
0x8c7835 c_parser_conditional_expression
../../gcc-12-20210620/gcc/c/c-parser.c:7592
0x8c7e70 c_parser_expr_no_commas
../../gcc-12-20210620/gcc/c/c-parser.c:7507
0x8c80f1 c_parser_expression
../../gcc-12-20210620/gcc/c/c-parser.c:10638
0x8c0853 c_parser_postfix_expression
../../gcc-12-20210620/gcc/c/c-parser.c:9086
0x8c4b4a c_parser_unary_expression
../../gcc-12-20210620/gcc/c/c-parser.c:8224
0x8c6309 c_parser_cast_expression
../../gcc-12-20210620/gcc/c/c-parser.c:8066
0x8c66f4 c_parser_binary_expression
../../gcc-12-20210620/gcc/c/c-parser.c:7992
0x8c7835 c_parser_conditional_expression
../../gcc-12-20210620/gcc/c/c-parser.c:7592
0x8c7e70 c_parser_expr_no_commas
../../gcc-12-20210620/gcc/c/c-parser.c:7507
0x8c80f1 c_parser_expression
../../gcc-12-20210620/gcc/c/c-parser.c:10638
0x8c9655 c_parser_expression_conv
../../gcc-12-20210620/gcc/c/c-parser.c:10677
0x8c9655 c_parser_condition
../../gcc-12-20210620/gcc/c/c-parser.c:6277
0x8c973b c_parser_paren_condition
../../gcc-12-20210620/gcc/c/c-parser.c:6297
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.
-------------------------------------------------------------------------------
$ gcc-sp11 --version
gcc (GCC) 11.1.1 20210619
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-------------------------------------------------------------------------------
$ gcc-sp11 34.c
34.c: In function ‘bar’:
34.c:7:29: error: conversion to incomplete type
7 | if (x != ( sizeof( (enum t) 0x1234) ) )
| ^