public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/60461] New: LTO linking error at -Os (and above) on x86_64-linux-gnu
@ 2014-03-07 22:56 su at cs dot ucdavis.edu
  2014-03-10  9:04 ` [Bug lto/60461] [4.9 Regression] " rguenth at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: su at cs dot ucdavis.edu @ 2014-03-07 22:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60461
           Summary: LTO linking error at -Os (and above) on
                    x86_64-linux-gnu
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code triggers a linker error when it is compiled by the current
gcc trunk using LTO at -Os on x86_64-linux-gnu (in both 32-bit and 64-bit
modes). 

It also triggers the error at -O2 and -O3 in 32-bit mode. 

This is a regression from 4.8.x.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 4.9.0 20140307 (experimental) [trunk revision 208393] (GCC) 
$ 
$ gcc-trunk -Os small.c; a.out
$ gcc-trunk -flto -O1 small.c; a.out
$ gcc-4.8.2 -flto -Os small.c; a.out
$ 
$ gcc-trunk -flto -Os small.c
/tmp/ccv33rju.ltrans0.ltrans.o:ccv33rju.ltrans0.o:function fn2: error:
undefined reference to 'a'
collect2: error: ld returned 1 exit status
$ 


------------------------------


struct S
{
  int f1;
  int f2;
} a[1] = { {0, 0} }; 

int b, c;

static unsigned short fn1 (struct S);

void
fn2 ()
{
  for (; c;)
    ;
  b = 0;
  fn1 (a[0]);
}

unsigned short
fn1 (struct S p)
{
  if (p.f1)
    fn2 ();
  return 0;
}

int
main ()
{
  fn2 ();
  return 0;
}


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

end of thread, other threads:[~2014-03-14 12:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-07 22:56 [Bug lto/60461] New: LTO linking error at -Os (and above) on x86_64-linux-gnu su at cs dot ucdavis.edu
2014-03-10  9:04 ` [Bug lto/60461] [4.9 Regression] " rguenth at gcc dot gnu.org
2014-03-13  9:01 ` rguenth at gcc dot gnu.org
2014-03-13 10:18 ` rguenth at gcc dot gnu.org
2014-03-13 10:20 ` rguenth at gcc dot gnu.org
2014-03-13 10:27 ` rguenth at gcc dot gnu.org
2014-03-13 15:58 ` jamborm at gcc dot gnu.org
2014-03-14 10:49 ` jamborm at gcc dot gnu.org
2014-03-14 12:52 ` 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).