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: Wrong RTL instruction deleted


On Mon, 27 Dec 2004 08:58:20 +0100, Uros Bizjak <uros@kss-loka.si> wrote:
> Hello!
> 
> The testcase below produces different results when compiled with
> different optimization levels:
> 
> --cut here--
> #include <stdio.h>
> 
> float foo ()
> {
>   unsigned int MASK = 0x80000000;
>   return (float &) MASK;
> }

Isn't this invalid code wrt aliasing?  Wouldn't you need to do

float foo()
{
   union {
      unsigned int MASK;
      float f;
   } u;
   u.MASK = 0x80000000;
   return u.f;
}

?  But at least we are missing a warning for this.


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