public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/19606] New: wrong code for arith.expr: (((unsigned int)(signed int) a ) / 2LL) with signed char a=-4
@ 2005-01-24 16:00 heinrich dot brand at fujitsu-siemens dot com
  2005-01-24 16:20 ` [Bug middle-end/19606] " falk at debian dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: heinrich dot brand at fujitsu-siemens dot com @ 2005-01-24 16:00 UTC (permalink / raw)
  To: gcc-bugs

The value of test should be 0x7ffffffe and is 0xfffffffe; 

Flags: none

(Also in 3.3.5)

#include <stdio.h>
signed char a=-4;
int test(){
	return (((unsigned int)(signed int) a ) / 2LL) ;
}

int main(void){
	int r;
	r=test();
	printf("test output:  %#x == %d      %x %x\n",r,r
		,(r==0x7ffffffe),(r==0xfffffffe));
	if(r == ( ((unsigned int)(signed int) (signed char) -4 ) / 2LL ))
  		printf("test successful\n");
  	else
  		printf("test failed\n");	  
	return 0; 
}

-- 
           Summary: wrong code for arith.expr: (((unsigned int)(signed int)
                    a ) / 2LL) with signed char a=-4
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: heinrich dot brand at fujitsu-siemens dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: Intel-Linux
  GCC host triplet: Intel-Linux
GCC target triplet: Intel-Linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19606


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-02-11 23:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-24 16:00 [Bug middle-end/19606] New: wrong code for arith.expr: (((unsigned int)(signed int) a ) / 2LL) with signed char a=-4 heinrich dot brand at fujitsu-siemens dot com
2005-01-24 16:20 ` [Bug middle-end/19606] " falk at debian dot org
2005-01-24 16:41 ` pinskia at gcc dot gnu dot org
2005-02-12 11:13 ` steven at gcc dot gnu dot org
2005-02-12 13:50 ` steven at gcc dot gnu dot org
2005-02-12 15:32 ` [Bug c/19606] " steven at gcc dot gnu dot org

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).