[Bug tree-optimization/16179] New: useless copies not optimized away
rguenth at tat dot physik dot uni-tuebingen dot de
gcc-bugzilla@gcc.gnu.org
Thu Jun 24 17:57:00 GMT 2004
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
More information about the Gcc-bugs
mailing list