This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

preprocessor/5807: The preprocessor evaluates expression s in 64-bit, violating IS C++ 16.1.4



>Number:         5807
>Category:       preprocessor
>Synopsis:       The preprocessor evaluates expression s in 64-bit, violating IS C++ 16.1.4
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 01 12:26:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Eric Dana
>Release:        GCC 3.0.4 and possibly GCC 3.1
>Organization:
>Environment:
AIX, Solaris, Sequent and others
>Description:
The preprocessor evaluates expressions using 64-bits, violating ISO C++ 16.1.4 and 5.19. The problems is generic and can be easily reproduced. This causes the 32/64 bit test on Sequent provided header files to be incorrectly parsed.

The vendor compilers work according to the standard.

>How-To-Repeat:
On Solaris (64-bit):
cc ed.c
a.out
cc -xarch=v9 ed.c   (64-bit build)
a.out
gcc ed.c
a.out

On all OS's:
cc ed.c
a.out
gcc ed.c
a.out

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="ed.c"
Content-Disposition: inline; filename="ed.c"

#if 0
#if ((~0UL) == (0xffffffffUL))
#define MYSIZESTRING "32 bit"
#else
#define MYSIZESTRING "64 bit"
#endif
#endif
#define MYSIZESTRING "foo"
#include <stdio.h>

main ()
{
  printf("sizeof long = %d\n", sizeof(long));
  printf("C preprocessor thinks the size is: %s\n", MYSIZESTRING);
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]