public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow
@ 2022-12-31 15:12 amonakov at gcc dot gnu.org
2023-01-03 9:48 ` [Bug sanitizer/108256] " jakub at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: amonakov at gcc dot gnu.org @ 2022-12-31 15:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
Bug ID: 108256
Summary: Missing integer overflow instrumentation when
assignment LHS is narrow
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: amonakov at gcc dot gnu.org
Target Milestone: ---
For
unsigned short f(unsigned short x, unsigned short y)
{
return x * y;
}
unsigned short g(unsigned short x, unsigned short y)
{
int r = x * y;
return r;
}
gcc -O2 -fsanitize=undefined emits instrumentation only for 'g', although both
are equivalent. When 'int r' is changed to 'unsigned short r', 'g' is also not
instrumented.
PR 107912 shows a slightly more complicated variant of this. Affects both C and
C++.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug sanitizer/108256] Missing integer overflow instrumentation when assignment LHS is narrow
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
@ 2023-01-03 9:48 ` jakub at gcc dot gnu.org
2023-01-04 9:53 ` cvs-commit at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-03 9:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
Last reconfirmed| |2023-01-03
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 54177
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54177&action=edit
gcc13-pr108256.patch
Untested fix.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug sanitizer/108256] Missing integer overflow instrumentation when assignment LHS is narrow
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
2023-01-03 9:48 ` [Bug sanitizer/108256] " jakub at gcc dot gnu.org
@ 2023-01-04 9:53 ` cvs-commit at gcc dot gnu.org
2023-01-04 9:55 ` jakub at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-04 9:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:8692b15ae7c05e3224f285069e070c009d9f6efe
commit r13-4988-g8692b15ae7c05e3224f285069e070c009d9f6efe
Author: Jakub Jelinek <jakub@redhat.com>
Date: Wed Jan 4 10:52:49 2023 +0100
ubsan: Avoid narrowing of multiply for -fsanitize=signed-integer-overflow
[PR108256]
We shouldn't narrow multiplications originally done in signed types,
because the original multiplication might overflow but the narrowed
one will be done in unsigned arithmetics and will never overflow.
2023-01-04 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/108256
* convert.cc (do_narrow): Punt for MULT_EXPR if original
type doesn't wrap around and -fsanitize=signed-integer-overflow
is on.
* fold-const.cc (fold_unary_loc) <CASE_CONVERT>: Likewise.
* c-c++-common/ubsan/pr108256.c: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug sanitizer/108256] Missing integer overflow instrumentation when assignment LHS is narrow
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
2023-01-03 9:48 ` [Bug sanitizer/108256] " jakub at gcc dot gnu.org
2023-01-04 9:53 ` cvs-commit at gcc dot gnu.org
@ 2023-01-04 9:55 ` jakub at gcc dot gnu.org
2024-02-01 10:01 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-04 9:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug sanitizer/108256] Missing integer overflow instrumentation when assignment LHS is narrow
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
` (2 preceding siblings ...)
2023-01-04 9:55 ` jakub at gcc dot gnu.org
@ 2024-02-01 10:01 ` pinskia at gcc dot gnu.org
2024-02-01 10:02 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-01 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug sanitizer/108256] Missing integer overflow instrumentation when assignment LHS is narrow
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
` (3 preceding siblings ...)
2024-02-01 10:01 ` pinskia at gcc dot gnu.org
@ 2024-02-01 10:02 ` pinskia at gcc dot gnu.org
2024-03-10 3:35 ` pinskia at gcc dot gnu.org
2024-05-19 7:18 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-01 10:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jiajing_zheng at 163 dot com
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 113702 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug sanitizer/108256] Missing integer overflow instrumentation when assignment LHS is narrow
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
` (4 preceding siblings ...)
2024-02-01 10:02 ` pinskia at gcc dot gnu.org
@ 2024-03-10 3:35 ` pinskia at gcc dot gnu.org
2024-05-19 7:18 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-10 3:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |haoxintu at gmail dot com
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 95326 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug sanitizer/108256] Missing integer overflow instrumentation when assignment LHS is narrow
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
` (5 preceding siblings ...)
2024-03-10 3:35 ` pinskia at gcc dot gnu.org
@ 2024-05-19 7:18 ` pinskia at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-19 7:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108256
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bic60176 at gmail dot com
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 115155 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-05-19 7:18 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-31 15:12 [Bug middle-end/108256] New: Missing integer overflow instrumentation when assignment LHS is narrow amonakov at gcc dot gnu.org
2023-01-03 9:48 ` [Bug sanitizer/108256] " jakub at gcc dot gnu.org
2023-01-04 9:53 ` cvs-commit at gcc dot gnu.org
2023-01-04 9:55 ` jakub at gcc dot gnu.org
2024-02-01 10:01 ` pinskia at gcc dot gnu.org
2024-02-01 10:02 ` pinskia at gcc dot gnu.org
2024-03-10 3:35 ` pinskia at gcc dot gnu.org
2024-05-19 7:18 ` 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).