public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/9164: Improper code generation on Alpha processors.
@ 2003-01-07  7:56 Falk Hueffner
  0 siblings, 0 replies; only message in thread
From: Falk Hueffner @ 2003-01-07  7:56 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR target/9164; it has been noted by GNATS.

From: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
To: rf358197@ohiou.edu, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: target/9164: Improper code generation on Alpha processors.
Date: 07 Jan 2003 08:44:56 +0100

 > There is a problem with the compiler on the Alpha platform when
 > doing comparisons between variables of different types long and int.
 > This bug was discovered through mozilla's bug database and I am not
 > sure if anyone from the GCC camp knows about it?
 
 > #define INT_MAX1 (((long)1 << (30))-1)
 > #define INT_MAX2 (1073741824-1)
 > 
 > int main()
 > {
 > 	int i = 1073741825;
 > 	long j = 1073741823;
 >    
 > 	printf ("%ld %ld\n", INT_MAX1, INT_MAX2);
 > 	printf ("%x %x\n", i, j);
 > 	printf ("%x %x\n", (unsigned int)((i)+j), 2 * j);
 >    
 > 	if ((unsigned int)((i)+j) <= 2 * INT_MAX1) 
 > 		printf ("doh1\n");
 > 	if ((unsigned int)((i)+j) <= 2 * INT_MAX2)
 > 		printf ("doh2\n");
 > 	
 > 	exit(1);
 > }
 
 Hmm, weird one. Here's a slightly smaller test case:
 
 int main(void) {
     long j = 1073741823L;
     if ((unsigned int)(1073741825L + j) < 0L)
 	puts("bad");
     else
 	puts("good");
 }
 
 Looks like the intermediate result gets 32-bit sign extended
 erraneously.
 
 -- 
 	Falk


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-01-07  7:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07  7:56 target/9164: Improper code generation on Alpha processors Falk Hueffner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).