public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/58905] New: Undefined symbol not report when compile with -flto -O1
@ 2013-10-28 15:26 npickito at gmail dot com
  2013-10-29 11:03 ` [Bug lto/58905] " rguenth at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: npickito at gmail dot com @ 2013-10-28 15:26 UTC (permalink / raw)
  To: gcc-bugs

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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug lto/58905] Undefined symbol not report when compile with -flto -O1
  2013-10-28 15:26 [Bug lto/58905] New: Undefined symbol not report when compile with -flto -O1 npickito at gmail dot com
@ 2013-10-29 11:03 ` rguenth at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-10-29 11:03 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58905

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
With LTO GCC can see that f == __undef_func__ and remove the then unneeded
reference and the variable f.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-29 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-28 15:26 [Bug lto/58905] New: Undefined symbol not report when compile with -flto -O1 npickito at gmail dot com
2013-10-29 11:03 ` [Bug lto/58905] " rguenth at gcc dot gnu.org

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).