This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: Fix PR c/25531, handling of __attribute__ ((alias ("foo+X")))


Hello!

This patch fixes a regression from gcc-3.4: __attribute__ ((alias
("foo+X"))) is not resolved to "foo" anymore.

Attached testcase (testsuite/gcc.c-torture/execute/pr25531.c:

--cut here--
extern void abort (void);

static const char _foo_b[4] = {
  'a', 'b', 'c', 'd'
};

static const char _foo[2] __attribute__ ((alias ("_foo_b+2")));

int main()
{
  if (_foo[0] != 'c')
    abort();

  if (_foo[1] != 'd')
    abort();

  return 0;
}
--cut here--

compiles OK with 3.4.x but fails with 4.x with error:

~/gcc-build/gcc/cc1 x.c
x.c:5: error: '_foo_' aliased to undefined symbol '_foo_b+2'

Attached patch fixes this problem and correct code is produced.

2005-12-22  Uros Bizjak  <uros@kss-loka.si>

	PR c/25531
	* cgraph.c (decl_assembler_name_equal): Handle possible
	offsets in the asmname.

testsuite/

	* gcc.c-torture/execute/pr25531.c: New test.

Patch is bootstrapped on i686-pc-linux-gnu, regtresting for c and c++
is in progress.

OK for 4.0/4.1/trunk?

Uros.

Attachment: alias.diff
Description: Binary data

Attachment: pr25531.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]