This is the mail archive of the gcc@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]

Re: subreg question


On Thu, Dec 13, 2001 at 01:04:01PM -0800, Dale Johannesen wrote:
> 
> On Thursday, December 13, 2001, at 12:43 PM, Daniel Jacobowitz wrote:
> >>>>
> >>>>I don't see why not.  (C89) 3.3.4 says the cast might produce an 
> >>>>invalid
> >>>>pointer if it's not aligned properly, which is not the case here.
> >>>>Other than that I don't find any relevant restriction in the standard.
> >>>>What did you have in mind?
> >>>>(FWIW, gcc doesn't warn about this even with -pedantic.)
> >>>
> >>>It's not an invalid pointer.  It doesn't alias with Z, though.
> >>
> >>Why not?
> >
> >The C standard's aliasing rules.  *((float *)&z) is an object of type
> >float; double is a different type than float; z is an object of type
> >double; *((float *)&z) and z can not alias.
> 
> Can you point me to someplace in the standard that says this?

Sorry, I don't have a copy.  It should be described along with the rest
of the aliasing rules, where that may be.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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