[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-15 Thread steven at gcc dot gnu dot org


--- Comment #14 from steven at gcc dot gnu dot org  2006-05-15 19:55 ---
No need for investigation anymore :-)


-- 

steven at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|steven at gcc dot gnu dot   |unassigned at gcc dot gnu
   |org |dot org
 Status|ASSIGNED|NEW


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-15 Thread patchapp at dberlin dot org


--- Comment #13 from patchapp at dberlin dot org  2006-05-15 19:45 ---
Subject: Bug number PR27603

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00655.html


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-15 Thread rguenth at gcc dot gnu dot org


--- Comment #12 from rguenth at gcc dot gnu dot org  2006-05-15 17:36 
---
Subject: Bug 27603

Author: rguenth
Date: Mon May 15 17:35:48 2006
New Revision: 113797

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113797
Log:
2006-05-15  Richard Guenther  <[EMAIL PROTECTED]>

PR tree-optimization/27603
* tree-ssa-loop-niter.c (infer_loop_bounds_from_undefined):
Do computations in original type.

* gcc.dg/torture/pr27603.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr27603.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-loop-niter.c


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-15 Thread rguenth at gcc dot gnu dot org


--- Comment #11 from rguenth at gcc dot gnu dot org  2006-05-15 13:46 
---
I have a patch in testing.


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-14 Thread pinskia at gcc dot gnu dot org


--- Comment #10 from pinskia at gcc dot gnu dot org  2006-05-15 06:39 
---
After fixing a type mismatch in infer_loop_bounds_from_undefined, I get:
(analyze_scalar_evolution
  (loop_nb = 1)
  (scalar = D.1523_6)
(get_scalar_evolution
  (scalar = D.1523_6)
  (scalar_evolution = {4294967293, +, 1}_1))
(set_scalar_evolution
  (scalar = D.1523_6)
  (scalar_evolution = {4294967293, +, 1}_1))
)
(instantiate_parameters
  (loop_nb = 1)
  (chrec = {4294967293, +, 1}_1)
  (res = {4294967293, +, 1}_1))

Found new range for D.1523_6: [4294967293, +INF]

I don't see anything wrong with the scev really.  In fact it is correct.  maybe
what is wrong is VRP not asking the correct question.


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-14 Thread pinskia at gcc dot gnu dot org


--- Comment #9 from pinskia at gcc dot gnu dot org  2006-05-15 05:44 ---
(In reply to comment #8)
integer_nonzerop should be used instead of !integer_zerop.

See http://gcc.gnu.org/ml/gcc-patches/2006-05/msg00587.html.

-- Pinski


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-14 Thread ian at airs dot com


--- Comment #8 from ian at airs dot com  2006-05-15 05:41 ---
Steven: what's your patch?  It seems to me that this fixes the problem in
mainline:

Index: tree-ssa-loop-niter.c
===
--- tree-ssa-loop-niter.c   (revision 113773)
+++ tree-ssa-loop-niter.c   (working copy)
@@ -1612,7 +1612,7 @@ infer_loop_bounds_from_undefined (struct
  diff = fold_build2 (MINUS_EXPR, utype,
  TYPE_MAX_VALUE (type), init);

-   if (!integer_zerop (step))
+   if (!integer_zerop (step) && !TREE_OVERFLOW (diff))
  {
estimation = fold_build2 (CEIL_DIV_EXPR, utype, diff,
  step);


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP (-O2)

2006-05-14 Thread steven at gcc dot gnu dot org


--- Comment #7 from steven at gcc dot gnu dot org  2006-05-15 04:36 ---
Investigating a fix.


-- 

steven at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |steven at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2006-05-14 17:44:48 |2006-05-15 04:36:57
   date||


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread mmitchel at gcc dot gnu dot org


--- Comment #6 from mmitchel at gcc dot gnu dot org  2006-05-14 22:43 
---
My mistake; I had thought it was only generating wrong-code with non-default
options.  I have adjusted this to P1.


-- 

mmitchel at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P2  |P1


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread pinskia at gcc dot gnu dot org


--- Comment #5 from pinskia at gcc dot gnu dot org  2006-05-14 22:42 ---
Is there a reason why this is not a P1?  This is wrong code.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||mmitchel at gcc dot gnu dot
   ||org
  GCC build triplet|i686-pc-linux-gnu   |
   GCC host triplet|i686-pc-linux-gnu   |
 GCC target triplet|i686-pc-linux-gnu   |


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread mmitchel at gcc dot gnu dot org


-- 

mmitchel at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P2


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread pinskia at gcc dot gnu dot org


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||pinskia at gcc dot gnu dot
   ||org
   Severity|major   |critical


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2006-05-14 18:00 ---
(set_scalar_evolution
  (scalar = j_3)
  (scalar_evolution = {0, +, 1}_1))
)
(instantiate_parameters
  (loop_nb = 1)
  (chrec = {0, +, 1}_1)
  (res = {0, +, 1}_1))
Found new range for j_3: [0, 0]

huh!?  (this is from 4.1 dumps)

:;
  j_3 = ASSERT_EXPR ;
  j.0_5 = (unsigned int) j_3;
  D.1285_6 = j.0_5 - 3;
  if (D.1285_6 <= 1) goto ; else goto ;

:;
  exit (0);

:;
  D.1286_7 = 6 - j_3;
  D.1287_8 = D.1286_7 * 1000;
  a = D.1287_8;
  j_10 = j_3 + 1;

  # j_2 = PHI <0(0), j_10(3)>;
:;
  if (j_2 <= 5) goto ; else goto ;

:;
  abort ();


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread rguenth at gcc dot gnu dot org


--- Comment #3 from rguenth at gcc dot gnu dot org  2006-05-14 17:56 ---
We fold (j == 3 || j == 4) to (unsigned)j - 3 <= 1, which VRP considers to be
always false.

void exit (int);
void abort (void);
int a;
int main()
{
  int j;
  for (j = 0; j < 6; j++)
  {
if ((unsigned)j - 3 <= 1)
  exit (0);
a = 1000 * (6 - j);
  }
  abort ();
}

somehow the false information is extracted from the multiplication expression.


-- 


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread rguenth at gcc dot gnu dot org


--- Comment #2 from rguenth at gcc dot gnu dot org  2006-05-14 17:44 ---
Confirmed.  Reduced testcase:

void abort(void);

int g1[6] = { 0, 0, 0, 0, 0, 0 };
int g4 = 0;

void Foo(void)
{
  int j;
  for (j = 0; j < 6; j++) {
if (j == 3 || j == 4)
  g1[j] = 100;
g4 += 1000 * (6 - j);
  }
}

int main() {
  Foo();
  if (g1[3] != 100 || g1[4] != 100)
abort ();
  return 0;
}


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2006-05-14 17:44:48
   date||


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



[Bug tree-optimization/27603] [4.1/4.2 Regression] wrong code, apparently due to bad VRP

2006-05-14 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 CC||rguenth at gcc dot gnu dot
   ||org
  Component|c++ |tree-optimization
   Keywords||wrong-code
  Known to fail|4.1.0   |4.1.0 4.2.0
Summary|wrong code, apparently due  |[4.1/4.2 Regression] wrong
   |to bad VRP  |code, apparently due to bad
   ||VRP
   Target Milestone|--- |4.1.1


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