Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Richard Guenther
On Sun, Jan 3, 2010 at 6:46 AM, Joshua Haberman wrote: > The aliasing policies that GCC implements seem to be more strict than > what is in the C99 standard.  I am wondering if this is true or whether > I am mistaken (I am not an expert on the standard, so the latter is > definitely possible). > >

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Andrew Haley
On 01/03/2010 10:53 AM, Richard Guenther wrote: > GCC follows its own documentation here, not some random > websites and maybe not the strict reading of the standard. GCC is compatible with C99 in this regard. Andrew.

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Florian Weimer
* Joshua Haberman: > To me this allows the following: > > int i; > union u { int x; } *pu = (union u*)&i; > printf("%d\n", pu->x); I think the cast on the secodn line is undefined, not the access on the third.

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Andreas Schwab
Florian Weimer writes: > * Joshua Haberman: > >> To me this allows the following: >> >> int i; >> union u { int x; } *pu = (union u*)&i; >> printf("%d\n", pu->x); > > I think the cast on the secodn line is undefined, Only if union u has stricter alignment requirements than int; otherwise y

Re: gcc mirror in Bangalore, India

2010-01-03 Thread Gerald Pfeifer
Vineet, On Tue, 20 Oct 2009, Vineet Dwivedi wrote: > The mirror is now directly syncing from gcc and can be accessed at > > http://mirror.vocabbuilder.net/gcc/ I was just going to add this to http://gcc.gnu.org/mirrors.html (sorry for originally missing that), but noticed that it had not mirrore

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Patrick Horgan
Richard Guenther wrote: On Sun, Jan 3, 2010 at 6:46 AM, Joshua Haberman wrote: ... elision by patrick of part of a quote of 6.5 Expressions #7... * an aggregate or union type that includes one of the aforementioned types among its members (including, recursively, a member of a subaggr

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Andrew Haley
On 01/03/2010 12:52 PM, Andreas Schwab wrote: > Florian Weimer writes: > >> * Joshua Haberman: >> >>> To me this allows the following: >>> >>> int i; >>> union u { int x; } *pu = (union u*)&i; >>> printf("%d\n", pu->x); >> >> I think the cast on the secodn line is undefined, > > Only if un

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Joshua Haberman
Richard Guenther gmail.com> writes: > On Sun, Jan 3, 2010 at 6:46 AM, Joshua Haberman gmail.com> wrote: > > The aliasing policies that GCC implements seem to be more strict than > > what is in the C99 standard. I am wondering if this is true or whether > > I am mistaken (I am not an expert on t

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Joshua Haberman
Andrew Haley redhat.com> writes: > On 01/03/2010 10:53 AM, Richard Guenther wrote: > > GCC follows its own documentation here, not some random > > websites and maybe not the strict reading of the standard. > > GCC is compatible with C99 in this regard. I do not believe this is true. Your argumen

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Joshua Haberman
Patrick Horgan yahoo.com> writes: > Since it would be hard to read this any other way, it seems then you- > maintain that you found a bug in the standard, has it been brought up to- > the committee? The latest draft I see still has that wording. Doesn't- > seem to be on the radar for C1x. I str

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Richard Guenther
On Sun, Jan 3, 2010 at 10:55 PM, Joshua Haberman wrote: > Richard Guenther gmail.com> writes: >> On Sun, Jan 3, 2010 at 6:46 AM, Joshua Haberman > gmail.com> wrote: >> > The aliasing policies that GCC implements seem to be more strict than >> > what is in the C99 standard.  I am wondering if thi

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Joshua Haberman
Richard Guenther gmail.com> writes: > On Sun, Jan 3, 2010 at 10:55 PM, Joshua Haberman gmail.com> wrote: > > This is why perfect warnings about this issue are not possible; if we > > see a downcast in isolation, we do not know if it is undoing a previous > > upcast or not.  Only a tool like valg

gcc-4.3-20100103 is now available

2010-01-03 Thread gccadmin
Snapshot gcc-4.3-20100103 is now available on ftp://gcc.gnu.org/pub/gcc/snapshots/4.3-20100103/ and on various mirrors, see http://gcc.gnu.org/mirrors.html for details. This snapshot has been generated from the GCC 4.3 SVN branch with the following options: svn://gcc.gnu.org/svn/gcc/branches

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Richard Guenther
On Sun, Jan 3, 2010 at 11:54 PM, Joshua Haberman wrote: > Richard Guenther gmail.com> writes: >> On Sun, Jan 3, 2010 at 10:55 PM, Joshua Haberman > gmail.com> wrote: >> > This is why perfect warnings about this issue are not possible; if we >> > see a downcast in isolation, we do not know if it

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Joshua Haberman
By the way, here is one case I tested where I was surprised GCC was not more aggressive: extern void bar(); int foo(int *i) { if(*i) bar(); return *i; } With GCC 4.4.1 -O3 (Ubuntu, x86-64) this reloads *i if bar is called. I suppose you have to allow that either "i" or "*i" is acce

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Richard Guenther
On Mon, Jan 4, 2010 at 12:19 AM, Joshua Haberman wrote: > By the way, here is one case I tested where I was surprised GCC was not > more aggressive: > >  extern void bar(); >  int foo(int *i) { >    if(*i) bar(); >    return *i; >  } > > With GCC 4.4.1 -O3 (Ubuntu, x86-64) this reloads *i if bar i

Re: GCC aliasing rules: more aggressive than C99?

2010-01-03 Thread Xinliang David Li
This optimization is usually done with whole program analysis (WPA) or with function cloning or inlining -- e.g., 'i' is an address of a local variable in inlined/cloned callsite ... David On Sun, Jan 3, 2010 at 3:19 PM, Joshua Haberman wrote: > By the way, here is one case I tested where I was