From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24569 invoked by alias); 28 Oct 2013 15:26:43 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24547 invoked by uid 48); 28 Oct 2013 15:26:39 -0000 From: "npickito at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/58905] New: Undefined symbol not report when compile with -flto -O1 Date: Mon, 28 Oct 2013 15:26:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: npickito at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg02011.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58905 Bug ID: 58905 Summary: Undefined symbol not report when compile with -flto -O1 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: npickito at gmail dot com Test Program: test.c char ___undef_func___ (); char (*f) () = ___undef_func___; int main () { return f != ___undef_func___; } Problem: $ gcc-trunk test.c # link error because ___undef_func___ is undefined /tmp/ccvwlcm2.o:test.c:function main: error: undefined reference to '___undef_func___' /tmp/ccvwlcm2.o:test.c:function f: error: undefined reference to '___undef_func___' collect2: error: ld returned 1 exit status $ gcc-trunk test.c -flto -O1 # No linker error when -flto -O1! $ gcc-trunk test.c -flto -O0 # But linker error with -flto -O0 /tmp/ccPm2VXa.ltrans0.ltrans.o:ccPm2VXa.ltrans0.o:function main: error: undefined reference to '___undef_func___' /tmp/ccPm2VXa.ltrans0.ltrans.o:ccPm2VXa.ltrans0.o:function f: error: undefined reference to '___undef_func___' collect2: error: ld returned 1 exit status GCC version: gcc trunk r204123 gcc 4.8.1 20130603 (Red Hat 4.8.1-1) (GCC) GCC configure: $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/home/kito/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: /home/kito/gcc/configure --prefix=/home/kito --with-arch_32=i686 --enable-languages=c,c++,go,lto --program-suffix=-trunk --disable-bootstrap --disable-shared CFLAGS='-g0 -O3 -flto' CXXFLAGS='-g0 -O3 -flto' LDFLAGS='-flto -fuse-linker-plugin' Thread model: posix gcc version 4.9.0 20131028 (experimental) (GCC)