public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/108497] New: UBsan at -O1 failed to report an integer-overflow
@ 2023-01-23 12:15 shaohua.li at inf dot ethz.ch
2023-01-23 12:50 ` [Bug sanitizer/108497] " marxin at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-01-23 12:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108497
Bug ID: 108497
Summary: UBsan at -O1 failed to report an integer-overflow
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: shaohua.li at inf dot ethz.ch
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at gcc dot gnu.org
Target Milestone: ---
For the following code, UBsan `-fsanitize=undefined -fno-sanitize-recover=all
-O1` failed to report the integer-overflow, while other opt levels reported it.
Interestingly, if you don't specify `-fno-sanitize-recover=all`, UBSAN can
report it normally.
Clang at all opt levels can detect it.
Compiler explorer: https://godbolt.org/z/dE1sfcz5f
% cat a.c
int a, c;
long *b;
int main() {
int d = 0, e = 0;
for (; e < 2; e++)
f:
for (; a; a++)
d % *b;
d = d + 1228455618;
c ^= 0 == 0;
if (c) {
e = 0;
for (; e < 1; e++)
;
goto f;
}
}
%
% gcc-tk -O1 -fsanitize=undefined -fno-sanitize-recover=all a.c && ./a.out
%
% gcc-tk -O2 -fsanitize=undefined -fno-sanitize-recover=all a.c && ./a.out
/a.c:9:5: runtime error: signed integer overflow: 1228455618 + 1228455618
cannot be represented in type 'int'
%
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/108497] UBsan at -O1 failed to report an integer-overflow
2023-01-23 12:15 [Bug sanitizer/108497] New: UBsan at -O1 failed to report an integer-overflow shaohua.li at inf dot ethz.ch
@ 2023-01-23 12:50 ` marxin at gcc dot gnu.org
2023-01-24 13:57 ` marxin at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-23 12:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108497
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-01-23
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/108497] UBsan at -O1 failed to report an integer-overflow
2023-01-23 12:15 [Bug sanitizer/108497] New: UBsan at -O1 failed to report an integer-overflow shaohua.li at inf dot ethz.ch
2023-01-23 12:50 ` [Bug sanitizer/108497] " marxin at gcc dot gnu.org
@ 2023-01-24 13:57 ` marxin at gcc dot gnu.org
2023-01-24 14:08 ` jakub at gcc dot gnu.org
2023-04-03 21:18 ` shaohua.li at inf dot ethz.ch
3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-24 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108497
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
@Jakub: Can you please take a look?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/108497] UBsan at -O1 failed to report an integer-overflow
2023-01-23 12:15 [Bug sanitizer/108497] New: UBsan at -O1 failed to report an integer-overflow shaohua.li at inf dot ethz.ch
2023-01-23 12:50 ` [Bug sanitizer/108497] " marxin at gcc dot gnu.org
2023-01-24 13:57 ` marxin at gcc dot gnu.org
@ 2023-01-24 14:08 ` jakub at gcc dot gnu.org
2023-04-03 21:18 ` shaohua.li at inf dot ethz.ch
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-01-24 14:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108497
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Not now nor in the near future. After all, it isn't a regression, so couldn't
be fixed during stage4 anyway.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/108497] UBsan at -O1 failed to report an integer-overflow
2023-01-23 12:15 [Bug sanitizer/108497] New: UBsan at -O1 failed to report an integer-overflow shaohua.li at inf dot ethz.ch
` (2 preceding siblings ...)
2023-01-24 14:08 ` jakub at gcc dot gnu.org
@ 2023-04-03 21:18 ` shaohua.li at inf dot ethz.ch
3 siblings, 0 replies; 5+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-04-03 21:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108497
--- Comment #4 from Li Shaohua <shaohua.li at inf dot ethz.ch> ---
(In reply to Jakub Jelinek from comment #3)
> Not now nor in the near future. After all, it isn't a regression, so
> couldn't be fixed during stage4 anyway.
This bug affects GCC>=8. GCC<=7 work fine on this case.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-04-03 21:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-23 12:15 [Bug sanitizer/108497] New: UBsan at -O1 failed to report an integer-overflow shaohua.li at inf dot ethz.ch
2023-01-23 12:50 ` [Bug sanitizer/108497] " marxin at gcc dot gnu.org
2023-01-24 13:57 ` marxin at gcc dot gnu.org
2023-01-24 14:08 ` jakub at gcc dot gnu.org
2023-04-03 21:18 ` shaohua.li at inf dot ethz.ch
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).