This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: preprocessor/1976
- To: neil at gcc dot gnu dot org
- Subject: Re: preprocessor/1976
- From: neil at gcc dot gnu dot org
- Date: 14 Feb 2001 12:26:03 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: neil at gcc dot gnu dot org
The following reply was made to PR preprocessor/1976; it has been noted by GNATS.
From: neil@gcc.gnu.org
To: fl@abas.de, gcc-gnats@gcc.gnu.org, neil@gcc.gnu.org, nobody@gcc.gnu.org
Cc:
Subject: Re: preprocessor/1976
Date: 14 Feb 2001 12:18:03 -0000
Synopsis: different treatment of shift in preprocessor and compiler
Responsible-Changed-From-To: unassigned->neil
Responsible-Changed-By: neil
Responsible-Changed-When: Wed Feb 14 04:18:02 2001
Responsible-Changed-Why:
Mine!
State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Wed Feb 14 04:18:02 2001
State-Changed-Why:
This is not a bug. In the preprocessor, all arithmetic
is done in type int_max_t, which for you is a long long and
64 bits; this cannot be changed.
However, in the compiler expression, the type of "4" and "31" is "int", and so arithmetic is done in type int, i.e. 32 bits. If you want the same answer, you need to use "4L".
See sections 6.4.4.1, 6.5.7 and 6.10.1 of the standard.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=1976&database=gcc