public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/101521] New: -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error
@ 2021-07-19 22:52 pinskia at gcc dot gnu.org
2021-07-20 9:48 ` [Bug middle-end/101521] " rguenth at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-19 22:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521
Bug ID: 101521
Summary: -ftrapv should become something like
-fsanitize=undefined
-fsanitize-undefined-trap-on-error
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
As mentioned a few times -ftrapv is broken in many cases it would be better if
it become something like -fsanitize=undefined
-fsanitize-undefined-trap-on-error.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/101521] -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error
2021-07-19 22:52 [Bug middle-end/101521] New: -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error pinskia at gcc dot gnu.org
@ 2021-07-20 9:48 ` rguenth at gcc dot gnu.org
2021-07-20 10:06 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-07-20 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-07-20
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. In particular this would free the compiler from caring about
-ftrapv when generating expressions on its own. It was suggested that this
transform can be done at gimplification time using the
IFN_{ADD,SUB,MUL}_OVERFLOW machinery
(notably negate and division are missing here but easy to test for).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/101521] -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error
2021-07-19 22:52 [Bug middle-end/101521] New: -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error pinskia at gcc dot gnu.org
2021-07-20 9:48 ` [Bug middle-end/101521] " rguenth at gcc dot gnu.org
@ 2021-07-20 10:06 ` jakub at gcc dot gnu.org
2021-08-03 3:22 ` pinskia at gcc dot gnu.org
2021-08-15 12:05 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-07-20 10:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Note, -fsanitize=undefined -fsanitize-undefined-trap-on-error actually doesn't
use IFN_{ADD,SUB,MUL}_OVERFLOW, those are used for the __builtin_*_overflow*
builtins, but its own IFN_UBSAN_CHECK_{ADD,SUB,MUL} ones.
Those are for the IL simpler than IFN_{ADD,SUB,MUL}_OVERFLOW, they just return
their value instead of _Complex containing both the value and overflow flag -
the abort operation (whether __builtin_trap () or some libubsan API call) is
implicit in it.
I think best would be to introduce for -ftrapv another set of ifns, and treat
those mostly as IFN_UBSAN_CHECK_{ADD,SUB,MUL}, except that the abort operation
would be always __builtin_trap regardless of
-f{,no-}sanitize-undefined-trap-on-error and perhaps the expansion could at
least for -Os or for longer sequences try to use the existing libgcc APIs when
they are available.
Negate is for ubsan handled as IFN_UBSAN_CHECK_SUB (0, x), yes, division would
need a new ifn.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/101521] -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error
2021-07-19 22:52 [Bug middle-end/101521] New: -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error pinskia at gcc dot gnu.org
2021-07-20 9:48 ` [Bug middle-end/101521] " rguenth at gcc dot gnu.org
2021-07-20 10:06 ` jakub at gcc dot gnu.org
@ 2021-08-03 3:22 ` pinskia at gcc dot gnu.org
2021-08-15 12:05 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03 3:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gabravier at gmail dot com
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 94934 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/101521] -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error
2021-07-19 22:52 [Bug middle-end/101521] New: -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error pinskia at gcc dot gnu.org
` (2 preceding siblings ...)
2021-08-03 3:22 ` pinskia at gcc dot gnu.org
@ 2021-08-15 12:05 ` pinskia at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-15 12:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101521
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Depends on| |78473
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
the request for a division overflow function is PR 78473.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78473
[Bug 78473] Enhancement request: __builtin_div_overflow
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-15 12:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-19 22:52 [Bug middle-end/101521] New: -ftrapv should become something like -fsanitize=undefined -fsanitize-undefined-trap-on-error pinskia at gcc dot gnu.org
2021-07-20 9:48 ` [Bug middle-end/101521] " rguenth at gcc dot gnu.org
2021-07-20 10:06 ` jakub at gcc dot gnu.org
2021-08-03 3:22 ` pinskia at gcc dot gnu.org
2021-08-15 12:05 ` 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).