public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
@ 2024-09-04 18:59 zsojka at seznam dot cz
2024-09-04 19:10 ` [Bug tree-optimization/116601] " pinskia at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: zsojka at seznam dot cz @ 2024-09-04 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
Bug ID: 116601
Summary: [15 Regression] during GIMPLE pass: fab ICE:
verify_gimple failed: statement marked for throw, but
doesn't with -O -fnon-call-exceptions
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: middle-end
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 59050
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59050&action=edit
auto-reduced testcase
Compiler output:
$ x86_64-pc-linux-gnu-gcc -O -fnon-call-exceptions testcase.C
testcase.C: In function 'void ShowVehicleRefitWindow()':
testcase.C:22:6: error: statement marked for throw, but doesn't
22 | void ShowVehicleRefitWindow() { new RefitWindow; }
| ^~~~~~~~~~~~~~~~~~~~~~
# .MEM_11 = VDEF <.MEM_10>
__trans_tmp_2 = {};
during GIMPLE pass: fab
testcase.C:22:6: internal compiler error: verify_gimple failed
0x2eeb08e internal_error(char const*, ...)
/repo/gcc-trunk/gcc/diagnostic-global-context.cc:492
0x18fcded verify_gimple_in_cfg(function*, bool, bool)
/repo/gcc-trunk/gcc/tree-cfg.cc:5681
0x176da14 execute_function_todo
/repo/gcc-trunk/gcc/passes.cc:2089
0x176df6e execute_todo
/repo/gcc-trunk/gcc/passes.cc:2143
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-r15-3443-20240904104428-gda3a2985fff-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/15.0.0/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 --enable-libsanitizer
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-r15-3443-20240904104428-gda3a2985fff-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.0.0 20240903 (experimental) (GCC)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
@ 2024-09-04 19:10 ` pinskia at gcc dot gnu.org
2024-09-04 19:30 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-04 19:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Component|middle-end |tree-optimization
Ever confirmed|0 |1
Last reconfirmed| |2024-09-04
Target Milestone|--- |15.0
Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
<bb 2> [local count: 1073741824]:
*__val_6(D) = {};
<bb 3> [local count: 1073741824]:
__trans_tmp_2 = MEM[(const struct RefitOption &)__val_6(D)];
goto <bb 5>; [100.00%]
Into:
<bb 2> [local count: 1073741824]:
*__val_6(D) = {};
<bb 3> [local count: 1073741824]:
__trans_tmp_2 = {};
goto <bb 5>; [100.00%]
The difference between GCC 14 and 15 comes from gimplifier.
Anyways I am going to fix this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
2024-09-04 19:10 ` [Bug tree-optimization/116601] " pinskia at gcc dot gnu.org
@ 2024-09-04 19:30 ` pinskia at gcc dot gnu.org
2024-09-04 20:22 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-04 19:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The bug is in optimize_memcpy or maybe after the call to optimize_memcpy. It
has been a latent issue since r7-5443-g7b45d0dfeb5f85 .
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
2024-09-04 19:10 ` [Bug tree-optimization/116601] " pinskia at gcc dot gnu.org
2024-09-04 19:30 ` pinskia at gcc dot gnu.org
@ 2024-09-04 20:22 ` pinskia at gcc dot gnu.org
2024-09-04 20:48 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-04 20:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The fix which I am testing:
```
diff --git a/gcc/tree-ssa-ccp.cc b/gcc/tree-ssa-ccp.cc
index 44711018e0e..3cd385f476b 100644
--- a/gcc/tree-ssa-ccp.cc
+++ b/gcc/tree-ssa-ccp.cc
@@ -4325,8 +4325,15 @@ pass_fold_builtins::execute (function *fun)
if (gimple_code (stmt) != GIMPLE_CALL)
{
if (gimple_assign_load_p (stmt) && gimple_store_p (stmt))
- optimize_memcpy (&i, gimple_assign_lhs (stmt),
- gimple_assign_rhs1 (stmt), NULL_TREE);
+ {
+ optimize_memcpy (&i, gimple_assign_lhs (stmt),
+ gimple_assign_rhs1 (stmt), NULL_TREE);
+ old_stmt = stmt;
+ stmt = gsi_stmt (i);
+ if (maybe_clean_or_replace_eh_stmt (old_stmt, stmt)
+ && gimple_purge_dead_eh_edges (bb))
+ cfg_changed = true;
+ }
gsi_next (&i);
continue;
}
```
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
` (2 preceding siblings ...)
2024-09-04 20:22 ` pinskia at gcc dot gnu.org
@ 2024-09-04 20:48 ` pinskia at gcc dot gnu.org
2024-09-04 20:48 ` [Bug tree-optimization/116601] [12/13/14/15 " pinskia at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-04 20:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 59051
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59051&action=edit
Cleaned up testcase
`-O1 -fnon-call-exceptions`
This cleaned up testcase fails since GCC 7 even.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [12/13/14/15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
` (3 preceding siblings ...)
2024-09-04 20:48 ` pinskia at gcc dot gnu.org
@ 2024-09-04 20:48 ` pinskia at gcc dot gnu.org
2024-09-05 6:24 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-04 20:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[15 Regression] during |[12/13/14/15 Regression]
|GIMPLE pass: fab ICE: |during GIMPLE pass: fab
|verify_gimple failed: |ICE: verify_gimple failed:
|statement marked for throw, |statement marked for throw,
|but doesn't with -O |but doesn't with -O
|-fnon-call-exceptions |-fnon-call-exceptions
Known to fail| |7.1.0
Target Milestone|15.0 |12.5
Known to work|14.2.1 |6.1.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [12/13/14/15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
` (4 preceding siblings ...)
2024-09-04 20:48 ` [Bug tree-optimization/116601] [12/13/14/15 " pinskia at gcc dot gnu.org
@ 2024-09-05 6:24 ` pinskia at gcc dot gnu.org
2024-09-06 21:36 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-05 6:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
URL| |https://gcc.gnu.org/piperma
| |il/gcc-patches/2024-Septemb
| |er/662327.html
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch posted:
https://gcc.gnu.org/pipermail/gcc-patches/2024-September/662327.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [12/13/14/15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
` (5 preceding siblings ...)
2024-09-05 6:24 ` pinskia at gcc dot gnu.org
@ 2024-09-06 21:36 ` pinskia at gcc dot gnu.org
2024-09-09 8:13 ` cvs-commit at gcc dot gnu.org
2024-09-09 11:43 ` [Bug tree-optimization/116601] [12/13/14 " pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-06 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 59065
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59065&action=edit
Patch which moves this folding to a different location
So in the end, it is better to move this optimization to fold_stmt. For
branches my original patch seems like the best.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [12/13/14/15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
` (6 preceding siblings ...)
2024-09-06 21:36 ` pinskia at gcc dot gnu.org
@ 2024-09-09 8:13 ` cvs-commit at gcc dot gnu.org
2024-09-09 11:43 ` [Bug tree-optimization/116601] [12/13/14 " pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-09-09 8:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
--- Comment #7 from GCC 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:2067df800df930dd13aa20a826373bb27cfdd420
commit r15-3544-g2067df800df930dd13aa20a826373bb27cfdd420
Author: Andrew Pinski <quic_apinski@quicinc.com>
Date: Fri Sep 6 12:29:26 2024 -0700
gimple-fold: Move optimizing memcpy to memset to fold_stmt from fab
I noticed this folding inside fab could be done else where and could
even improve inlining decisions and a few other things so let's
move it to fold_stmt.
It also fixes PR 116601 because places which call fold_stmt already
have to deal with the stmt becoming a non-throw statement.
For the fix for PR 116601 on the branches should be the original patch
rather than a backport of this one.
Bootstrapped and tested on x86_64-linux-gnu.
PR tree-optimization/116601
gcc/ChangeLog:
* gimple-fold.cc (optimize_memcpy_to_memset): Move
from tree-ssa-ccp.cc and rename. Also return true
if the optimization happened.
(gimple_fold_builtin_memory_op): Call
optimize_memcpy_to_memset.
(fold_stmt_1): Call optimize_memcpy_to_memset for
load/store copies.
* tree-ssa-ccp.cc (optimize_memcpy): Delete.
(pass_fold_builtins::execute): Remove code that
calls optimize_memcpy.
gcc/testsuite/ChangeLog:
* gcc.dg/pr78408-1.c: Adjust dump scan to match where
the optimization now happens.
* g++.dg/torture/except-2.C: New test.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug tree-optimization/116601] [12/13/14 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
` (7 preceding siblings ...)
2024-09-09 8:13 ` cvs-commit at gcc dot gnu.org
@ 2024-09-09 11:43 ` pinskia at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-09 11:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116601
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail|15.0 |
Summary|[12/13/14/15 Regression] |[12/13/14 Regression]
|during GIMPLE pass: fab |during GIMPLE pass: fab
|ICE: verify_gimple failed: |ICE: verify_gimple failed:
|statement marked for throw, |statement marked for throw,
|but doesn't with -O |but doesn't with -O
|-fnon-call-exceptions |-fnon-call-exceptions
Known to work| |15.0
--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed on the trunk so far by moving the optimization to a better location.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-09-09 11:43 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-04 18:59 [Bug middle-end/116601] New: [15 Regression] during GIMPLE pass: fab ICE: verify_gimple failed: statement marked for throw, but doesn't with -O -fnon-call-exceptions zsojka at seznam dot cz
2024-09-04 19:10 ` [Bug tree-optimization/116601] " pinskia at gcc dot gnu.org
2024-09-04 19:30 ` pinskia at gcc dot gnu.org
2024-09-04 20:22 ` pinskia at gcc dot gnu.org
2024-09-04 20:48 ` pinskia at gcc dot gnu.org
2024-09-04 20:48 ` [Bug tree-optimization/116601] [12/13/14/15 " pinskia at gcc dot gnu.org
2024-09-05 6:24 ` pinskia at gcc dot gnu.org
2024-09-06 21:36 ` pinskia at gcc dot gnu.org
2024-09-09 8:13 ` cvs-commit at gcc dot gnu.org
2024-09-09 11:43 ` [Bug tree-optimization/116601] [12/13/14 " 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).