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

            Bug ID: 90909
           Summary: call devirtualized to pure virtual
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
  Target Milestone: ---

Recent trunk (I'm at git rev 665de37f60068204ea9b4757dd79bc7f75588733) started
to miscompile

> $ cat test.cc
> struct S1 { virtual void f() = 0; };
> struct S2: S1 { virtual void f() {} };
> struct S3: S2 { using S1::f; };
> struct S4 final: S3 { void g(); };
> void S4::g() { f(); }
> int main() { S4().g(); }

> $ gcc/trunk/inst/bin/g++ test.cc
> /usr/bin/ld: /tmp/ccCRKkqm.o: in function `S4::g()':
> test.cc:(.text+0x14): undefined reference to `S1::f()'
> collect2: error: ld returned 1 exit status

(If you look at the disassembly, it's the call of f() in S4::g that gets
devirtualized to S1::f.)

Reply via email to