Bug#357897: FTBFS with G++ 4.1: dereferencing type-punned pointer will break...

Pierre HABOUZIT madcoder at debian.org
Thu May 25 14:19:08 UTC 2006


On Mon, Mar 20, 2006 at 05:07:15AM +0000, Martin Michlmayr wrote:
> Package: holotz-castle
> Version: 1.3.8-1
> Severity: important
> 
> Your package fails to build with G++ 4.1.  I'm filing this bug as
> important for now, but when 4.1 will be the default compiler in
> unstable (probably in a few weeks) I'll upgrade this to serious.
> 
> 
> (seen on i386 and mips)
> > Automatic build of holotz-castle_1.3.8-1 on bigsur by sbuild/mips 1.106
> ...
> > g++ -I. -I../JLib -DLINUX -g -O2 -Wall -Werror -Wshadow  -ffast-math -c `sdl-config --cflags` -DHC_DATA_DIR=\"/usr/share/games/holotz-castle/game/\" -DHCED_DATA_DIR=\"/usr/share/games/holotz-castle/editor/\" HCRope.cpp -o HCRope.o
> > cc1plus: warnings being treated as errors
> > HCRope.cpp: In member function 'u32 HCRope::Load(JRW&)':
> > HCRope.cpp:130: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > HCRope.cpp:134: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > HCRope.cpp:135: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > HCRope.cpp: In member function 'u32 HCRope::Save(JRW&)':
> > HCRope.cpp:164: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > HCRope.cpp:168: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > HCRope.cpp:169: warning: dereferencing type-punned pointer will break strict-aliasing rules
> > make[2]: *** [HCRope.o] Error 1
> > make[2]: Leaving directory `/build/tbm/holotz-castle-1.3.8/src'

  the problem here comes from the fact that you have some:

  (u32 *)&foo with foo beeing a float passed to functions.
  that's super ugly.

  you can expand the code by doing this (this remains super ugly, I'm
even not sure it's not endian-dependant):

  double *dblp = &foo;
  function_call((u32 *)dblp) ...

  that patch will work for each part of HCRope.cpp.


  another super ugly possiiblity is to add -Wno-strict-aliasing to
CFLAGS.
-- 
·O·  Pierre Habouzit
··O                                                madcoder at debian.org
OOO                                                http://www.madism.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20060525/0c520510/attachment.pgp


More information about the Pkg-games-devel mailing list