From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AFAC33894C38; Mon, 8 Feb 2021 13:30:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFAC33894C38 From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/93115] gcc fails to emit inline function on llvm-roc project: -O1 -fPIC -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden Date: Mon, 08 Feb 2021 13:30:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 9.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: hubicka at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2021 13:30:51 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D93115 --- Comment #7 from Sergei Trofimovich --- Looks like original test does not trigger the bug as is (probably due to te= ts fragility). Here is something shorter (but with warnings): ```c++ struct a { char at; char au; int d() { return av() + au - at; } virtual void f() {} virtual int av() { } }; struct g : a { void f(); char b; char c() { return b; } } b; #ifdef MAIN_FILE g e; void h() { if (b.c()) { e.d(); return; } } int main() {} #endif #ifdef LIB_FILE void g::f() {} #endif ``` $ g++-11.0.0 -Wall -fPIC -O1 -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden -fPIC -shared -o libbug= .so bug.cpp -DLIB_FILE bug.cpp: In member function 'virtual int a::av()': bug.cpp:6:22: warning: no return statement in function returning non-void [-Wreturn-type] 6 | virtual int av() { } | ^ $ g++-11.0.0 -Wall -fPIC -O1 -fdevirtualize -fdevirtualize-speculatively -fipa-cp -fipa-cp-clone -fvisibility-inlines-hidden -o main bug.cpp -DMAIN_= FILE -L. -lbug bug.cpp: In member function 'virtual int a::av()': bug.cpp:6:22: warning: no return statement in function returning non-void [-Wreturn-type] 6 | virtual int av() { } | ^ /usr/lib/gcc/x86_64-pc-linux-gnu/11.0.0/../../../../x86_64-pc-linux-gnu/bin= /ld: /tmp/ccbaHYef.o: in function `h()': bug.cpp:(.text+0x1a): undefined reference to `a::av()' collect2: error: ld returned 1 exit status=