[Bug tree-optimization/22486] Upcasts are not folded away

2005-07-26 Thread rguenth at gcc dot gnu dot org

--- Additional Comments From rguenth at gcc dot gnu dot org  2005-07-26 
07:37 ---
In principle this is fixed.  Of course we either need a tree-combiner or
forwprop on steroids to catch all cases.  Which would make this bug a duplicate.
Closed Fixed.

-- 
   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED
   Target Milestone|--- |4.1.0


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


[Bug tree-optimization/22486] Upcasts are not folded away

2005-07-26 Thread cvs-commit at gcc dot gnu dot org

--- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-07-26 
07:35 ---
Subject: Bug 22486

CVSROOT:/cvs/gcc
Module name:gcc
Changes by: [EMAIL PROTECTED]   2005-07-26 07:34:58

Modified files:
gcc: ChangeLog fold-const.c 
gcc/testsuite  : ChangeLog 
Added files:
gcc/testsuite/gcc.dg/tree-ssa: upcast-1.c 

Log message:
2005-07-26  Richard Guenther  <[EMAIL PROTECTED]>

PR tree-optimization/22486
* fold-const.c (fold_unary): Fold away useless component
references of the form (T *)&T.x, if the address
doesn't change.

* gcc.dg/tree-ssa/upcast-1.c: New testcase.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9546&r2=2.9547
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.609&r2=1.610
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5822&r2=1.5823
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/tree-ssa/upcast-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


[Bug tree-optimization/22486] Upcasts are not folded away

2005-07-15 Thread rguenth at gcc dot gnu dot org

--- Additional Comments From rguenth at gcc dot gnu dot org  2005-07-15 
09:39 ---
Patch ready.  The C++ testcase presented here needs the tree-combiner to do
the folding though.

-- 


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


[Bug tree-optimization/22486] Upcasts are not folded away

2005-07-14 Thread rguenth at gcc dot gnu dot org

--- Additional Comments From rguenth at gcc dot gnu dot org  2005-07-14 
16:58 ---
I'm looking at this myself and have a patch that helps for the cases I care.

-- 
   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |rguenth at gcc dot gnu dot
   |dot org |org
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed||1
   Last reconfirmed|-00-00 00:00:00 |2005-07-14 16:58:17
   date||


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


[Bug tree-optimization/22486] Upcasts are not folded away

2005-07-14 Thread pinskia at gcc dot gnu dot org


-- 
   What|Removed |Added

   Severity|normal  |enhancement


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


[Bug tree-optimization/22486] Upcasts are not folded away

2005-07-14 Thread rguenth at gcc dot gnu dot org

--- Additional Comments From rguenth at gcc dot gnu dot org  2005-07-14 
13:26 ---
Or even simple C:

typedef struct { int i; } Foo;
Foo foo;
Foo *bar(void) { return (Foo *)&foo.i; }

here, in bar() fold (or whoever) should fold (Foo *)&foo.i to &foo.
Because i is at offset zero and foo is of type Foo already.

I'm trying to teach fold_unary to do so, but maybe we won't ever see
the complete expression in fold.

-- 


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