public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/19068] New: Wrong code for MIN_EXPR and MAX_EXPR
@ 2004-12-18 15:39 steven at gcc dot gnu dot org
  2004-12-18 15:41 ` [Bug middle-end/19068] [3.3/3.4 only] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: steven at gcc dot gnu dot org @ 2004-12-18 15:39 UTC (permalink / raw)
  To: gcc-bugs

The following code miscompiles with all GCCs except mainline. 
 
------------------------------------------------------ 
long fff[10]; 
 
extern "C" void abort (void); 
  
  
long f(long a, long b) 
{ 
  int i; 
  a =  *((long*)(a+5))>?*((long*)(a+1)); 
  for(i=0;i<10;i++) 
   fff[i] = a; 
} 
 
  
int main(void) 
{ 
  int i; 
  long a[2] = {10,5}; 
  f((long)(&a)-1,0); 
  for(i = 0;i<10;i++) 
   if (fff[i]!=10) 
    abort (); 
} 
------------------------------------------------------ 
 
The fix is the same as Roger Sayle's fix for PR18548.

-- 
           Summary: Wrong code for MIN_EXPR and MAX_EXPR
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: steven at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,roger at eyesopen dot
                    com


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


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

end of thread, other threads:[~2004-12-20 19:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-18 15:39 [Bug middle-end/19068] New: Wrong code for MIN_EXPR and MAX_EXPR steven at gcc dot gnu dot org
2004-12-18 15:41 ` [Bug middle-end/19068] [3.3/3.4 only] " pinskia at gcc dot gnu dot org
2004-12-19 14:00 ` pinskia at gcc dot gnu dot org
2004-12-19 20:01 ` cvs-commit at gcc dot gnu dot org
2004-12-19 20:11 ` cvs-commit at gcc dot gnu dot org
2004-12-19 21:07 ` [Bug middle-end/19068] [3.3 " pinskia at gcc dot gnu dot org
2004-12-20  2:43 ` cvs-commit at gcc dot gnu dot org
2004-12-20  2:49 ` pinskia at gcc dot gnu dot org
2004-12-20 19:54 ` hjl at lucon dot org
2004-12-20 19:56 ` pinskia 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).