public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
@ 2022-02-11 16:49 zsojka at seznam dot cz
2022-02-11 18:22 ` [Bug c/104506] " pinskia at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: zsojka at seznam dot cz @ 2022-02-11 16:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Bug ID: 104506
Summary: [12 Regression] ICE: tree check: expected class
'type', have 'exceptional' (error_mark) in
useless_type_conversion_p, at gimple-expr.cc:87 on
invalid symbol redeclaration
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: ice-on-invalid-code
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zsojka at seznam dot cz
Target Milestone: ---
Host: x86_64-pc-linux-gnu
Target: x86_64-pc-linux-gnu
Created attachment 52419
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52419&action=edit
reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc testcase.c
testcase.c: In function 'foo':
testcase.c:5:7: error: 'x' redeclared as different kind of symbol
5 | int x;
| ^
testcase.c:2:13: note: previous definition of 'x' with type 'double'
2 | foo (double x)
| ~~~~~~~^
testcase.c:4:3: internal compiler error: tree check: expected class 'type',
have 'exceptional' (error_mark) in useless_type_conversion_p, at
gimple-expr.cc:87
4 | x;
| ^
0x7f8b57 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
/repo/gcc-trunk/gcc/tree.cc:8738
0x6e607c tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
/repo/gcc-trunk/gcc/tree.h:3568
0x6e607c useless_type_conversion_p(tree_node*, tree_node*)
/repo/gcc-trunk/gcc/gimple-expr.cc:87
0x15d565b tree_ssa_strip_useless_type_conversions(tree_node*)
/repo/gcc-trunk/gcc/tree-ssa.cc:1280
0x107f937 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/repo/gcc-trunk/gcc/gimplify.cc:14875
0x10841a6 gimplify_stmt(tree_node**, gimple**)
/repo/gcc-trunk/gcc/gimplify.cc:7035
0x1081cf3 gimplify_statement_list
/repo/gcc-trunk/gcc/gimplify.cc:2022
0x1081cf3 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/repo/gcc-trunk/gcc/gimplify.cc:15425
0x10841a6 gimplify_stmt(tree_node**, gimple**)
/repo/gcc-trunk/gcc/gimplify.cc:7035
0x10848fd gimplify_bind_expr
/repo/gcc-trunk/gcc/gimplify.cc:1427
0x1080e62 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
/repo/gcc-trunk/gcc/gimplify.cc:15181
0x10923df gimplify_stmt(tree_node**, gimple**)
/repo/gcc-trunk/gcc/gimplify.cc:7035
0x10923df gimplify_body(tree_node*, bool)
/repo/gcc-trunk/gcc/gimplify.cc:16226
0x109280d gimplify_function_tree(tree_node*)
/repo/gcc-trunk/gcc/gimplify.cc:16380
0xeb6807 cgraph_node::analyze()
/repo/gcc-trunk/gcc/cgraphunit.cc:675
0xeb9477 analyze_functions
/repo/gcc-trunk/gcc/cgraphunit.cc:1240
0xeba11d symbol_table::finalize_compilation_unit()
/repo/gcc-trunk/gcc/cgraphunit.cc:2500
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-7199-20220211084605-gcc68ad87014-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra
--disable-bootstrap --with-cloog --with-ppl --with-isl
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld
--with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r12-7199-20220211084605-gcc68ad87014-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220211 (experimental) (GCC)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
@ 2022-02-11 18:22 ` pinskia at gcc dot gnu.org
2022-02-11 18:24 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-11 18:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |12.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
2022-02-11 18:22 ` [Bug c/104506] " pinskia at gcc dot gnu.org
@ 2022-02-11 18:24 ` pinskia at gcc dot gnu.org
2022-02-11 21:48 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-11 18:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |trivial
Known to work|11.2.1 |11.0
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
2022-02-11 18:22 ` [Bug c/104506] " pinskia at gcc dot gnu.org
2022-02-11 18:24 ` pinskia at gcc dot gnu.org
@ 2022-02-11 21:48 ` pinskia at gcc dot gnu.org
2022-02-11 21:50 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-11 21:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
Last reconfirmed| |2022-02-11
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Anoth testcase:
double x;
void
foo (void)
{
x;
}
int x;
Confirmed, most likely started with r12-3278-g823685221de98.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (2 preceding siblings ...)
2022-02-11 21:48 ` pinskia at gcc dot gnu.org
@ 2022-02-11 21:50 ` pinskia at gcc dot gnu.org
2022-02-11 22:57 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-11 21:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (3 preceding siblings ...)
2022-02-11 21:50 ` pinskia at gcc dot gnu.org
@ 2022-02-11 22:57 ` pinskia at gcc dot gnu.org
2022-02-11 23:01 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-11 22:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The NOP_EXPR comes from:
(gdb) up
#1 0x0000000000b99a72 in c_process_expr_stmt (loc=266752, expr=<parm_decl
0x7ffff7ff6080 x>) at
/home/apinski/src/upstream-gcc/gcc/gcc/c/c-typeck.cc:11356
11356 expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
(gdb) l
11351
11352 /* If the expression is not of a type to which we cannot assign a
line
11353 number, wrap the thing in a no-op NOP_EXPR. */
11354 if (DECL_P (expr) || CONSTANT_CLASS_P (expr))
11355 {
11356 expr = build1 (NOP_EXPR, TREE_TYPE (expr), expr);
11357 SET_EXPR_LOCATION (expr, loc);
11358 }
But if you had a cast to void, it would come from somewhere else.
The strip is:
/* Strip away as many useless type conversions as possible
at the toplevel. */
STRIP_USELESS_TYPE_CONVERSION (*expr_p);
Now do we want to add a check inside STRIP_USELESS_TYPE_CONVERSION for
error_mark_node, I am still deciding.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (4 preceding siblings ...)
2022-02-11 22:57 ` pinskia at gcc dot gnu.org
@ 2022-02-11 23:01 ` pinskia at gcc dot gnu.org
2022-02-14 8:32 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-11 23:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Now do we want to add a check inside STRIP_USELESS_TYPE_CONVERSION for
> error_mark_node, I am still deciding.
Oh STRIP_TYPE_NOPS has a check for error_mark_node which was done in 2000 by
r0-29080 . So maybe it just should too.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (5 preceding siblings ...)
2022-02-11 23:01 ` pinskia at gcc dot gnu.org
@ 2022-02-14 8:32 ` rguenth at gcc dot gnu.org
2022-02-14 11:11 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-14 8:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (6 preceding siblings ...)
2022-02-14 8:32 ` rguenth at gcc dot gnu.org
@ 2022-02-14 11:11 ` jakub at gcc dot gnu.org
2022-02-18 21:41 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-02-14 11:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |sayle at gcc dot gnu.org
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Confirmed it is r12-3278-g823685221de98
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (7 preceding siblings ...)
2022-02-14 11:11 ` jakub at gcc dot gnu.org
@ 2022-02-18 21:41 ` pinskia at gcc dot gnu.org
2022-02-21 9:06 ` cvs-commit at gcc dot gnu.org
2022-02-21 9:07 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-18 21:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2022-Februar
| |y/590595.html
Keywords| |patch
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2022-February/590595.html
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (8 preceding siblings ...)
2022-02-18 21:41 ` pinskia at gcc dot gnu.org
@ 2022-02-21 9:06 ` cvs-commit at gcc dot gnu.org
2022-02-21 9:07 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-02-21 9:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Andrew Pinski <pinskia@gcc.gnu.org>:
https://gcc.gnu.org/g:e01530ec1e33f7df9c2acd0489d6d1f766cb1921
commit r12-7309-ge01530ec1e33f7df9c2acd0489d6d1f766cb1921
Author: Andrew Pinski <apinski@marvell.com>
Date: Sun Feb 13 00:09:39 2022 +0000
c: [PR104506] Fix ICE after error due to change of type to error_mark_node
The problem here is we end up with an error_mark_node when calling
useless_type_conversion_p and that ICEs. STRIP_NOPS/tree_nop_conversion
has had a check for the inner type being an error_mark_node since
g9a6bb3f78c96
(2000). This just adds the check also to tree_ssa_useless_type_conversion.
STRIP_USELESS_TYPE_CONVERSION is mostly used inside the gimplifier
and the places where it is used outside of the gimplifier would not
be adding too much overhead.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
Thanks,
Andrew Pinski
PR c/104506
gcc/ChangeLog:
* tree-ssa.cc (tree_ssa_useless_type_conversion):
Check the inner type before calling useless_type_conversion_p.
gcc/testsuite/ChangeLog:
* gcc.dg/pr104506-1.c: New test.
* gcc.dg/pr104506-2.c: New test.
* gcc.dg/pr104506-3.c: New test.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/104506] [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
` (9 preceding siblings ...)
2022-02-21 9:06 ` cvs-commit at gcc dot gnu.org
@ 2022-02-21 9:07 ` pinskia at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-02-21 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104506
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2022-02-21 9:07 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-11 16:49 [Bug c/104506] New: [12 Regression] ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in useless_type_conversion_p, at gimple-expr.cc:87 on invalid symbol redeclaration zsojka at seznam dot cz
2022-02-11 18:22 ` [Bug c/104506] " pinskia at gcc dot gnu.org
2022-02-11 18:24 ` pinskia at gcc dot gnu.org
2022-02-11 21:48 ` pinskia at gcc dot gnu.org
2022-02-11 21:50 ` pinskia at gcc dot gnu.org
2022-02-11 22:57 ` pinskia at gcc dot gnu.org
2022-02-11 23:01 ` pinskia at gcc dot gnu.org
2022-02-14 8:32 ` rguenth at gcc dot gnu.org
2022-02-14 11:11 ` jakub at gcc dot gnu.org
2022-02-18 21:41 ` pinskia at gcc dot gnu.org
2022-02-21 9:06 ` cvs-commit at gcc dot gnu.org
2022-02-21 9:07 ` 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).