[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-08 Thread spop at gcc dot gnu dot org


--- Comment #10 from spop at gcc dot gnu dot org  2010-03-08 17:50 ---
Subject: Bug 43065

Author: spop
Date: Mon Mar  8 17:49:48 2010
New Revision: 157288

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157288
Log:
Add testcase from PR43065.

2010-03-04  Sebastian Pop  sebastian@amd.com

PR middle-end/43065
* gcc.dg/graphite/run-id-3.c: New.

Added:
trunk/gcc/testsuite/gcc.dg/graphite/run-id-3.c
Modified:
trunk/gcc/ChangeLog.graphite


-- 


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-08 Thread spop at gcc dot gnu dot org


--- Comment #11 from spop at gcc dot gnu dot org  2010-03-08 17:50 ---
Subject: Bug 43065

Author: spop
Date: Mon Mar  8 17:49:57 2010
New Revision: 157289

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157289
Log:
Fix PR43065: Insert bounds on pointer type parameters.

2010-03-05  Sebastian Pop  sebastian@amd.com
Reza Yazdani  reza.yazd...@amd.com

PR middle-end/43065
* graphite-sese-to-poly.c (add_param_constraints): Insert bounds
on pointer type parameters.

* gcc.dg/graphite/run-id-4.c: New.

Added:
trunk/gcc/testsuite/gcc.dg/graphite/run-id-4.c
Modified:
trunk/gcc/ChangeLog.graphite
trunk/gcc/graphite-sese-to-poly.c


-- 


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-08 Thread spop at gcc dot gnu dot org


--- Comment #12 from spop at gcc dot gnu dot org  2010-03-08 17:53 ---
Fixed.


-- 

spop at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-05 Thread spop at gcc dot gnu dot org


--- Comment #4 from spop at gcc dot gnu dot org  2010-03-05 22:58 ---
Hi Reza,

In the Graphite branch, we insert in the scop context the bounds on the
parameter kk due to the type of kk:

(gdb) p debug_scop_context (scop)
context (
#  eq p0cst
2 3
1 -1   4294967295  
1  1  0  
)

and then we end up on generating the following CLAST:

(gdb) p debug_clast_stmt (pc.stmt)
for (scat_1=0;scat_1=999;scat_1++) {
  S3(scat_1) ;
  if (T_7 = 1) {
S4(scat_1) ;
  }
  S5(scat_1) ;
}
S7() ;

Your reduced case is fixed in the Graphite branch and still fails in trunk:
I will have to merge this change to trunk and I will add your reduced testcase:

commit 67570f6e8a33ff312098b7cca6e4bc5638cf6f7e
Author: spop s...@138bc75d-0d04-0410-961f-82ee72b054a4
Date:   Tue Feb 23 13:31:26 2010 +

Add constraints on the type of parameters to the scop context.

2010-02-23  Sebastian Pop  sebastian@amd.com

* graphite-sese-to-poly.c (add_param_constraints): Enabled: remove
early return.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/graph...@157002
138bc75d-0d04-0410-961f-82ee72b054a4


For the original testcase, gcc.c-torture/execute/20051215-1.c 
I still see that it is miscompiled in the Graphite branch and in trunk.

Sebastian


-- 


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-05 Thread spop at gcc dot gnu dot org


--- Comment #5 from spop at gcc dot gnu dot org  2010-03-05 23:04 ---
Subject: Bug 43065

Author: spop
Date: Fri Mar  5 23:04:17 2010
New Revision: 157247

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157247
Log:
Add testcase from PR43065.

2010-03-04  Sebastian Pop  sebastian@amd.com

PR middle-end/43065
* gcc.dg/graphite/run-id-3.c: New.

Added:
branches/graphite/gcc/testsuite/gcc.dg/graphite/run-id-3.c
Modified:
branches/graphite/gcc/ChangeLog.graphite


-- 


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-05 Thread reza dot yazdani at amd dot com


--- Comment #6 from reza dot yazdani at amd dot com  2010-03-05 23:10 
---
The main difference between the original test case and the reduced one is the
type of test expression. I think in the fix you need to treat the address type
similar to an unsigned integer.

Reza


-- 


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-05 Thread spop at gcc dot gnu dot org


--- Comment #7 from spop at gcc dot gnu dot org  2010-03-05 23:14 ---
It seems like the problem is in the overly conservative implementation
of add_param_constraints, as we do not insert bounds for pointers:

  if (!INTEGRAL_TYPE_P (type))
return;

and in the original testcase we have a pointer parameter z:

foo (int x, int y, int *z)
{
...
  if (z)
b = d * *z;
...
}


-- 

spop at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |spop at gcc dot gnu dot org
   |dot org |
 Status|NEW |ASSIGNED
   Last reconfirmed|2010-03-02 20:31:04 |2010-03-05 23:14:28
   date||


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-05 Thread spop at gcc dot gnu dot org


--- Comment #8 from spop at gcc dot gnu dot org  2010-03-05 23:46 ---
Patch at http://gcc.gnu.org/ml/gcc-patches/2010-03/msg00259.html


-- 


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-05 Thread spop at gcc dot gnu dot org


--- Comment #9 from spop at gcc dot gnu dot org  2010-03-05 23:48 ---
Subject: Bug 43065

Author: spop
Date: Fri Mar  5 23:48:43 2010
New Revision: 157248

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=157248
Log:
Fix PR43065: Insert bounds on pointer type parameters.

2010-03-05  Sebastian Pop  sebastian@amd.com
Reza Yazdani  reza.yazd...@amd.com

PR middle-end/43065
* graphite-sese-to-poly.c (add_param_constraints): Insert bounds
on pointer type parameters.

* gcc.dg/graphite/run-id-4.c: New.

Added:
branches/graphite/gcc/testsuite/gcc.dg/graphite/run-id-4.c
Modified:
branches/graphite/gcc/ChangeLog.graphite
branches/graphite/gcc/graphite-sese-to-poly.c


-- 


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-04 Thread reza dot yazdani at amd dot com


--- Comment #3 from reza dot yazdani at amd dot com  2010-03-04 18:37 
---
I reduced the test to:
--
extern void abort (void);

__attribute__ ((noinline)) int
foo (int *zzz, unsigned int kk)
{
  int a, b, d;

  a = b = 0;
  for (d = 0; d  1000; d++)
{
  if (kk != 0)
b = *zzz;
}

  return b;
}

int
main (void)
{
  if (foo (0, 0) != 0)
abort();
  return 0;
}
---
gcc tries to move an invariant unsigned test out of the loop. The following
three guarded loops are generated in the function insert_guard(..) in the
file clast.c.

if (T_7 = -1) {
  for (scat_1=0;scat_1=999;scat_1++) {
S3(scat_1) ;
S4(scat_1) ;
S5(scat_1) ;
  }
}
if (T_7 = 1) {
  for (scat_1=0;scat_1=999;scat_1++) {
S3(scat_1) ;
S4(scat_1) ;
S5(scat_1) ;
  }
}
if (T_7 == 0) {
  for (scat_1=0;scat_1=999;scat_1++) {
S3(scat_1) ;
S5(scat_1) ;
  }
}
S7() ;
$49 = void

kk is an unsigned int in the test program in the guard expression (kk != 0).
The T_7 represents kk in the above expressions. As kk is unsigned T_7 = -1 is
always true and the dereference of the pointer (*zzz) is executed
unconditionally which causes the seg. fault. If the type of kk is changed to
signed, the correct code is generated.

I think, as unsigned expressions are bounded from one side, there must be a
constrain in insert_guard(..) that if the guard is unsigned, only the last two
cases should be generated.


-- 

reza dot yazdani at amd dot com changed:

   What|Removed |Added

 CC||reza dot yazdani at amd dot
   ||com


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-03-02 Thread pinskia at gcc dot gnu dot org


--- Comment #2 from pinskia at gcc dot gnu dot org  2010-03-02 20:31 ---
Confirmed, the testcase is gcc.c-torture/execute/20051215-1.c by the way.


-- 

pinskia at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
   GCC host triplet|x86_64-pc-linux-gnu |
   Last reconfirmed|-00-00 00:00:00 |2010-03-02 20:31:04
   date||


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-02-17 Thread mmitchel at gcc dot gnu dot org


-- 

mmitchel at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P1


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-02-17 Thread mmitchel at gcc dot gnu dot org


--- Comment #1 from mmitchel at gcc dot gnu dot org  2010-02-17 16:58 
---
I take the P1 setting back; I failed to recognize the use of
-fgraphite-identity.  As long as that's not a default setting, I don't think
problems there should be P1.


-- 

mmitchel at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P1  |P2


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



[Bug tree-optimization/43065] [4.5 Regression] gcc.c-torture/execute/20051215-1.c is miscompiled with -fgraphite-identity

2010-02-14 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Keywords||wrong-code
  Known to work||4.4.3
Summary|gcc.c-  |[4.5 Regression] gcc.c-
   |torture/execute/20051215-1.c|torture/execute/20051215-1.c
   |is miscompiled with -   |is miscompiled with -
   |fgraphite-identity  |fgraphite-identity
   Target Milestone|--- |4.5.0


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