Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread Ian Lance Taylor
On Wed, Mar 6, 2013 at 11:46 AM, N.M. Maclaren wrote: > On Mar 6 2013, Andrew Pinski wrote: >> >> >> Except GCC implements C's unions as allowing to do type punning as an >> extension and as far as GCC is concerned that is not going to change >> any time soon. >> This is a documented exception to

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread Joseph S. Myers
On Wed, 6 Mar 2013, N.M. Maclaren wrote: > On Mar 6 2013, Andrew Pinski wrote: > > > > Except GCC implements C's unions as allowing to do type punning as an > > extension and as far as GCC is concerned that is not going to change > > any time soon. > > This is a documented exception to the aliasi

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread N.M. Maclaren
On Mar 6 2013, Andrew Pinski wrote: Except GCC implements C's unions as allowing to do type punning as an extension and as far as GCC is concerned that is not going to change any time soon. This is a documented exception to the aliasing/type punning rules. The problem is that this is worse tha

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread Russell Brennan
Doing a bit more light reading on type-punning wrt unions I came upon the following (from http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Structures-unions-enumerations-and-bit_002dfields-implementation.html#Structures-unions-enumerations-and-bit_002dfields-implementation): """ - A member of a union o

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread N.M. Maclaren
On Mar 6 2013, Russell Brennan wrote: Perhaps I misunderstand how you are defining failure here... what would be the failure mode? Perhaps if you could provide an example of the ill-effects that could be seen as a result of this behavior it would clarify the issue? Generating bad code. In:

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread Andrew Pinski
On Wed, Mar 6, 2013 at 10:35 AM, Thomas Koenig wrote: > Am 04.03.2013 21:34, schrieb N.M. Maclaren: > > (quoting documentation about DEC UNIONs for Fortran) > >> "However, if you overlay one variable with another smaller variable, >> that portion of the initial variable is retained that is not ove

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread Russell Brennan
Perhaps I misunderstand how you are defining failure here... what would be the failure mode? Perhaps if you could provide an example of the ill-effects that could be seen as a result of this behavior it would clarify the issue? v/r, Russell On Wed, Mar 6, 2013 at 2:15 PM, N.M. Maclaren wrote:

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread N.M. Maclaren
On Mar 6 2013, Russell Brennan wrote: Ouch. This seems to be at odds with C's unions, where it is not allowed to do type punning. As of gcc 4.4.6, the description above seems to match the C behavior: Er, no. One simple test does not prove that it will always work; this sort of thing is mos

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread Russell Brennan
>> "However, if you overlay one variable with another smaller variable, >> that portion of the initial variable is retained that is not overlaid. >> Depending on the application, the retained portion of an overlaid variable >> may or may not contain meaningful data and can be utilized at a later >>

Re: Adding UNION/MAP -- Feedback and tips pls!

2013-03-06 Thread Thomas Koenig
Am 04.03.2013 21:34, schrieb N.M. Maclaren: (quoting documentation about DEC UNIONs for Fortran) "However, if you overlay one variable with another smaller variable, that portion of the initial variable is retained that is not overlaid. Depending on the application, the retained portion of an o