public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug regression/26180]  New: optimization regression on x86-SunOS
@ 2006-02-08 21:00 kminola at eng dot umd dot edu
  2006-02-09  0:55 ` [Bug tree-optimization/26180] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: kminola at eng dot umd dot edu @ 2006-02-08 21:00 UTC (permalink / raw)
  To: gcc-bugs

/*
% gcc -v
Using built-in specs.
Target: i386-pc-solaris2.9
Configured with: /usr/local/gcc-4.0.2/src/gcc-4.0.2/configure
--enable-languages=c --with-gnu-as
--with-as=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/as
--with-gnu-ld
--with-ld=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/ld
--prefix=/usr/local/gcc-4.0.2/x86-SunOS-gnu-as-ld
Thread model: posix
gcc version 4.0.2
%
% gcc -O0 -o foo foo.c
% foo
z= 1
%
% gcc -O2 -o foo foo.c
% foo
z= 1
%
%
% gcc-4.1 -v
Using built-in specs.
Target: i386-pc-solaris2.9
Configured with: /home/kate/gcc-4.1-20060203/src/gcc-4.1-20060203/configure
--enable-languages=c --with-gnu-as
--with-as=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/as
--with-gnu-ld
--with-ld=/usr/local/binutils-2.16.1/x86-SunOS-gcc-4.0.1/bin/ld
--prefix=/home/kate/gcc-4.1-20060203/x86-SunOS-gnu-as-ld
Thread model: posix
gcc version 4.1.0 20060203 (prerelease)
%
%
% gcc-4.1 -O0 -o foo foo.c
z = 1
%
% gcc-4.1 -O2 -o foo foo.c
z = -1
%

*/
#include <stdio.h>

int bar(x, y)
int x, y;
{
    int x1, y1;
    int x2, y2;
    unsigned int x3, y3, w;
    int z;

    x1 = (x < (1 << 30));
    y1 = (y < (1 << 30));
    if (x1 && y1) {
        x2 = ((x > 0)? (x): -(x));
        y2 = ((y > 0)? (y): -(y));

        x3 = x2;
        y3 = y2;
        w = x3 * y3;

        if (w >= (1 << 30)) {
          z = 1;
        } else    {
          z = -1;
        }
    }

        return z;
}


int main()
{
  int x, y, z;
  x = 536870912;  /* 2^29 */
  y = 2;
  z = bar(x, y);
printf("z= %d\n", z);
}


-- 
           Summary: optimization regression on x86-SunOS
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kminola at eng dot umd dot edu
 GCC build triplet: i386-pc-solaris2.9
  GCC host triplet: i386-pc-solaris2.9
GCC target triplet: i386-pc-solaris2.9


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


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

* [Bug tree-optimization/26180] [4.1/4.2 Regression] optimization regression on x86-SunOS
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
@ 2006-02-09  0:55 ` pinskia at gcc dot gnu dot org
  2006-02-09  4:20 ` [Bug tree-optimization/26180] [4.1/4.2 Regression] wrong code due to VRP and unsigned multiplies with wraps dnovillo at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-09  0:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-02-09 00:55 -------
VRP is messing up:
w_13: [0, 1]  EQUIVALENCES: { } (0 elements)
  w_13 = x3_11 * y3_12;

x3_11: [0, 2147483647]  EQUIVALENCES: { } (0 elements)
y3_12: [0, 2147483647]  EQUIVALENCES: { } (0 elements)

That is wrong.

Testcase which fails everywhere:
void abort(void);
int bar(int x, int y)
{
    int x1, y1;
    int x2, y2;
    unsigned int x3, y3, w;
    int z = 1;

    x1 = (x < (1 << 30));
    y1 = (y < (1 << 30));
    if (x1)
    if (y1) {
        x2 = ((x > 0)? (x): -(x));
        y2 = ((y > 0)? (y): -(y));

        x3 = x2;
        y3 = y2;
        w = x3 * y3;

        if (w >= (1 << 30)) {
          z = 1;
        } else    {
          z = -1;
        }
    }

        return z;
}


int main()
{
  int x, y, z;
  x = 536870912;  /* 2^29 */
  y = 2;
  z = bar(x, y);
  if (z != 1)
    abort ();
  return 0;
}


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dnovillo at gcc dot gnu dot
                   |                            |org
           Severity|normal                      |critical
             Status|UNCONFIRMED                 |NEW
          Component|regression                  |tree-optimization
     Ever Confirmed|0                           |1
  GCC build triplet|i386-pc-solaris2.9          |
   GCC host triplet|i386-pc-solaris2.9          |
 GCC target triplet|i386-pc-solaris2.9          |i386-*-*
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2006-02-09 00:55:04
               date|                            |
            Summary|optimization regression on  |[4.1/4.2 Regression]
                   |x86-SunOS                   |optimization regression on
                   |                            |x86-SunOS
   Target Milestone|---                         |4.1.0


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


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

* [Bug tree-optimization/26180] [4.1/4.2 Regression] wrong code due to VRP and unsigned multiplies with wraps
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
  2006-02-09  0:55 ` [Bug tree-optimization/26180] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-02-09  4:20 ` dnovillo at gcc dot gnu dot org
  2006-02-09 12:38 ` dnovillo at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2006-02-09  4:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dnovillo at gcc dot gnu dot org  2006-02-09 04:20 -------

Mine.  This is the same issue as 23128/23129.  Testing patch.


-- 

dnovillo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dnovillo at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-02-09 00:55:04         |2006-02-09 04:20:28
               date|                            |


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


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

* [Bug tree-optimization/26180] [4.1/4.2 Regression] wrong code due to VRP and unsigned multiplies with wraps
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
  2006-02-09  0:55 ` [Bug tree-optimization/26180] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
  2006-02-09  4:20 ` [Bug tree-optimization/26180] [4.1/4.2 Regression] wrong code due to VRP and unsigned multiplies with wraps dnovillo at gcc dot gnu dot org
@ 2006-02-09 12:38 ` dnovillo at gcc dot gnu dot org
  2006-02-09 12:42 ` dnovillo at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2006-02-09 12:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dnovillo at gcc dot gnu dot org  2006-02-09 12:38 -------
Subject: Bug 26180

Author: dnovillo
Date: Thu Feb  9 12:38:35 2006
New Revision: 110794

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110794
Log:

        PR 26180
        * tree-vrp.c (vrp_int_const_binop): Detect overflow when
        multiplying unsigned values.
        Tidy comments.

testsuite

        PR 26180
        * gcc.dg/tree-ssa/pr26180.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr26180.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vrp.c


-- 


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


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

* [Bug tree-optimization/26180] [4.1/4.2 Regression] wrong code due to VRP and unsigned multiplies with wraps
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
                   ` (2 preceding siblings ...)
  2006-02-09 12:38 ` dnovillo at gcc dot gnu dot org
@ 2006-02-09 12:42 ` dnovillo at gcc dot gnu dot org
  2006-02-09 13:38 ` [Bug tree-optimization/26180] [4.1 " pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2006-02-09 12:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dnovillo at gcc dot gnu dot org  2006-02-09 12:42 -------

Fixed.  http://gcc.gnu.org/ml/gcc-patches/2006-02/msg00743.html


-- 

dnovillo at gcc dot gnu dot org changed:

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


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


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

* [Bug tree-optimization/26180] [4.1 Regression] wrong code due to VRP and unsigned multiplies with wraps
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
                   ` (3 preceding siblings ...)
  2006-02-09 12:42 ` dnovillo at gcc dot gnu dot org
@ 2006-02-09 13:38 ` pinskia at gcc dot gnu dot org
  2006-02-09 13:38 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-09 13:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-02-09 13:38 -------
Still a bug on the 4.1 branch.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |
            Summary|[4.1/4.2 Regression] wrong  |[4.1 Regression] wrong code
                   |code due to VRP and unsigned|due to VRP and unsigned
                   |multiplies with wraps       |multiplies with wraps


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


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

* [Bug tree-optimization/26180] [4.1 Regression] wrong code due to VRP and unsigned multiplies with wraps
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
                   ` (4 preceding siblings ...)
  2006-02-09 13:38 ` [Bug tree-optimization/26180] [4.1 " pinskia at gcc dot gnu dot org
@ 2006-02-09 13:38 ` pinskia at gcc dot gnu dot org
  2006-02-09 13:40 ` dnovillo at gcc dot gnu dot org
  2006-02-09 13:41 ` dnovillo at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-02-09 13:38 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |ASSIGNED


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


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

* [Bug tree-optimization/26180] [4.1 Regression] wrong code due to VRP and unsigned multiplies with wraps
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
                   ` (5 preceding siblings ...)
  2006-02-09 13:38 ` pinskia at gcc dot gnu dot org
@ 2006-02-09 13:40 ` dnovillo at gcc dot gnu dot org
  2006-02-09 13:41 ` dnovillo at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2006-02-09 13:40 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from dnovillo at gcc dot gnu dot org  2006-02-09 13:40 -------
Subject: Bug 26180

Author: dnovillo
Date: Thu Feb  9 13:40:52 2006
New Revision: 110795

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110795
Log:

        PR 26180
        * tree-vrp.c (vrp_int_const_binop): Detect overflow when
        multiplying unsigned values.
        Tidy comments.

testsuite

        PR 26180
        * gcc.dg/tree-ssa/pr26180.c: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gcc.dg/tree-ssa/pr26180.c
Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_1-branch/gcc/tree-vrp.c


-- 


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


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

* [Bug tree-optimization/26180] [4.1 Regression] wrong code due to VRP and unsigned multiplies with wraps
  2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
                   ` (6 preceding siblings ...)
  2006-02-09 13:40 ` dnovillo at gcc dot gnu dot org
@ 2006-02-09 13:41 ` dnovillo at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: dnovillo at gcc dot gnu dot org @ 2006-02-09 13:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from dnovillo at gcc dot gnu dot org  2006-02-09 13:41 -------

.


-- 

dnovillo at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2006-02-09 13:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-08 21:00 [Bug regression/26180] New: optimization regression on x86-SunOS kminola at eng dot umd dot edu
2006-02-09  0:55 ` [Bug tree-optimization/26180] [4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-02-09  4:20 ` [Bug tree-optimization/26180] [4.1/4.2 Regression] wrong code due to VRP and unsigned multiplies with wraps dnovillo at gcc dot gnu dot org
2006-02-09 12:38 ` dnovillo at gcc dot gnu dot org
2006-02-09 12:42 ` dnovillo at gcc dot gnu dot org
2006-02-09 13:38 ` [Bug tree-optimization/26180] [4.1 " pinskia at gcc dot gnu dot org
2006-02-09 13:38 ` pinskia at gcc dot gnu dot org
2006-02-09 13:40 ` dnovillo at gcc dot gnu dot org
2006-02-09 13:41 ` dnovillo 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).