public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bic60176 at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing
Date: Fri, 17 May 2024 07:22:32 +0000	[thread overview]
Message-ID: <bug-115127-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 115127
           Summary: [12/13/14 Regression] passing zero to __builtin_ctz()
                    check missing
           Product: gcc
           Version: 12.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bic60176 at gmail dot com
                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
  Target Milestone: ---

Created attachment 58220
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58220&action=edit
test case

OS: Ubuntu 22.04.3 LTS
We found that UBSAN missed checking if zero is passed to __builtin_ctz() when
compiling with gcc-12.3.0, gcc-13.2.0, gcc-14.1.0.

$ ../compiler-builds/gcc-12.3.0_build/bin/gcc -fsanitize=undefined -g -lgcc_s
-I/home/csmith/include/csmith-2.3.0 testcase.c -o exec

$ timeout 1s ./exec 2>exec.err

$ cat exec.err

$ ../compiler-builds/gcc-11.4.0_build/bin/gcc -fsanitize=undefined -g -lgcc_s
-I/home/csmith/include/csmith-2.3.0 testcase.c -o exec

$ timeout 1s ./exec 2>exec.err

$ cat exec.err
test1_176.c:202:83: runtime error: passing zero to ctz(), which is not a valid
argument test1_176.c:202: runtime error: passing zero to ctz(), which is not a
valid argument test1_176.c:202: runtime error: passing zero to ctz(), which is
not a valid argument test1_176.c:202: runtime error: passing zero to ctz(),
which is not a valid argument test1_176.c:202: runtime error: passing zero to
ctz(), which is not a valid argument test1_176.c:202: runtime error: passing
zero to ctz(), which is not a valid argument

             reply	other threads:[~2024-05-17  7:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-17  7:22 bic60176 at gmail dot com [this message]
2024-05-17  7:36 ` [Bug sanitizer/115127] [12/13/14/15 " rguenth at gcc dot gnu.org
2024-05-18 20:18 ` pinskia at gcc dot gnu.org
2024-05-18 20:23 ` pinskia at gcc dot gnu.org
2024-05-19  1:37 ` bic60176 at gmail dot com
2024-05-19  2:39 ` pinskia at gcc dot gnu.org
2024-05-31  3:36 ` bic60176 at gmail dot com
2024-06-02  1:46 ` pinskia at gcc dot gnu.org
2024-06-02  1:47 ` [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing since r12-151 pinskia at gcc dot gnu.org
2024-06-20  9:15 ` [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check sometimes " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-115127-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).