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

* [Bug middle-end/19068] [3.3/3.4 only] Wrong code for MIN_EXPR and MAX_EXPR
  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 ` pinskia at gcc dot gnu dot org
  2004-12-19 14:00 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-18 15:41 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Wrong code for MIN_EXPR and |[3.3/3.4 only] Wrong code
                   |MAX_EXPR                    |for MIN_EXPR and MAX_EXPR
   Target Milestone|---                         |3.4.4
            Version|4.0.0                       |3.4.4


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


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

* [Bug middle-end/19068] [3.3/3.4 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-19 14:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-19 14:00 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-12-19 14:00:40
               date|                            |


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


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

* [Bug middle-end/19068] [3.3/3.4 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-19 20:01 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-19 20:01 -------
Subject: Bug 19068

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	sayle@gcc.gnu.org	2004-12-19 20:01:36

Modified files:
	gcc            : ChangeLog expr.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: max1.C 

Log message:
	PR middle-end/19068
	* expr.c (expand_expr_real_1) <MAX_EXPR>: Ensure that target, op0
	and op1 are all registers (or constants) before expanding the RTL
	comparison sequence [to avoid reg_overlap_mentioned (target, op1)].
	
	* g++.dg/opt/max1.C: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.747&r2=2.2326.2.748
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.615.4.18&r2=1.615.4.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.332&r2=1.3389.2.333
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/max1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug middle-end/19068] [3.3/3.4 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (2 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-19 20:11 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-19 20:11 -------
Subject: Bug 19068

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-12-19 20:11:16

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: max1.C 

Log message:
	PR middle-end/19068
	* g++.dg/opt/max1.C: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4782&r2=1.4783
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/max1.C.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


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


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

* [Bug middle-end/19068] [3.3 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (3 preceding siblings ...)
  2004-12-19 20:11 ` cvs-commit at gcc dot gnu dot org
@ 2004-12-19 21:07 ` pinskia at gcc dot gnu dot org
  2004-12-20  2:43 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-19 21:07 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.4.3 3.3.2
      Known to work|                            |4.0.0 3.4.4
            Summary|[3.3/3.4 only] Wrong code   |[3.3 only] Wrong code for
                   |for MIN_EXPR and MAX_EXPR   |MIN_EXPR and MAX_EXPR
   Target Milestone|3.4.4                       |3.3.6


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


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

* [Bug middle-end/19068] [3.3 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (4 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-12-20  2:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-12-20 02:43 -------
Subject: Bug 19068

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	sayle@gcc.gnu.org	2004-12-20 02:43:14

Modified files:
	gcc            : ChangeLog expr.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/opt: max1.C 

Log message:
	PR middle-end/19068
	* expr.c (expand_expr_real_1) <MAX_EXPR>: Ensure that target, op0
	and op1 are all registers (or constants) before expanding the RTL
	comparison sequence [to avoid reg_overlap_mentioned (target, op1)].
	
	* g++.dg/opt/max1.C: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.1042&r2=1.16114.2.1043
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/expr.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.498.2.31&r2=1.498.2.32
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.390&r2=1.2261.2.391
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/max1.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.2.2.1



-- 


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


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

* [Bug middle-end/19068] [3.3 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (5 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-20  2:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-20 02:49 -------
Fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug middle-end/19068] [3.3 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (6 preceding siblings ...)
  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
  8 siblings, 0 replies; 10+ messages in thread
From: hjl at lucon dot org @ 2004-12-20 19:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From hjl at lucon dot org  2004-12-20 19:54 -------
g++.dg/opt/max1.C still failed on both Linux/ia64 and Linux/x86_64:

http://gcc.gnu.org/ml/gcc-testresults/2004-12/msg00919.html
http://gcc.gnu.org/ml/gcc-testresults/2004-12/msg00923.html

They are both 64bit targets.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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


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

* [Bug middle-end/19068] [3.3 only] Wrong code for MIN_EXPR and MAX_EXPR
  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
                   ` (7 preceding siblings ...)
  2004-12-20 19:54 ` hjl at lucon dot org
@ 2004-12-20 19:56 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-20 19:56 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-20 19:56 -------
Please next time file a new bug since the orginal bug was fixed, I filed PR 19093 for the new bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED


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