This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/16179] New: useless copies not optimized away
- From: "rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jun 2004 17:53:19 -0000
- Subject: [Bug tree-optimization/16179] New: useless copies not optimized away
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following functions do not produce identical results
(g++-3.5 (GCC) 3.5.0 20040618 (experimental), -O2)
extern void bar(void);
int foo(const int &f)
{
const int a = f;
int c = a;
bar();
c = a;
return c;
}
int foo2(const int &f)
{
int c = f;
bar();
c = f;
return c;
}
optimized tree-dump (asm contains the useless store to a, too,
but the tree-optimizers should catch that):
;; Function int foo(const int&) (_Z3fooRKi)
int foo(const int&) (f)
{
int c;
const int a;
int T.0;
<bb 0>:
a = *f;
bar ();
return a;
}
;; Function int foo2(const int&) (_Z4foo2RKi)
int foo2(const int&) (f)
{
int c;
int T.1;
<bb 0>:
bar ();
return *f;
}
--
Summary: useless copies not optimized away
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16179