public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/109151] New: UBsan misses a divide-by-zero
@ 2023-03-15 21:51 shaohua.li at inf dot ethz.ch
  2023-03-15 21:54 ` [Bug c/109151] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: shaohua.li at inf dot ethz.ch @ 2023-03-15 21:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109151

            Bug ID: 109151
           Summary: UBsan misses a divide-by-zero
           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 failed to report the divide-by-zero, while
Clang's UBsan could.

Compiler explorer: https://godbolt.org/z/Y73vrf8zK

%cat a.c
int a, c;
short b;
long d;
int main() { 
    a = (short)(d == c | b > 9) / 0; 
    return a;
}
%
% gcc -fsanitize=undefined a.c &&./a.out
Floating point exception
%
% clang -fsanitize=undefined a.c &&./a.out
/a.c:5:42: runtime error: division by zero
%

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-05-04  7:25 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 21:51 [Bug sanitizer/109151] New: UBsan misses a divide-by-zero shaohua.li at inf dot ethz.ch
2023-03-15 21:54 ` [Bug c/109151] " pinskia at gcc dot gnu.org
2023-03-15 22:02 ` pinskia at gcc dot gnu.org
2023-03-16  9:17 ` jakub at gcc dot gnu.org
2023-03-17 15:11 ` cvs-commit at gcc dot gnu.org
2023-03-19  5:31 ` cvs-commit at gcc dot gnu.org
2023-03-20 10:29 ` jakub at gcc dot gnu.org
2023-05-02 20:15 ` cvs-commit at gcc dot gnu.org
2023-05-03 10:44 ` jakub at gcc dot gnu.org
2023-05-03 15:22 ` cvs-commit at gcc dot gnu.org
2023-05-04  7:25 ` jakub 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).