Bug 54666 - when do lto opitimizing with attribute (weak,alias), it will produce wrong code
Summary: when do lto opitimizing with attribute (weak,alias), it will produce wrong code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.7.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: lto, wrong-code
Depends on:
Blocks: 92932
  Show dependency treegraph
 
Reported: 2012-09-22 02:05 UTC by huangcunjian
Modified: 2021-09-22 07:02 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 5.1.0
Known to fail: 4.7.2, 4.8.0, 4.9.3
Last reconfirmed: 2012-09-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description huangcunjian 2012-09-22 02:05:40 UTC
gcc version is gcc4.7.1
host,build adn target is  x86 i586

test case name: weak_0.c

extern void abort(void);

int foo =0 ;

extern int bar __attribute__ ((weak,alias ("foo")));
int main(void)
{
/*      if( &foo != &bar)
        {
          abort();
        }*/
        if ( &foo != &bar)
           abort();
        return 0;
}
when compilating weaK_0.c with fllowing cmmand :
i586-target-linux-gnu-gcc weak_0.c -flto -o weak

run week

expected result: return 0;
actual   result: abort();
Comment 1 Richard Biener 2012-09-24 09:33:02 UTC
Confirmed.  4.6.x segfaults for me.
Comment 2 Andrew Pinski 2021-09-22 07:01:54 UTC
This was fixed for GCC 5.1.0.  The problem is the same as PR 32219 really.
Comment 3 Andrew Pinski 2021-09-22 07:02:48 UTC
(In reply to Andrew Pinski from comment #2)
> This was fixed for GCC 5.1.0.  The problem is the same as PR 32219 really.

That is the patch which fixes PR 32219 fixed this one.