[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-28 Thread bonzini at gnu dot org


--- Comment #13 from bonzini at gnu dot org  2009-01-28 11:50 ---
Aren't loads protected by the gimple_set_has_volatile_ops anyway?


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-28 Thread rguenther at suse dot de


--- Comment #14 from rguenther at suse dot de  2009-01-28 12:08 ---
Subject: Re:  [4.2/4.3/4.4 Regression] missing
 constraints for pointers accessed directly via their address

On Wed, 28 Jan 2009, bonzini at gnu dot org wrote:

 --- Comment #13 from bonzini at gnu dot org  2009-01-28 11:50 ---
 Aren't loads protected by the gimple_set_has_volatile_ops anyway?

No, only during early optimizations (because we don't have virtual
operands there).

Richard.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-28 Thread rguenth at gcc dot gnu dot org


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

   Priority|P3  |P2


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread pinskia at gmail dot com


--- Comment #1 from pinskia at gmail dot com  2009-01-27 11:27 ---
Subject: Re:   New: [4.2/4.3/4.4 Regression] missing constraints for pointers
accessed directly via their address



Sent from my iPhone

On Jan 27, 2009, at 3:15 AM, bonzini at gnu dot org gcc-bugzi...@gcc.gnu.org 
  wrote:

 This testcase fails:

 /* { dg-do compile } */
 /* { dg-options -O2 -fdump-tree-optimized } */

 int f(int *p)
 {
  int a = *p;
  int *q = (int *)0xDEADBEE0;
  *q = 5;
  return *p == a;
 }

 /* { dg-final { scan-tree-dump-times  = \\\*p 2 optimized } } */
 /* { dg-final { scan-tree-dump-not return 1 optimized } } */
 /* { dg-final { cleanup-tree-dump optimized } } */


 Unlike PR38984 it does not require -fno-delete-null-pointer-checks.

Volatile addresses also don't have vops on them.  As I mentioned in  
the other bug.  So this is also a bug for volatiles.




 -- 
   Summary: [4.2/4.3/4.4 Regression] missing constraints for
pointers accessed directly via their address
   Product: gcc
   Version: 4.4.0
Status: UNCONFIRMED
  Keywords: wrong-code
  Severity: normal
  Priority: P3
 Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bonzini at gnu dot org
 OtherBugsDependingO 38984
 nThis:


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



-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread rguenth at gcc dot gnu dot org


--- Comment #2 from rguenth at gcc dot gnu dot org  2009-01-27 12:04 ---
Works on the alias-improvements branch.  Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
 Ever Confirmed|0   |1
  Known to fail|4.1.3 4.4.0 |4.0.4 4.1.3 4.4.0
   Last reconfirmed|-00-00 00:00:00 |2009-01-27 12:04:37
   date||
   Target Milestone|--- |4.2.5


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread rguenth at gcc dot gnu dot org


--- Comment #4 from rguenth at gcc dot gnu dot org  2009-01-27 12:06 ---
In the operand scanner we try to be clever ...

  else if (TREE_CODE (ptr) == INTEGER_CST)
{
  /* If a constant is used as a pointer, we can't generate a real
 operand for it but we mark the statement volatile to prevent
 optimizations from messing things up.  */
  gimple_set_has_volatile_ops (stmt, true);
  return;

but that of course misses the fact that we miss all necessary conflicts.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread rguenth at gcc dot gnu dot org


--- Comment #5 from rguenth at gcc dot gnu dot org  2009-01-27 12:09 ---
The bad thing is that this is really bad.  We would need to add the SMT for
the type here, but we have no way of looking that up.  So the only way to fix
this in a reasonable way is to simply not CCP constant addresses into
dereferences.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread bonzini at gnu dot org


--- Comment #6 from bonzini at gnu dot org  2009-01-27 12:21 ---
These passes are able to propagate the address to the load: CCP, VRP, DOM.  If
we decide that it's an invalid transformation, fixing them would fix this bug.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread rguenth at gcc dot gnu dot org


--- Comment #3 from rguenth at gcc dot gnu dot org  2009-01-27 12:04 ---
Mine.


-- 

rguenth at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|NEW |ASSIGNED
   Last reconfirmed|2009-01-27 12:04:37 |2009-01-27 12:04:54
   date||


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread bonzini at gnu dot org


--- Comment #7 from bonzini at gnu dot org  2009-01-27 12:29 ---
 simply not CCP constant addresses into dereferences.

Apart from the fact that it's not only CCP, it seems mostly sensible.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread rguenth at gcc dot gnu dot org


--- Comment #8 from rguenth at gcc dot gnu dot org  2009-01-27 12:31 ---
Created an attachment (id=17190)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17190action=view)
incomplete patch

I tried this quick hack to add proper operands for the dereference, but it
shows
that (of course) we do not bother to create SMTs for dereferences of constants.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread rguenth at gcc dot gnu dot org


--- Comment #9 from rguenth at gcc dot gnu dot org  2009-01-27 12:33 ---
As this bug exists basically forever (since tree-ssa merge) I am inclined to
only fix it for 4.5 with the alias-improvements branch merge.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread bonzini at gnu dot org


--- Comment #10 from bonzini at gnu dot org  2009-01-27 12:58 ---
Created an attachment (id=17191)
 -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17191action=view)
tentative patch

Do you want to pursue something as in the attached patch instead?  You can then
revert it in the alias-improvements branch if you wish.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread rguenth at gcc dot gnu dot org


--- Comment #11 from rguenth at gcc dot gnu dot org  2009-01-27 13:05 
---
The patch is not enough.  Consider replacements in loads and in loads of
call arguments to const/pure calls.


-- 


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



[Bug tree-optimization/38985] [4.2/4.3/4.4 Regression] missing constraints for pointers accessed directly via their address

2009-01-27 Thread bonzini at gnu dot org


--- Comment #12 from bonzini at gnu dot org  2009-01-27 13:18 ---
Ok, I'm not working on it anyway.  I'll just leave the patch in case someone
else would pick it up.


-- 


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