This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor/5806: The preprocessor evaluates expression s in 64-bit, violating IS C++ 16.1.4
- From: neil at gcc dot gnu dot org
- To: dick_schoeller at bmc dot com, eric_dana at bmc dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, neil at gcc dot gnu dot org
- Date: 27 May 2002 19:22:21 -0000
- Subject: Re: preprocessor/5806: The preprocessor evaluates expression s in 64-bit, violating IS C++ 16.1.4
- Reply-to: neil at gcc dot gnu dot org, dick_schoeller at bmc dot com, eric_dana at bmc dot com, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, neil at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: The preprocessor evaluates expression s in 64-bit, violating IS C++ 16.1.4
State-Changed-From-To: analyzed->closed
State-Changed-By: neil
State-Changed-When: Mon May 27 12:22:20 2002
State-Changed-Why:
After some recent patches of mine, GCC 3.2 does preprocessor arithmetic to the precision of the target's intmax_t, as required by the C99 standard.
As you can see from a discussion in the last two days on GCC-patches mailing list, it was decided that we should do this in C89 mode as well, otherwise there is no consistent way for us to have the long-long extension.
Now, you claim it violates the ISO C++ and C89 standards. In fact it does not; if you read the relevant section carefully, it says that CPP arithmetic is done to *at least* the precision of the target "long" type. By using intmax_t, we are in compliance with this requirement:
"... the controlling constant expression ... is evaluated according to the rules of 6.4 using arithmetic that has *at least* the ranges specified in 5.2.4.2, except that int and unsigned int act as if they have the same representation as, respectively, long and unsigned long."
Because of this wording, any code that relied on the C89 preprocessor to determine properties of the target machine precision was always broken.
Thanks for the bug report.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=5806