public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101313] New: [12 regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273
@ 2021-07-04 12:08 anbu1024.me at gmail dot com
2021-07-04 18:13 ` [Bug c/101313] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: anbu1024.me at gmail dot com @ 2021-07-04 12:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101313
Bug ID: 101313
Summary: [12 regression] ICE: tree check: expected class
‘type’, have ‘exceptional’ (error_mark) in
count_type_elements, at expr.c:6273
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 test.c
struct struct_A
{
union bar
{
enum test x;
} var;
};
struct struct_B
{
int x;
struct struct_A a;
};
int foo()
{
struct struct_A a = {0};
struct struct_B b = {2, a};
}
********************************
$ gcc-sp12 --version
gcc (GCC) 12.0.0 20210627 (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 test.c
test.c:7:15: error: field ‘x’ has incomplete type
7 | enum test x;
| ^
test.c: In function ‘foo’:
test.c:21:19: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273
21 | struct struct_B b = {2, a};
| ^
0x7a7886 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
../../gcc-12-20210627/gcc/tree.c:8734
0x6c0d82 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
../../gcc-12-20210627/gcc/tree.h:3496
0x6c0d82 count_type_elements
../../gcc-12-20210627/gcc/expr.c:6273
0xaed8c0 count_type_elements
../../gcc-12-20210627/gcc/expr.c:6245
0xaf0c09 categorize_ctor_elements_1
../../gcc-12-20210627/gcc/expr.c:6426
0xbc651b gimplify_init_constructor
../../gcc-12-20210627/gcc/gimplify.c:4932
0xbd710a gimplify_modify_expr
../../gcc-12-20210627/gcc/gimplify.c:5762
0xbbf26f gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-12-20210627/gcc/gimplify.c:14210
0xbc2bf6 gimplify_stmt(tree_node**, gimple**)
../../gcc-12-20210627/gcc/gimplify.c:6869
0xbcc38d gimplify_and_add(tree_node*, gimple**)
../../gcc-12-20210627/gcc/gimplify.c:494
0xbcc38d gimplify_decl_expr
../../gcc-12-20210627/gcc/gimplify.c:1831
0xbbf566 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-12-20210627/gcc/gimplify.c:14407
0xbc2bf6 gimplify_stmt(tree_node**, gimple**)
../../gcc-12-20210627/gcc/gimplify.c:6869
0xbc01e3 gimplify_statement_list
../../gcc-12-20210627/gcc/gimplify.c:1887
0xbc01e3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-12-20210627/gcc/gimplify.c:14655
0xbc2bf6 gimplify_stmt(tree_node**, gimple**)
../../gcc-12-20210627/gcc/gimplify.c:6869
0xbc334d gimplify_bind_expr
../../gcc-12-20210627/gcc/gimplify.c:1426
0xbc0eae gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
../../gcc-12-20210627/gcc/gimplify.c:14411
0xbd8759 gimplify_stmt(tree_node**, gimple**)
../../gcc-12-20210627/gcc/gimplify.c:6869
0xbd8759 gimplify_body(tree_node*, bool)
../../gcc-12-20210627/gcc/gimplify.c:15442
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 test.c
test.c:7:15: error: field ‘x’ has incomplete type
7 | enum test x;
| ^
test.c:21: confused by earlier errors, bailing out
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/101313] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273
2021-07-04 12:08 [Bug c/101313] New: [12 regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273 anbu1024.me at gmail dot com
@ 2021-07-04 18:13 ` pinskia at gcc dot gnu.org
2021-07-12 9:32 ` marxin at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-04 18:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101313
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[12 regression] ICE: tree |ICE: tree check: expected
|check: expected class |class ‘type’, have
|‘type’, have ‘exceptional’ |‘exceptional’ (error_mark)
|(error_mark) in |in count_type_elements, at
|count_type_elements, at |expr.c:6273
|expr.c:6273 |
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to John X from comment #0)
> $ gcc-sp11 test.c
> test.c:7:15: error: field ‘x’ has incomplete type
> 7 | enum test x;
> | ^
> test.c:21: confused by earlier errors, bailing out
This is ICE just hidden for release checking if there was a sorry/error before
hand. So this is not a regression from GCC 11.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/101313] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273
2021-07-04 12:08 [Bug c/101313] New: [12 regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273 anbu1024.me at gmail dot com
2021-07-04 18:13 ` [Bug c/101313] " pinskia at gcc dot gnu.org
@ 2021-07-12 9:32 ` marxin at gcc dot gnu.org
2022-11-15 19:40 ` pinskia at gcc dot gnu.org
2024-03-23 20:52 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-07-12 9:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101313
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |marxin at gcc dot gnu.org
Last reconfirmed| |2021-07-12
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
It's very old (4.9.0+).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/101313] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273
2021-07-04 12:08 [Bug c/101313] New: [12 regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273 anbu1024.me at gmail dot com
2021-07-04 18:13 ` [Bug c/101313] " pinskia at gcc dot gnu.org
2021-07-12 9:32 ` marxin at gcc dot gnu.org
@ 2022-11-15 19:40 ` pinskia at gcc dot gnu.org
2024-03-23 20:52 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-15 19:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101313
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Status|NEW |ASSIGNED
Keywords| |ice-checking
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/101313] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273
2021-07-04 12:08 [Bug c/101313] New: [12 regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273 anbu1024.me at gmail dot com
` (2 preceding siblings ...)
2022-11-15 19:40 ` pinskia at gcc dot gnu.org
@ 2024-03-23 20:52 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-23 20:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101313
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This fixes the ICE:
```
[apinski@xeond2 gcc]$ git diff
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 2918c469735..06f640009c6 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -7014,7 +7014,7 @@ count_type_elements (const_tree type, bool for_ctor_p)
of the fields. */
n = 1;
for (f = TYPE_FIELDS (type); f ; f = DECL_CHAIN (f))
- if (TREE_CODE (f) == FIELD_DECL)
+ if (TREE_CODE (f) == FIELD_DECL && !error_operand_p (f))
{
m = count_type_elements (TREE_TYPE (f), false);
/* If the field doesn't span the whole union, add an extra
```
Since this function is only called from the FE or while gimplifying, the check
for error_operand should be ok.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-03-23 20:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-04 12:08 [Bug c/101313] New: [12 regression] ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in count_type_elements, at expr.c:6273 anbu1024.me at gmail dot com
2021-07-04 18:13 ` [Bug c/101313] " pinskia at gcc dot gnu.org
2021-07-12 9:32 ` marxin at gcc dot gnu.org
2022-11-15 19:40 ` pinskia at gcc dot gnu.org
2024-03-23 20:52 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).