cast question, again

Marc Lehmann schmorp at schmorp.de
Mon Sep 29 15:49:19 CEST 2008


On Mon, Sep 29, 2008 at 10:51:33AM +0200, Alejandro Mery <amery at geeks.cl> wrote:
> > I know it's easy to deceive oneself, but the fact remains that your code is
> > now buggy, thanks to the policy you are trying to follow.
> 
> may I ask who's the buggy-code-maker from "-Os -fno-strict-aliasing
> -Werror -Wall  -W" exactly?
> 
> what do you suggest to add or remove to make gcc not produce "buggy" code?

Nothing - keep libev as it is and gcc will not produce buggy code (at
least not due to this issue):

gcc will not produce buggy code with the original ev.h and with or without
-fno-strict-aliasing, and gcc will produce no code with -Werror because it
won't compile, and no code isn't buggy code either.

Removing the cast from ev.h will create buggy code (namely the source in
ev.h), but whether gcc takes advantage of that and the resulting binary
will work nor not depends on many factors, most likely ev.c itself will
get miscompiled, but users of ev.h will probably work because gcc does not
optimise (by default) between separate compilation units yet.

-- 
                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      pcg at goof.com
      -=====/_/_//_/\_,_/ /_/\_\



More information about the libev mailing list