llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
26.79k stars 10.97k forks source link

ODR warning in MachineScheduler.h (GenericSchedulerBase) #86987

Open efriedma-quic opened 3 months ago

efriedma-quic commented 3 months ago

When building with -flto -Werror=odr to find possible runtime issues w/ LTO:

/var/tmp/portage/sys-devel/llvm-18.1.0/work/llvm/include/llvm/CodeGen/MachineScheduler.h:1067: error: virtual table of type ‘struct GenericSchedulerBase’ violates one definition rule [-Werror=odr]
 1067 | class GenericSchedulerBase : public MachineSchedStrategy {
      | 
/var/tmp/portage/sys-devel/llvm-18.1.0/work/llvm/include/llvm/CodeGen/MachineScheduler.h:1067: note: the conflicting type defined in another translation unit
 1067 | class GenericSchedulerBase : public MachineSchedStrategy {
      | 
<built-in>: note: virtual method ‘__cxa_pure_virtual’
/var/tmp/portage/sys-devel/llvm-18.1.0/work/llvm/include/llvm/CodeGen/MachineScheduler.h:257: note: ought to match virtual method ‘scheduleTree’ but does not
  257 |   virtual void scheduleTree(unsigned SubtreeID) {}
      | 

Split from #84577 . Originally reported downstream in Gentoo at https://bugs.gentoo.org/926529.

efriedma-quic commented 3 months ago

(I have no idea what this is actually complaining about; this looks like completely vanilla C++ code.)