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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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 ` rguenth at gcc dot gnu.org
  2014-03-13  9:01 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-10  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |lto, wrong-code
                 CC|                            |hubicka at gcc dot gnu.org
   Target Milestone|---                         |4.9.0
            Summary|LTO linking error at -Os    |[4.9 Regression] LTO
                   |(and above) on              |linking error at -Os (and
                   |x86_64-linux-gnu            |above) on x86_64-linux-gnu


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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-13  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-03-13
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.


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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-13 10:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
It looks like when IPA SRA does

About to replace expr p.f1 with ISRA.3
Adjusting call fn2/3 -> fn1.isra.0/6
replacing stmt:fn1.isra.0 (a[0]);

it doesn't adjust IPA references for the load of a[0] it inserts and thus
the reference to 'a' from fn2 isn't present anymore when streaming them
out for WPA phase which then happily removes 'a' even though it is referenced
as

  _5 = MEM[(int *)&a];


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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-13 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Also it seems that non-LTO also misses that reference.  Hmm.


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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-13 10:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|rguenth at gcc dot gnu.org         |jamborm at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Looks like rebuild_cgraph_edges isn't reliably performed for functions
modified by IPA SRA (depends on visiting order).  It would be best if
IPA SRA (and ipa_modify_call_arguments) kept IPA references and callgraph
edges up-to-date.


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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-03-13 15:58 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Jambor <jamborm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-p
                   |                            |atches/2014-03/msg00670.htm
                   |                            |l

--- Comment #5 from Martin Jambor <jamborm at gcc dot gnu.org> ---
That is because I made a stupid mistake when fixing PR 57294.
I have posted a fix to the mailing list:

http://gcc.gnu.org/ml/gcc-patches/2014-03/msg00670.html


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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: jamborm at gcc dot gnu.org @ 2014-03-14 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Jambor <jamborm at gcc dot gnu.org> ---
Author: jamborm
Date: Fri Mar 14 10:49:05 2014
New Revision: 208566

URL: http://gcc.gnu.org/viewcvs?rev=208566&root=gcc&view=rev
Log:
2014-03-13  Martin Jambor  <mjambor@suse.cz>

    PR lto/60461
    * ipa-prop.c (ipa_modify_call_arguments): Fix iteration condition
    and simplify it.

testsuite/
    * gcc.dg/lto/pr60461_0.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/lto/pr60461_0.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/ipa-prop.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug lto/60461] [4.9 Regression] LTO linking error at -Os (and above) on x86_64-linux-gnu
  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
                   ` (6 preceding siblings ...)
  2014-03-14 10:49 ` jamborm at gcc dot gnu.org
@ 2014-03-14 12:52 ` rguenth at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-03-14 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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