5 msg__DBL_HAS_DENORM__ et al required in recent lib...
2 msgSeg fault
2 msgproblem with solaris compiler
3 msgLooking for GNU toolchain solution for ARM
1 msgRemove redundant includes from C, C++ source fi...
1 msgbuild toolchain for ARM target

Strict aliasing and pointers to functions
\ av1474 (26 Nov 2006)
. \ Perry Smith (26 Nov 2006)
. . \ malc (26 Nov 2006)
. \ Amit Choudhary (26 Nov 2006)
. \ Andrew Haley (26 Nov 2006)
. . \ Perry Smith (26 Nov 2006)
. . . \ Andrew Haley (26 Nov 2006)
. . \ malc (26 Nov 2006)
. . . \ Andrew Haley (26 Nov 2006)
. . . . \ malc (26 Nov 2006)
. . . . . \ Andrew Haley (26 Nov 2006)

3 msgtypeinfo problem (bug?)
2 msgPhase Ordering of Scheduling and Allocation in GCC
21 msgComments in assember output
15 msgProblem with the string
2 msggcc3.3.3 vs gcc4.0.0
3 msgHelp for warning: type attributes are honored o...
2 msghelp compiling java code
1 msg32 bit Global Offset Table on MIPS: howto?
1 msgRemoval of GCC/GAS tailing .code segment NOP pa...
2 msgcompilation issues with gcc v3.2.3p3--building ...
3 msgARM GCC COMPILATION ERROR
4 msgproblem with a structure nested within a template
1 msgAnother clobber problem
Subject:Re: Strict aliasing and pointers to functions
Group:Gcc-help
From:Andrew Haley
Date:26 Nov 2006


malc writes:
> On Sun, 26 Nov 2006, Andrew Haley wrote:
>
>
> [..snip..]
>
> > Are we talking ISO C or GNU C here? This is OK for GNU C, and I think
> > for POSIX.
>
> You mentioned ISO C a few times. So i'd guess we are talking c89.

OK. I don't think it matters: the rules of C89 and C99 are not
substantially different in this area.

> > > However i'm not targetting standard C
> >
> > So why are you using -pedantic? -pedantic is only for strict ISO C.
>
> Because i happen to compile with 5-6 versions of gcc on different
> platforms with different ideas of what -W[xxx] turns on and throwing
> `-pedantic' into the mix generally turns on more.

Sure, it does, but why do you want them? They're not going to make
your programs any better.

> [..snip..]
>
> > ...
> > * The cast below is the correct way to handle the problem.
> > * The (void *) cast is to avoid a GCC warning like:
> > * "warning: dereferencing type-punned pointer will break \
> > * strict-aliasing rules"
> > * which is wrong this code. (void *) introduces a compatible
> > * intermediate type in the cast list.
> > */
> > count -= got, *(char **)(void *)&buffer += size * got;
> >
> > I'm not convinced this hackery is correct by my reading of ISO C, and
> > in any case it's pointless. It could be replaced by:
> >
> > count -= got, buffer = (char*)buffer + (size * got);
>
> That's not for me to decide, not a language layer by any stretch of
> imagination.

I don't understand this remark.

Andrew.


© 2004-2008 readlist.com