public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive
@ 2005-07-14 18:48 pinskia at gcc dot gnu dot org
  2005-07-14 18:49 ` [Bug tree-optimization/22493] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-14 18:48 UTC (permalink / raw)
  To: gcc-bugs

Take the following code:
#include <limits.h>
void abort ();
void f(int i)
{
  if (i>0)
    abort();
  i = -i;
  if (i<0)
    return;
  abort ();
}

int main(void)
{
  f(INT_MIN);
  return 0;
}

This should not abort but does at -O2 -fwrapv and above because VRP is folding the conditional which 
is not true as -INT_MIN = INT_MIN still.  This causes us to mis compile Long.toString in libjava.

-- 
           Summary: [4.1 Regression] with -fwrapv -INT_MIN is still not
                    postive
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not postive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
@ 2005-07-14 18:49 ` pinskia at gcc dot gnu dot org
  2005-07-14 18:50 ` pinskia at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-14 18:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu dot
                   |                            |org
   Target Milestone|---                         |4.1.0


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not postive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
  2005-07-14 18:49 ` [Bug tree-optimization/22493] " pinskia at gcc dot gnu dot org
@ 2005-07-14 18:50 ` pinskia at gcc dot gnu dot org
  2005-07-14 18:57 ` tromey at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-14 18:50 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
OtherBugsDependingO|                            |22084
              nThis|                            |


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not postive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
  2005-07-14 18:49 ` [Bug tree-optimization/22493] " pinskia at gcc dot gnu dot org
  2005-07-14 18:50 ` pinskia at gcc dot gnu dot org
@ 2005-07-14 18:57 ` tromey at gcc dot gnu dot org
  2005-07-15 21:17 ` [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive tromey at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-07-14 18:57 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at gcc dot gnu dot
                   |                            |org


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2005-07-14 18:57 ` tromey at gcc dot gnu dot org
@ 2005-07-15 21:17 ` tromey at gcc dot gnu dot org
  2005-07-16 21:36 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu dot org @ 2005-07-15 21:17 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.1 Regression] with -     |[4.1 Regression] with -
                   |fwrapv -INT_MIN is still not|fwrapv -INT_MIN is still not
                   |postive                     |positive


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2005-07-15 21:17 ` [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive tromey at gcc dot gnu dot org
@ 2005-07-16 21:36 ` pinskia at gcc dot gnu dot org
  2005-07-17  0:48 ` phython at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-16 21:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-16 21:33 -------
Note I should give credit to Andrew Haley who pointed me to the mis compiling of Long.toString.

-- 


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2005-07-16 21:36 ` pinskia at gcc dot gnu dot org
@ 2005-07-17  0:48 ` phython at gcc dot gnu dot org
  2005-07-17 20:36 ` pluto at agmk dot net
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: phython at gcc dot gnu dot org @ 2005-07-17  0:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2005-07-17 00:28 -------
Created an attachment (id=9291)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9291&action=view)
Treat flag_wrapv and min value in a special way


-- 


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2005-07-17  0:48 ` phython at gcc dot gnu dot org
@ 2005-07-17 20:36 ` pluto at agmk dot net
  2005-07-19  7:31 ` phython at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pluto at agmk dot net @ 2005-07-17 20:36 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]


------- Additional Comments From pluto at agmk dot net  2005-07-17 20:35 -------
(In reply to comment #2) 
> Created an attachment (id=9291)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9291&action=view) 
> Treat flag_wrapv and min value in a special way 
>  
 
patch cointains typo-bug. 
 
--- gcc-pr22493.patch   Sun Jul 17 20:07:13 2005 
+++ gcc-pr22493.patch   Sun Jul 17 22:33:27 2005 
@@ -53,7 +53,7 @@ 
 -      max = (vr0.min == TYPE_MIN_VALUE (TREE_TYPE (expr))) 
 -          ? TYPE_MAX_VALUE (TREE_TYPE (expr)) 
 -          : fold_unary_to_constant (code, TREE_TYPE (expr), vr0.min); 
-+        type = VR_ANTI_RANGE; 
++        vr_type = VR_ANTI_RANGE; 
 +        max = fold_unary_to_constant (code, TREE_TYPE (expr), vr0.max); 
 +        max = int_const_binop (MINUS_EXPR, max, one, 0); 
 +        min = int_const_binop (PLUS_EXPR, min, one, 0); 
 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2005-07-17 20:36 ` pluto at agmk dot net
@ 2005-07-19  7:31 ` phython at gcc dot gnu dot org
  2005-07-19 13:43 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: phython at gcc dot gnu dot org @ 2005-07-19  7:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2005-07-19 07:15 -------
 The attached patch, with the typo fixed and using
 int_const_binop (PLUS_EXPR, vr0.min, one, 0) fixed the optimization failures of
Divide_1 in the testsuite.

-- 


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2005-07-19  7:31 ` phython at gcc dot gnu dot org
@ 2005-07-19 13:43 ` pinskia at gcc dot gnu dot org
  2005-07-23  9:40 ` phython at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-19 13:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-19 13:41 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-19 13:42:00
               date|                            |


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2005-07-19 13:43 ` pinskia at gcc dot gnu dot org
@ 2005-07-23  9:40 ` phython at gcc dot gnu dot org
  2005-07-25  0:15 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: phython at gcc dot gnu dot org @ 2005-07-23  9:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2005-07-23 08:25 -------
Created an attachment (id=9336)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9336&action=view)
Updated patch

 This should also fix:
/* { dg-do run } */
/* { dg-options "-O1 -ftree-vrp" } */

extern void abort ();
extern void exit (int);

int f (int a) {
	if (a != 2) {
		a = -a;
		if (a == 2)
		  return 0;
		return 1;
	}
	return 1;
}

int main (int argc, char *argv[]) {
	if (f (-2))
		abort ();
	exit (0);
}

 which fails right now.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |phython at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2005-07-23  9:40 ` phython at gcc dot gnu dot org
@ 2005-07-25  0:15 ` pinskia at gcc dot gnu dot org
  2005-07-28  4:40 ` cvs-commit at gcc dot gnu dot org
  2005-07-28  4:45 ` phython at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-25  0:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-25 00:11 -------
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01566.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2005-
                   |                            |07/msg01566.html
           Keywords|                            |patch


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (10 preceding siblings ...)
  2005-07-25  0:15 ` pinskia at gcc dot gnu dot org
@ 2005-07-28  4:40 ` cvs-commit at gcc dot gnu dot org
  2005-07-28  4:45 ` phython at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-07-28  4:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-28 04:35 -------
Subject: Bug 22493

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	phython@gcc.gnu.org	2005-07-28 04:35:02

Modified files:
	gcc            : ChangeLog tree-vrp.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: pr22493-1.c pr22493-1.x 
	                                     vrp-1.c vrp-2.c vrp-3.c 

Log message:
	2005-07-27  James A. Morrison  <phython@gcc.gnu.org>
	
	PR tree-optimization/22493
	* tree-vrp.c (extract_range_from_unary_expr): Deal with -fwrapv and
	VR_ANTI_RANGEs properly for NEGATE_EXPRs and ABS_EXPRs.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9575&r2=2.9576
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-vrp.c.diff?cvsroot=gcc&r1=2.43&r2=2.44
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5832&r2=1.5833
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22493-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/pr22493-1.x.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/vrp-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/vrp-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/vrp-3.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive
  2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
                   ` (11 preceding siblings ...)
  2005-07-28  4:40 ` cvs-commit at gcc dot gnu dot org
@ 2005-07-28  4:45 ` phython at gcc dot gnu dot org
  12 siblings, 0 replies; 14+ messages in thread
From: phython at gcc dot gnu dot org @ 2005-07-28  4:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2005-07-28 04:45 -------
 Fixed in the commit above.

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


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


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

end of thread, other threads:[~2005-07-28  4:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-14 18:48 [Bug tree-optimization/22493] New: [4.1 Regression] with -fwrapv -INT_MIN is still not postive pinskia at gcc dot gnu dot org
2005-07-14 18:49 ` [Bug tree-optimization/22493] " pinskia at gcc dot gnu dot org
2005-07-14 18:50 ` pinskia at gcc dot gnu dot org
2005-07-14 18:57 ` tromey at gcc dot gnu dot org
2005-07-15 21:17 ` [Bug tree-optimization/22493] [4.1 Regression] with -fwrapv -INT_MIN is still not positive tromey at gcc dot gnu dot org
2005-07-16 21:36 ` pinskia at gcc dot gnu dot org
2005-07-17  0:48 ` phython at gcc dot gnu dot org
2005-07-17 20:36 ` pluto at agmk dot net
2005-07-19  7:31 ` phython at gcc dot gnu dot org
2005-07-19 13:43 ` pinskia at gcc dot gnu dot org
2005-07-23  9:40 ` phython at gcc dot gnu dot org
2005-07-25  0:15 ` pinskia at gcc dot gnu dot org
2005-07-28  4:40 ` cvs-commit at gcc dot gnu dot org
2005-07-28  4:45 ` phython 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).