public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing
@ 2024-05-17 7:22 bic60176 at gmail dot com
2024-05-17 7:36 ` [Bug sanitizer/115127] [12/13/14/15 " rguenth at gcc dot gnu.org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: bic60176 at gmail dot com @ 2024-05-17 7:22 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
@ 2024-05-17 7:36 ` rguenth at gcc dot gnu.org
2024-05-18 20:18 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-05-17 7:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[12/13/14 Regression] |[12/13/14/15 Regression]
|passing zero to |passing zero to
|__builtin_ctz() check |__builtin_ctz() check
|missing |missing
Keywords| |needs-reduction
Target Milestone|--- |12.4
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
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
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 20:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-05-18
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you attach the preprocessed source?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
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
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-18 20:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Also I tested even the simplified testcase:
```
volatile int t = 1;
int main (int argc, char* argv[])
{
volatile int print_hash_value = 0;
if (t == 2) print_hash_value = 1;
__builtin_ctz(print_hash_value);
return 0;
}
```
And the trunk reports:
/app/example.cpp:261:5: runtime error: passing zero to ctz(), which is not a
valid argument
Just fine.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
` (2 preceding siblings ...)
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
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bic60176 at gmail dot com @ 2024-05-19 1:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
--- Comment #3 from Bi6c <bic60176 at gmail dot com> ---
Created attachment 58237
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58237&action=edit
preprocessed source file
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
` (3 preceding siblings ...)
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
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-19 2:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |UNCONFIRMED
Ever confirmed|1 |0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
` (4 preceding siblings ...)
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
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bic60176 at gmail dot com @ 2024-05-31 3:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
--- Comment #4 from Bi6c <bic60176 at gmail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Can you attach the preprocessed source?
Yes. I attached the preprocessed source file.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
` (5 preceding siblings ...)
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
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-02 1:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 115273 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check missing since r12-151
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
` (6 preceding siblings ...)
2024-06-02 1:46 ` pinskia at gcc dot gnu.org
@ 2024-06-02 1:47 ` 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
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-02 1:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2024-05-18 00:00:00 |2024-06-02
Status|UNCONFIRMED |NEW
Keywords|needs-bisection, |
|needs-reduction |
Ever confirmed|0 |1
Summary|[12/13/14/15 Regression] |[12/13/14/15 Regression]
|passing zero to |passing zero to
|__builtin_ctz() check |__builtin_ctz() check
|missing |missing since r12-151
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
int f(int a)
{
return __builtin_ctz(a) == 0;
}
int main(void)
{
__builtin_printf("%d\n", f(0));
}
```
Caused by r12-151-g75f8900159133c .
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug sanitizer/115127] [12/13/14/15 Regression] passing zero to __builtin_ctz() check sometimes missing since r12-151
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
` (7 preceding siblings ...)
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 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-06-20 9:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115127
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|12.4 |12.5
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 12.4 is being released, retargeting bugs to GCC 12.5.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-06-20 9:15 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17 7:22 [Bug sanitizer/115127] New: [12/13/14 Regression] passing zero to __builtin_ctz() check missing bic60176 at gmail dot com
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
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).