Bug 27758 - [4.1 regression] -O0 -fpic link failure
Summary: [4.1 regression] -O0 -fpic link failure
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P3 normal
Target Milestone: 4.1.2
Assignee: Jakub Jelinek
URL:
Keywords: link-failure
: 27978 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-05-24 15:46 UTC by Jakub Jelinek
Modified: 2006-06-09 16:52 UTC (History)
4 users (show)

See Also:
Host:
Target: i386-linux, x86_64-linux
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gcc41-pr27758.patch (607 bytes, patch)
2006-05-24 15:50 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2006-05-24 15:46:19 UTC
/* { dg-do run { target fpic } } */
/* { dg-options "-O0 -fpic" } */

typedef int (*fn) (void);

static inline int
foo (void)
{
  return 1;
}

fn
test (void)
{
  return foo;
}

int
main (void)
{
  fn f = test ();
  return f () != 1;
}

doesn't link on i386/x86_64 in 4.1 (regression from 4.0) - function foo isn't marked as referenced and therefore not emitted.
This was fixed on the trunk in PR25758.
Comment 1 Jakub Jelinek 2006-05-24 15:50:12 UTC
Created attachment 11506 [details]
gcc41-pr27758.patch
Comment 2 Andrew Pinski 2006-05-24 15:53:28 UTC
I am ok with the back port.
Comment 3 Mark Mitchell 2006-05-25 02:35:15 UTC
Will not be fixed in 4.1.1; adjust target milestone to 4.1.2.
Comment 4 Jakub Jelinek 2006-05-26 14:17:59 UTC
Subject: Bug 27758

Author: jakub
Date: Fri May 26 14:17:47 2006
New Revision: 114132

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114132
Log:
	PR target/27758
	Backported from mainline
	2006-01-25  Andrew Pinski  <pinskia@physics.uc.edu>

	PR target/25758
	* config/i386/i386.c (output_pic_addr_const) <case SYMBOL_REF>:
	Use output_addr_const instead of assemble_name.

	* gcc.dg/pr27758.c: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/pr27758.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/config/i386/i386.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 5 Jakub Jelinek 2006-05-26 14:19:24 UTC
Subject: Bug 27758

Author: jakub
Date: Fri May 26 14:19:16 2006
New Revision: 114133

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=114133
Log:
	PR target/27758
	* gcc.dg/pr27758.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr27758.c
Modified:
    trunk/gcc/testsuite/ChangeLog

Comment 6 Andrew Pinski 2006-05-26 16:15:08 UTC
Fixed.
Comment 7 Andrew Pinski 2006-06-09 16:52:21 UTC
*** Bug 27978 has been marked as a duplicate of this bug. ***