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

[Bug c++/14024] g++ isn't reporting aliasing warnings


------- Additional Comments From uros at kss-loka dot si  2004-12-29 07:49 -------
This example is from PR 16111:
#include <stdio.h>

float foo ()
{
  unsigned int MASK = 0x80000000;
  return (float &) MASK;
}

int main() {
  printf ("%f\n", foo());
  return 0;
}

'g++ -Wstrict-aliasing' does not generate a warning about breaking
strict-aliasing rules. When '(float&)MASK' is replaced with equivalent '*(float
*)&MASK', 'gcc -Wstrict-aliasing' produces expected warning.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |djp at volny dot cz
  GCC build triplet|powerpc-apple-darwin7.2.0   |*-*-*
   GCC host triplet|powerpc-apple-darwin7.2.0   |*-*-*
 GCC target triplet|powerpc*-*-*                |*-*-*


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


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