public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/23128] New: VRP fails for unsigned values
@ 2005-07-29  9:32 rmorganl at u dot washington dot edu
  2005-07-29 11:35 ` [Bug tree-optimization/23128] [4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rmorganl at u dot washington dot edu @ 2005-07-29  9:32 UTC (permalink / raw)
  To: gcc-bugs

VRP miscompiles the following testcase at -O2 (on a machine with 32-bit ints):

#include <stdlib.h>

void test(unsigned int a, unsigned int b)
{
        if (a < 5)
                abort();
        if (b < 5)
                abort();
        if (a + b != 0)
                abort();
}

int main()
{
        unsigned int x = 0x80000000;
        test(x, x);
}


The t27.vrp dump shows why:

...
D.1824_3: [10, 0fffffffe]  EQUIVALENCES: { } (0 elements)
a_4: [5, +INF]  EQUIVALENCES: { a_1 } (1 elements)
b_5: [5, +INF]  EQUIVALENCES: { b_2 } (1 elements)

Folding predicate D.1824_3 != 0 to 1
...

VRP concludes that since a >= 5 and b >= 5, a + b >= 10. However, since unsigned
variables have wrapping semantics, this is incorrect. It then miscompiles test()
to include an unconditional abort.

-- 
           Summary: VRP fails for unsigned values
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rmorganl at u dot washington dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


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


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

* [Bug tree-optimization/23128] [4.1 Regression] VRP fails for unsigned values
  2005-07-29  9:32 [Bug tree-optimization/23128] New: VRP fails for unsigned values rmorganl at u dot washington dot edu
@ 2005-07-29 11:35 ` pinskia at gcc dot gnu dot org
  2005-07-30 18:14 ` phython at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-07-29 11:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-07-29 11:31 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |phython at gcc dot gnu dot
                   |                            |org, dnovillo at gcc dot gnu
                   |                            |dot org
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2005-07-29 11:31:44
               date|                            |
            Summary|VRP fails for unsigned      |[4.1 Regression] VRP fails
                   |values                      |for unsigned values
   Target Milestone|---                         |4.1.0


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


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

* [Bug tree-optimization/23128] [4.1 Regression] VRP fails for unsigned values
  2005-07-29  9:32 [Bug tree-optimization/23128] New: VRP fails for unsigned values rmorganl at u dot washington dot edu
  2005-07-29 11:35 ` [Bug tree-optimization/23128] [4.1 Regression] " pinskia at gcc dot gnu dot org
@ 2005-07-30 18:14 ` phython at gcc dot gnu dot org
  2005-08-06  5:35 ` cvs-commit at gcc dot gnu dot org
  2005-08-06  5:43 ` phython at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: phython at gcc dot gnu dot org @ 2005-07-30 18:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2005-07-30 18:12 -------
Created an attachment (id=9388)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=9388&action=view)
Patch for a bunch of vrp problems


-- 
           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=23128


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

* [Bug tree-optimization/23128] [4.1 Regression] VRP fails for unsigned values
  2005-07-29  9:32 [Bug tree-optimization/23128] New: VRP fails for unsigned values rmorganl at u dot washington dot edu
  2005-07-29 11:35 ` [Bug tree-optimization/23128] [4.1 Regression] " pinskia at gcc dot gnu dot org
  2005-07-30 18:14 ` phython at gcc dot gnu dot org
@ 2005-08-06  5:35 ` cvs-commit at gcc dot gnu dot org
  2005-08-06  5:43 ` phython at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-08-06  5:35 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-08-06 05:35 -------
Subject: Bug 23128

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	phython@gcc.gnu.org	2005-08-06 05:35:32

Modified files:
	gcc            : ChangeLog tree-vrp.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.c-torture/execute: vrp-5.c vrp-6.c 
	gcc/testsuite/gcc.dg/tree-ssa: vrp21.c 

Log message:
	2005-08-05  James A. Morrison  <phython@gcc.gnu.org>
	
	PR tree-optimization/23128
	* tree-vrp.c (vrp_int_const_binop): Check if unsigned addition or
	subtraction wrap, and set TREE_OVERFLOW if they do.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9665&r2=2.9666
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-vrp.c.diff?cvsroot=gcc&r1=2.48&r2=2.49
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5883&r2=1.5884
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/execute/vrp-5.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-6.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/vrp21.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug tree-optimization/23128] [4.1 Regression] VRP fails for unsigned values
  2005-07-29  9:32 [Bug tree-optimization/23128] New: VRP fails for unsigned values rmorganl at u dot washington dot edu
                   ` (2 preceding siblings ...)
  2005-08-06  5:35 ` cvs-commit at gcc dot gnu dot org
@ 2005-08-06  5:43 ` phython at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: phython at gcc dot gnu dot org @ 2005-08-06  5:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From phython at gcc dot gnu dot org  2005-08-06 05:42 -------
Fixed.

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


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


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

end of thread, other threads:[~2005-08-06  5:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-29  9:32 [Bug tree-optimization/23128] New: VRP fails for unsigned values rmorganl at u dot washington dot edu
2005-07-29 11:35 ` [Bug tree-optimization/23128] [4.1 Regression] " pinskia at gcc dot gnu dot org
2005-07-30 18:14 ` phython at gcc dot gnu dot org
2005-08-06  5:35 ` cvs-commit at gcc dot gnu dot org
2005-08-06  5:43 ` 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).