public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "npickito at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-58905-4@http.gcc.gnu.org/bugzilla/> (raw)

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)


             reply	other threads:[~2013-10-28 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-28 15:26 npickito at gmail dot com [this message]
2013-10-29 11:03 ` [Bug lto/58905] " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58905-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).