Date: Sun, 13 Jan 2013 13:46:28 -0600 From: Rob Landley <rob@...dley.net> To: musl@...ts.openwall.com Cc: musl@...ts.openwall.com Subject: Re: NULL On 01/13/2013 11:47:32 AM, Szabolcs Nagy wrote: > > So I think you're saying is that the behavior I'm depending on > changed? > > well, > > (int)(void*)0 is not an "integer constant expression" and it > is not a "null pointer constant", C99 188.8.131.52: An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant. 7.17 #3: The macros are NULL which expands to an implementation-defined null pointer constant; So it uses "constant" in the name but either it's not a constant or typecasting it twice makes it stop being a constant. > it is not an "arithmetic > constant expression" nor an "address constant", but an > implementation is allowed to accept it as a "constant expression" > anyway > (as far as i can see it is not required to though) Actually it turned out the problem was I accidentally checked in some debug code, which set -O0 (which apparently disables --gc-sections even when explicitly specified). So it's still working fine. Whether or not it should depends on whether or not "constant" means it's a constant. > !(void*)0 and (void*)0 || (void*)0 are similar > > in initializers they may be accepted, but the standard > does not require them to be At one point, I had to dig through all this stuff: http://lists.gnu.org/archive/html/tinycc-devel/2007-09/msg00128.html Alas, that was about 5 years ago and I no longer remember the details. > gcc used to be less strict integer constant expressions, > but recently it follows the standard more closely > > > Sigh. Yup. When I build toybox with just "true", gcc 4.2.1 (last gpl > > release) drops out parse_optflag() but the ubuntu host toolchain no > > longer does. > > i think gcc should be able to do the optimization It can, it was -O0. Pilot error. :) Rob
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.