[Bug c/20709] strict aliasing warning with float pointer pointing to int pointer

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Apr 2 00:09:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-04-02 00:09 -------
Because we only warn if you take the address and then cast so if you have a tempary variable 
inbetween, we don't warn.

Note really strict aliasing warnings are hard to produce as it is only a bug if you access via those two 
types.
Aka this is valid and defined (even though we warn):
float a(float b)
{
  int i;
  *(float*)&i = b;
  return *(float*)&i;
}

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20709



More information about the Gcc-bugs mailing list