This is the mail archive of the gcc-bugs@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]

preprocessor/3824: With -traditional, CPP 0xffffffff > 0 but C 0xffffffff < 0



>Number:         3824
>Category:       preprocessor
>Synopsis:       With -traditional, CPP 0xffffffff > 0 but C 0xffffffff < 0
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 25 14:06:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Hallvard B Furuseth
>Release:        3.0
>Organization:
>Environment:
System: SunOS bombur.uio.no 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ./configure --quiet --enable-version-specific-runtime-libs --prefix=/usit/bombur/hbf --program-suffix=-3.0
>Description:
	With gcc -traditional and 32-bit int/long,
	0xffffffff is positive in the preprocessor but negative in C.

>How-To-Repeat:
	bash$ cat a.c
extern int puts();
int main()
{
#if 0xffffffff < 0
    puts("cpp:negative");
#else
    puts("cpp:positive");
#endif
    puts(0xffffffff < 0 ? "c:negative" : "c:positive");
    return 0;
}
	bash$ gcc3 -traditional a.c && ./a.out
cpp:positive
c:negative

>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


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