* [Bug tree-optimization/113673] [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
@ 2024-01-30 19:03 ` pinskia at gcc dot gnu.org
2024-01-30 19:09 ` pinskia at gcc dot gnu.org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-30 19:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu.org
Target Milestone|--- |12.4
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
2024-01-30 19:03 ` [Bug tree-optimization/113673] " pinskia at gcc dot gnu.org
@ 2024-01-30 19:09 ` pinskia at gcc dot gnu.org
2024-01-31 8:20 ` rguenth at gcc dot gnu.org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-30 19:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |needs-bisection
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-01-30
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Here is a C++ testcase which does something similar to `-finstrument-functions`
does to the IR (`-Os -fnon-call-exceptions -ftrapv` is only needed):
```
struct s { ~s(); };
void
h (unsigned char *data, int c)
{
s a1;
while (c)
{
int m = *data++ << 8;
m += *data++;
}
}
```
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
2024-01-30 19:03 ` [Bug tree-optimization/113673] " pinskia at gcc dot gnu.org
2024-01-30 19:09 ` pinskia at gcc dot gnu.org
@ 2024-01-31 8:20 ` rguenth at gcc dot gnu.org
2024-02-08 16:52 ` mjires at gcc dot gnu.org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-01-31 8:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Looks like an issue in bswap with regard to EH.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
` (2 preceding siblings ...)
2024-01-31 8:20 ` rguenth at gcc dot gnu.org
@ 2024-02-08 16:52 ` mjires at gcc dot gnu.org
2024-02-08 21:36 ` roger at nextmovesoftware dot com
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mjires at gcc dot gnu.org @ 2024-02-08 16:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
Michal Jireš <mjires at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2024-01-30 00:00:00 |2024-2-8
Keywords|needs-bisection |
CC| |mjires at gcc dot gnu.org,
| |roger at nextmovesoftware dot com
--- Comment #3 from Michal Jireš <mjires at gcc dot gnu.org> ---
Bisected to r12-5453-ga944b5dec3adb2.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
` (3 preceding siblings ...)
2024-02-08 16:52 ` mjires at gcc dot gnu.org
@ 2024-02-08 21:36 ` roger at nextmovesoftware dot com
2024-02-08 22:01 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: roger at nextmovesoftware dot com @ 2024-02-08 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
--- Comment #4 from Roger Sayle <roger at nextmovesoftware dot com> ---
The identified patch implements += the same way as |=. Presumably a version of
the test case replacing "m += *data++;" with "m |= *data++;" would be more
useful at identifying a patch that actually changed EH edges.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
` (4 preceding siblings ...)
2024-02-08 21:36 ` roger at nextmovesoftware dot com
@ 2024-02-08 22:01 ` pinskia at gcc dot gnu.org
2024-04-26 21:36 ` [Bug tree-optimization/113673] [12/13/14/15 " roger at nextmovesoftware dot com
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-08 22:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Roger Sayle from comment #4)
> The identified patch implements += the same way as |=. Presumably a version
> of the test case replacing "m += *data++;" with "m |= *data++;" would be
> more useful at identifying a patch that actually changed EH edges.
Well + can trap on overflow with -ftrapv (and cause exceptions with
-fnon-call-exceptions) but | will not/cannot trap ...
So that patch is definitely the one which changes the EH edges.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14/15 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
` (5 preceding siblings ...)
2024-02-08 22:01 ` pinskia at gcc dot gnu.org
@ 2024-04-26 21:36 ` roger at nextmovesoftware dot com
2024-06-20 9:14 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: roger at nextmovesoftware dot com @ 2024-04-26 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |roger at nextmovesoftware dot com
Status|NEW |ASSIGNED
--- Comment #6 from Roger Sayle <roger at nextmovesoftware dot com> ---
Created attachment 58051
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58051&action=edit
proposed patch
Bootstrapping and regression testing the attached patch.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14/15 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
` (6 preceding siblings ...)
2024-04-26 21:36 ` [Bug tree-optimization/113673] [12/13/14/15 " roger at nextmovesoftware dot com
@ 2024-06-20 9:14 ` rguenth at gcc dot gnu.org
2024-06-24 14:36 ` cvs-commit at gcc dot gnu.org
2024-06-26 14:41 ` [Bug tree-optimization/113673] [12/13/14 " roger at nextmovesoftware dot com
9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-20 9:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.4 |12.5
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.4 is being released, retargeting bugs to GCC 12.5.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14/15 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
` (7 preceding siblings ...)
2024-06-20 9:14 ` rguenth at gcc dot gnu.org
@ 2024-06-24 14:36 ` cvs-commit at gcc dot gnu.org
2024-06-26 14:41 ` [Bug tree-optimization/113673] [12/13/14 " roger at nextmovesoftware dot com
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-24 14:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Roger Sayle <sayle@gcc.gnu.org>:
https://gcc.gnu.org/g:d8b05aef77443e1d3d8f3f5d2c56ac49a503fee3
commit r15-1584-gd8b05aef77443e1d3d8f3f5d2c56ac49a503fee3
Author: Roger Sayle <roger@nextmovesoftware.com>
Date: Mon Jun 24 15:34:03 2024 +0100
PR tree-optimization/113673: Avoid load merging when potentially trapping.
This patch fixes PR tree-optimization/113673, a P2 ice-on-valid regression
caused by load merging of (ptr[0]<<8)+ptr[1] when -ftrapv has been
specified. When the operator is | or ^ this is safe, but for addition
of signed integer types, a trap may be generated/required, so merging this
idiom into a single non-trapping instruction is inappropriate, confusing
the compiler by transforming a basic block with an exception edge into one
without.
This revision implements Richard Biener's feedback to add an early check
for stmt_can_throw_internal (cfun, stmt) to prevent transforming in the
presence of any statement that could trap, not just overflow on addition.
The one other tweak included in this patch is to mark the local function
find_bswap_or_nop_load as static ensuring that it isn't called from outside
this file, and guaranteeing that it is dominated by stmt_can_throw_internal
checking.
2024-06-24 Roger Sayle <roger@nextmovesoftware.com>
Richard Biener <rguenther@suse.de>
gcc/ChangeLog
PR tree-optimization/113673
* gimple-ssa-store-merging.cc (find_bswap_or_nop_load): Make
static.
(find_bswap_or_nop_1): Avoid transformations (load merging) when
stmt_can_throw_internal indicates that a statement can trap.
gcc/testsuite/ChangeLog
PR tree-optimization/113673
* g++.dg/pr113673.C: New test case.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug tree-optimization/113673] [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv
2024-01-30 19:00 [Bug tree-optimization/113673] New: [12/13/14 Regression] ICE: verify_flow_info failed: BB 5 cannot throw but has an EH edge with -Os -finstrument-functions -fnon-call-exceptions -ftrapv zsojka at seznam dot cz
` (8 preceding siblings ...)
2024-06-24 14:36 ` cvs-commit at gcc dot gnu.org
@ 2024-06-26 14:41 ` roger at nextmovesoftware dot com
9 siblings, 0 replies; 11+ messages in thread
From: roger at nextmovesoftware dot com @ 2024-06-26 14:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113673
Roger Sayle <roger at nextmovesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|roger at nextmovesoftware dot com |unassigned at gcc dot gnu.org
Summary|[12/13/14/15 Regression] |[12/13/14 Regression] ICE:
|ICE: verify_flow_info |verify_flow_info failed: BB
|failed: BB 5 cannot throw |5 cannot throw but has an
|but has an EH edge with -Os |EH edge with -Os
|-finstrument-functions |-finstrument-functions
|-fnon-call-exceptions |-fnon-call-exceptions
|-ftrapv |-ftrapv
Status|ASSIGNED |NEW
Known to work| |15.0
--- Comment #9 from Roger Sayle <roger at nextmovesoftware dot com> ---
This has now been fixed on mainline for GCC 15. Please feel free to backport
or close.
^ permalink raw reply [flat|nested] 11+ messages in thread