public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510
@ 2023-10-22 1:42 141242068 at smail dot nju.edu.cn
2023-10-22 1:54 ` [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool pinskia at gcc dot gnu.org
` (10 more replies)
0 siblings, 11 replies; 12+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-10-22 1:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Bug ID: 111911
Summary: GCC: 14: internal compiler error: internal compiler
error: in gimplify_expr, at gimplify.cc:17510
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: 141242068 at smail dot nju.edu.cn
Target Milestone: ---
When compile this program, GCC crashes:
```
int main(void) {
if ((((!((_Bool)(__INT_MAX__ + 1))) /
(!((_Bool)(__INT_MAX__ + 1))))))
;
return 1;
}
```
Complier Explorer: https://gcc.godbolt.org/z/W59roeYKP
The full stack dump:
```
<source>: In function 'main':
<source>:2:32: warning: integer overflow in expression of type 'int' results in
'-2147483648' [-Woverflow]
2 | if ((((!((_Bool)(__INT_MAX__ + 1))) /
| ^
<source>:3:34: warning: integer overflow in expression of type 'int' results in
'-2147483648' [-Woverflow]
3 | (!((_Bool)(__INT_MAX__ + 1))))))
| ^
cc1: warning: division by zero [-Wdiv-by-zero]
<source>:2:10: internal compiler error: in gimplify_expr, at gimplify.cc:17510
2 | if ((((!((_Bool)(__INT_MAX__ + 1))) /
| ^
0x231f49e internal_error(char const*, ...)
???:0
0xa00958 fancy_abort(char const*, int, char const*)
???:0
0xdbb856 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb3dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb856 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb3dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbb3dc gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbbf48 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbcc33 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbbcdf gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdbcc33 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*),
int)
???:0
0xdbec8a gimplify_stmt(tree_node**, gimple**)
???:0
0xdc0cd3 gimplify_body(tree_node*, bool)
???:0
0xdc112f gimplify_function_tree(tree_node*)
???:0
0xbea6e7 cgraph_node::analyze()
???:0
0xbee231 symbol_table::finalize_compilation_unit()
???:0
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.
```
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
@ 2023-10-22 1:54 ` pinskia at gcc dot gnu.org
2023-10-22 1:54 ` pinskia at gcc dot gnu.org
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 1:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |10.1.0, 11.1.0, 8.4.0,
| |9.3.0, 9.4.0
Target Milestone|--- |11.5
Keywords| |ice-on-valid-code
Known to work| |7.1.0, 8.3.0, 9.1.0, 9.2.0
Summary|GCC: 14: internal compiler |[11/12/13/14 Regression]
|error: internal compiler |ICE with integer overflow
|error: in gimplify_expr, at |converting to _Bool
|gimplify.cc:17510 |
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
2023-10-22 1:54 ` [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool pinskia at gcc dot gnu.org
@ 2023-10-22 1:54 ` pinskia at gcc dot gnu.org
2023-10-22 2:21 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 1:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2023-10-22
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
2023-10-22 1:54 ` [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool pinskia at gcc dot gnu.org
2023-10-22 1:54 ` pinskia at gcc dot gnu.org
@ 2023-10-22 2:21 ` pinskia at gcc dot gnu.org
2023-10-22 2:25 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 2:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
A c_maybe_const_expr is there still for this.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (2 preceding siblings ...)
2023-10-22 2:21 ` pinskia at gcc dot gnu.org
@ 2023-10-22 2:25 ` pinskia at gcc dot gnu.org
2023-10-22 2:28 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 2:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93348,
| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=93241
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect it started with PR 93241 (and is very similar to PR 93348).
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (3 preceding siblings ...)
2023-10-22 2:25 ` pinskia at gcc dot gnu.org
@ 2023-10-22 2:28 ` pinskia at gcc dot gnu.org
2023-11-22 14:38 ` jakub at gcc dot gnu.org
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-22 2:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #3)
> I suspect it started with PR 93241 (and is very similar to PR 93348).
(_Bool) <<< Unknown tree: c_maybe_const_expr
1 >>> == 0)
So maybe remove_c_maybe_const_expr needs to be called always instead of just on
"argument with integer operands".
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (4 preceding siblings ...)
2023-10-22 2:28 ` pinskia at gcc dot gnu.org
@ 2023-11-22 14:38 ` jakub at gcc dot gnu.org
2024-01-30 22:16 ` jsm28 at gcc dot gnu.org
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-11-22 14:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords|needs-bisection |
CC| |jakub at gcc dot gnu.org,
| |jsm28 at gcc dot gnu.org
Priority|P3 |P2
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with r10-5922-g3d77686d2eddf76d3498169d0ca5653db45a8662
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (5 preceding siblings ...)
2023-11-22 14:38 ` jakub at gcc dot gnu.org
@ 2024-01-30 22:16 ` jsm28 at gcc dot gnu.org
2024-01-31 1:25 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-01-30 22:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jsm28 at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #6 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Testing a patch.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (6 preceding siblings ...)
2024-01-30 22:16 ` jsm28 at gcc dot gnu.org
@ 2024-01-31 1:25 ` cvs-commit at gcc dot gnu.org
2024-01-31 1:29 ` [Bug c/111911] [11/12/13 " jsm28 at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-01-31 1:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <jsm28@gcc.gnu.org>:
https://gcc.gnu.org/g:35de88e2ed0aa78f6e3306c8560cd6bb15ce0ffe
commit r14-8641-g35de88e2ed0aa78f6e3306c8560cd6bb15ce0ffe
Author: Joseph Myers <josmyers@redhat.com>
Date: Wed Jan 31 01:24:21 2024 +0000
c: Fix ICEs casting expressions with integer constant operands to bool
[PR111059, PR111911]
C front-end bugs 111059 and 111911 both report ICEs with conversions
to boolean of expressions with integer constant operands that can
appear in an integer constant expression as long as they are not
evaluated (such as division by zero).
The issue is a nested C_MAYBE_CONST_EXPR, with the inner one generated
in build_binary_op to indicate that a subexpression has been fully
folded and should not be folded again, and the outer one in
build_c_cast to indicate that the expression has integer constant
operands. To avoid the inner one from build_binary_op,
c_objc_common_truthvalue_conversion should be given an argument
properly marked as having integer constant operands rather than that
information having been removed by the caller - but because c_convert
would then also wrap a C_MAYBE_CONST_EXPR with a NOP_EXPR converting
to boolean, it seems most convenient to have
c_objc_common_truthvalue_conversion produce the NE_EXPR directly in
the desired type (boolean in this case), before generating any
C_MAYBE_CONST_EXPR there, rather than it always producing a comparison
in integer_type_node and doing a conversion to boolean in the caller.
The same issue as in those PRs also applies for conversion to enums
with a boolean fixed underlying type; that case is also fixed and
tests added for it. Note that not all the tests added failed before
the patch (in particular, the issue was specific to casts and did not
apply for implicit conversions, but some tests of those are added as
well).
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
PR c/111059
PR c/111911
gcc/c/
* c-tree.h (c_objc_common_truthvalue_conversion): Add third
argument.
* c-convert.cc (c_convert): For conversions to boolean, pass third
argument to c_objc_common_truthvalue_conversion rather than
converting here.
* c-typeck.cc (build_c_cast): Ensure arguments with integer
operands are marked as such for conversion to boolean.
(c_objc_common_truthvalue_conversion): Add third argument TYPE.
gcc/testsuite/
* gcc.c-torture/compile/pr111059-1.c,
gcc.c-torture/compile/pr111059-2.c,
gcc.c-torture/compile/pr111059-3.c,
gcc.c-torture/compile/pr111059-4.c,
gcc.c-torture/compile/pr111059-5.c,
gcc.c-torture/compile/pr111059-6.c,
gcc.c-torture/compile/pr111059-7.c,
gcc.c-torture/compile/pr111059-8.c,
gcc.c-torture/compile/pr111059-9.c,
gcc.c-torture/compile/pr111059-10.c,
gcc.c-torture/compile/pr111059-11.c,
gcc.c-torture/compile/pr111059-12.c,
gcc.c-torture/compile/pr111911-1.c,
gcc.c-torture/compile/pr111911-2.c: New tests.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (7 preceding siblings ...)
2024-01-31 1:25 ` cvs-commit at gcc dot gnu.org
@ 2024-01-31 1:29 ` jsm28 at gcc dot gnu.org
2024-02-08 1:35 ` cvs-commit at gcc dot gnu.org
2024-07-19 13:21 ` [Bug c/111911] [12/13 " rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2024-01-31 1:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[11/12/13/14 Regression] |[11/12/13 Regression] ICE
|ICE with integer overflow |with integer overflow
|converting to _Bool |converting to _Bool
--- Comment #8 from Joseph S. Myers <jsm28 at gcc dot gnu.org> ---
Fixed so far for GCC 14.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [11/12/13 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (8 preceding siblings ...)
2024-01-31 1:29 ` [Bug c/111911] [11/12/13 " jsm28 at gcc dot gnu.org
@ 2024-02-08 1:35 ` cvs-commit at gcc dot gnu.org
2024-07-19 13:21 ` [Bug c/111911] [12/13 " rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-08 1:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Joseph Myers <jsm28@gcc.gnu.org>:
https://gcc.gnu.org/g:bfd72bb44eca83b0db2b0bab895f27a8a44247a2
commit r14-8874-gbfd72bb44eca83b0db2b0bab895f27a8a44247a2
Author: Joseph Myers <josmyers@redhat.com>
Date: Thu Feb 8 01:34:09 2024 +0000
c: Fix boolean conversion of floating constant as integer constant
expression [PR113776]
My fix for bug 111059 and bug 111911 caused a conversion of a floating
constant to boolean to wrongly no longer be considered an integer
constant expression, because logic to insert a NOP_EXPR in
c_objc_common_truthvalue_conversion for an argument not an integer
constant expression itself now took place after rather than before the
conversion to bool. In the specific case of casting a floating
constant to bool, the result is an integer constant expression even
though the argument isn't (build_c_cast deals with ensuring that casts
to integer type of anything of floating type more complicated than a
single floating constant don't get wrongly treated as integer constant
expressions even if they fold to constants), so fix the logic in
c_objc_common_truthvalue_conversion to handle that special case.
Bootstrapped with no regressions for x86_64-pc-linux-gnu.
PR c/113776
gcc/c
* c-typeck.cc (c_objc_common_truthvalue_conversion): Return an
integer constant expression for boolean conversion of floating
constant.
gcc/testsuite/
* gcc.dg/pr113776-1.c, gcc.dg/pr113776-2.c, gcc.dg/pr113776-3.c,
gcc.dg/pr113776-4.c: New tests.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug c/111911] [12/13 Regression] ICE with integer overflow converting to _Bool
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
` (9 preceding siblings ...)
2024-02-08 1:35 ` cvs-commit at gcc dot gnu.org
@ 2024-07-19 13:21 ` rguenth at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-07-19 13:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111911
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|11.5 |12.5
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11 branch is being closed.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2024-07-19 13:21 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22 1:42 [Bug c/111911] New: GCC: 14: internal compiler error: internal compiler error: in gimplify_expr, at gimplify.cc:17510 141242068 at smail dot nju.edu.cn
2023-10-22 1:54 ` [Bug c/111911] [11/12/13/14 Regression] ICE with integer overflow converting to _Bool pinskia at gcc dot gnu.org
2023-10-22 1:54 ` pinskia at gcc dot gnu.org
2023-10-22 2:21 ` pinskia at gcc dot gnu.org
2023-10-22 2:25 ` pinskia at gcc dot gnu.org
2023-10-22 2:28 ` pinskia at gcc dot gnu.org
2023-11-22 14:38 ` jakub at gcc dot gnu.org
2024-01-30 22:16 ` jsm28 at gcc dot gnu.org
2024-01-31 1:25 ` cvs-commit at gcc dot gnu.org
2024-01-31 1:29 ` [Bug c/111911] [11/12/13 " jsm28 at gcc dot gnu.org
2024-02-08 1:35 ` cvs-commit at gcc dot gnu.org
2024-07-19 13:21 ` [Bug c/111911] [12/13 " rguenth 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).