This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

Re: [patch] Fix array aliasing conftest


On Apr 17 16:32, Hans-Peter Nilsson wrote:
> > From: Ken Werner <ken@linux.vnet.ibm.com>
> > Date: Wed, 8 Apr 2009 16:57:35 +0200
> 
> > while looking at the autoconf scripts I noticed newlibs check for array 
> > aliasing support (_HAVE_ARRAY_ALIASING). The configure.in specifies the 
> > following conftest:
> >   char x[3] = { 'a', 'b', 'c' };
> >   extern char y[2] __attribute__((alias ("x+1")));
> > This looks valid but autoconf strips the square brackets. The generated 
> > configure states:
> >   char x3 = { 'a', 'b', 'c' };
> >   extern char y2 __attribute__((alias ("x+1")));
> > I think this has never compiled as intended. Adding additional square brackets 
> > in the configure.in seem to fix that.
> 
> Except that the construct as such is _invalid_ and must not be
> used.  You can only alias to symbols, not offset expressions.
> It accidentally worked for older gcc.  See
> <http://sourceware.org/ml/newlib/2001/msg00466.html> and
> <http://sourceware.org/ml/newlib/2005/msg00474.html>.
> 
> I'm a bit surprised it's still used (even conditionally) and
> apparently working somewhere, supposedly cygwin?

Nope.  Cygwin is creating an offset symbol using assembler code, and
it only does so for backward compatibility.


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


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