From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F0A523858D20; Fri, 17 May 2024 07:22:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F0A523858D20 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715930553; bh=ezEFizWLrKXunDdvYuKeGfTde7ewnPL0elKCEBdAa+Y=; h=From:To:Subject:Date:From; b=OXYR8S+0kwABJ2qTdClQk8xjThkpMJvvTEOVXzoFKRndpocvWtwvzWkiOxldtzSKn tM0jkBDRN/syE0UzmLp3Rcw/2yjCaboCx9/9oQJv6olKKN65Eci/F6zJ712UOtWUxM DlE9Ml44ZJkr/FLhL/XitEhT40x+ECRMMjiOIcBE= From: "bic60176 at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 12.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: bic60176 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115127 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=3D58220&action=3Dedit test case OS: Ubuntu 22.04.3 LTS We found that UBSAN missed checking if zero is passed to __builtin_ctz() wh= en compiling with gcc-12.3.0, gcc-13.2.0, gcc-14.1.0. $ ../compiler-builds/gcc-12.3.0_build/bin/gcc -fsanitize=3Dundefined -g -lg= cc_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=3Dundefined -g -lg= cc_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 va= lid argument test1_176.c:202: runtime error: passing zero to ctz(), which is no= t 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=