[Bug tree-optimization/30590] [4.1/4.2/4.3 Regression] tree-nrv optimization clobbers return variable

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 29 00:12:00 GMT 2007



------- 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



More information about the Gcc-bugs mailing list