* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
@ 2021-02-22 8:16 ` jakub at gcc dot gnu.org
2021-02-22 9:47 ` marxin at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-02-22 8:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It is UB only in C++17 or earlier, so one way to "fix" it is build libubsan
with -std=gnu++20.
Or the SIntMax(Val) << ExtraBits >> ExtraBits can be replaced by
SIntMax(UIntMax(Val) << ExtraBits) >> ExtraBits.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
2021-02-22 8:16 ` [Bug sanitizer/99190] " jakub at gcc dot gnu.org
@ 2021-02-22 9:47 ` marxin at gcc dot gnu.org
2021-02-22 15:17 ` marxin at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-22 9:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2021-02-22
Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
I'll handle it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
2021-02-22 8:16 ` [Bug sanitizer/99190] " jakub at gcc dot gnu.org
2021-02-22 9:47 ` marxin at gcc dot gnu.org
@ 2021-02-22 15:17 ` marxin at gcc dot gnu.org
2021-02-22 15:52 ` zeccav at gmail dot com
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-22 15:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Interesting, you are searching for UBSAN in libsanitizer.
Can you please share details how do you build libubsan with -fsanitize=shift?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
` (2 preceding siblings ...)
2021-02-22 15:17 ` marxin at gcc dot gnu.org
@ 2021-02-22 15:52 ` zeccav at gmail dot com
2021-02-22 16:15 ` zeccav at gmail dot com
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: zeccav at gmail dot com @ 2021-02-22 15:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
--- Comment #4 from Vittorio Zecca <zeccav at gmail dot com> ---
To generate a sanitized version of libgfortran I built whole sanitized
gcc with the following command:
CFLAGS="-g -O0 -fsanitize=undefined -lubsan" LIBS="-lubsan"
CXXFLAGS=$CFLAGS ../gcc-150221/configure
--prefix=/home/vitti/local/gcc-150221-undefined
--enable-languages=c,c++,fortran --disable-multilib --disable-lto
--disable-plugin
--disable-bootstrap
But I remember I had to tweak the build here and there.
It is not trivial.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
` (3 preceding siblings ...)
2021-02-22 15:52 ` zeccav at gmail dot com
@ 2021-02-22 16:15 ` zeccav at gmail dot com
2021-02-23 9:14 ` marxin at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: zeccav at gmail dot com @ 2021-02-22 16:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
--- Comment #5 from Vittorio Zecca <zeccav at gmail dot com> ---
Sorry I meant libubsan, but I am building the whole gcc, g++, and gfortran
sanitized version.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
` (4 preceding siblings ...)
2021-02-22 16:15 ` zeccav at gmail dot com
@ 2021-02-23 9:14 ` marxin at gcc dot gnu.org
2021-02-23 10:16 ` marxin at gcc dot gnu.org
2021-02-23 16:30 ` zeccav at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-23 9:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
URL| |https://reviews.llvm.org/D9
| |7263
--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
I can reproduce it and I've just made an upstream pull request:
https://reviews.llvm.org/D97263
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
` (5 preceding siblings ...)
2021-02-23 9:14 ` marxin at gcc dot gnu.org
@ 2021-02-23 10:16 ` marxin at gcc dot gnu.org
2021-02-23 16:30 ` zeccav at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-02-23 10:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
Martin Liška <marxin at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed in master with g:e03e58c1844d04678f95b278f3eff2a5fbaeff75.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug sanitizer/99190] Undefined behaviour in libubsan
2021-02-22 8:09 [Bug sanitizer/99190] New: Undefined behaviour in libubsan zeccav at gmail dot com
` (6 preceding siblings ...)
2021-02-23 10:16 ` marxin at gcc dot gnu.org
@ 2021-02-23 16:30 ` zeccav at gmail dot com
7 siblings, 0 replies; 9+ messages in thread
From: zeccav at gmail dot com @ 2021-02-23 16:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99190
--- Comment #8 from Vittorio Zecca <zeccav at gmail dot com> ---
I can confirm the new libubsan works on my test case.
Keep up the good work!
^ permalink raw reply [flat|nested] 9+ messages in thread