This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/30590] [4.1/4.2/4.3 Regression] tree-nrv optimization clobbers return variable
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jan 2007 00:12:32 -0000
- Subject: [Bug tree-optimization/30590] [4.1/4.2/4.3 Regression] tree-nrv optimization clobbers return variable
- References: <bug-30590-1501@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from pinskia at gcc dot gnu dot org 2007-01-29 00:12 -------
A possible work around is to create another temp variable of type struct test.
Such that the function test looks like:
struct test
test (void)
{
struct test result;
struct test temp;
result.type = 0;
for (int i = 0; i < 2; ++i)
{
struct test candidate = reset ();
if (flag)
result = candidate;
}
temp = result;
return temp;
}
---------------------------------------
The bug is because NVR is applied twice, once in the front-end and once in
tree-nvr. If the front-end already applied NVR, we should not apply it again
in tree-nvr.
Looking into fixing this bug later tonight.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
Target Milestone|--- |4.1.2
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30590