public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/104934] New: -fsanitize=undefined codegen err
@ 2022-03-15 11:53 dimhen at gmail dot com
  2022-03-15 13:32 ` [Bug sanitizer/104934] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: dimhen at gmail dot com @ 2022-03-15 11:53 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104934
           Summary: -fsanitize=undefined codegen err
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: sanitizer
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dimhen 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, marxin at gcc dot gnu.org
  Target Milestone: ---

r12-7608 FAIL

Probably FAIL long ago: gcc-8 FAIL
gcc version 8.0.1 20180125 (experimental) [trunk revision 257061] (GCC)


$ g++ -fsanitize=undefined -c -o x.o x.ii && nm -u --reverse-sort x.o
                 U _ZTI1S
$ g++ -c -o x.o x.ii && nm -u --reverse-sort x.o

$ cat x.ii
struct a {};
struct b {
  a c;
};
struct S : a {
  virtual int d();
};
struct e : b {
  unsigned f();
};
unsigned e::f() { static_cast<S *>(&c); return 0; }

$ ~/arch-gcc/gcc_current/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/dimhen/arch-gcc/gcc_current/bin/g++
COLLECT_LTO_WRAPPER=/home/dimhen/arch-gcc/gcc_current/libexec/gcc/x86_64-pc-linux-gnu/12.0.1/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
Target: x86_64-pc-linux-gnu
Configured with: /home/dimhen/src/gcc_current/configure
--prefix=/home/dimhen/arch-gcc/gcc_current
--enable-checking=yes,df,fold,rtl,extra --enable-languages=c,c++,lto
--disable-multilib --enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-gnu-indirect-function --enable-cet --with-tune=native
--enable-libstdcxx-debug
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.1 20220311 (experimental) [master r12-7608-g5e28be89665] (GCC)

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

* [Bug sanitizer/104934] -fsanitize=undefined codegen err
  2022-03-15 11:53 [Bug sanitizer/104934] New: -fsanitize=undefined codegen err dimhen at gmail dot com
@ 2022-03-15 13:32 ` jakub at gcc dot gnu.org
  2022-03-15 16:14 ` dimhen at gmail dot com
  2022-03-15 16:18 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-15 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And the bug is?
The S class doesn't have the key method defined, so some other TU needs to
define it and thus provide the vtable and rtti for it.
Without -fsanitize=vptr the typeinfo isn't needed on this particular testcase
and the vtable isn't needed either, which is why you don't get an undefined
symbol in that case and you get it with -fsanitize=vptr or -fsanitize=undefined
that implies that.

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

* [Bug sanitizer/104934] -fsanitize=undefined codegen err
  2022-03-15 11:53 [Bug sanitizer/104934] New: -fsanitize=undefined codegen err dimhen at gmail dot com
  2022-03-15 13:32 ` [Bug sanitizer/104934] " jakub at gcc dot gnu.org
@ 2022-03-15 16:14 ` dimhen at gmail dot com
  2022-03-15 16:18 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: dimhen at gmail dot com @ 2022-03-15 16:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Dmitry G. Dyachenko <dimhen at gmail dot com> ---
(In reply to Jakub Jelinek from comment #1)
> And the bug is?
> The S class doesn't have the key method defined, so some other TU needs to
> define it and thus provide the vtable and rtti for it.
> Without -fsanitize=vptr the typeinfo isn't needed on this particular
> testcase and the vtable isn't needed either, which is why you don't get an
> undefined symbol in that case and you get it with -fsanitize=vptr or
> -fsanitize=undefined that implies that.

Thank you, Jakub.
So, close as 'INVALID'?

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

* [Bug sanitizer/104934] -fsanitize=undefined codegen err
  2022-03-15 11:53 [Bug sanitizer/104934] New: -fsanitize=undefined codegen err dimhen at gmail dot com
  2022-03-15 13:32 ` [Bug sanitizer/104934] " jakub at gcc dot gnu.org
  2022-03-15 16:14 ` dimhen at gmail dot com
@ 2022-03-15 16:18 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-03-15 16:18 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
.

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

end of thread, other threads:[~2022-03-15 16:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 11:53 [Bug sanitizer/104934] New: -fsanitize=undefined codegen err dimhen at gmail dot com
2022-03-15 13:32 ` [Bug sanitizer/104934] " jakub at gcc dot gnu.org
2022-03-15 16:14 ` dimhen at gmail dot com
2022-03-15 16:18 ` 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).