[Bug fortran/45505] [4.6 Regression] gfortran.dg/pr25923.f90

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Sep 7 08:06:00 GMT 2010



------- Comment #4 from jakub at gcc dot gnu dot org  2010-09-07 08:05 -------
This isn't specific to Fortran,
struct S { int a; };

struct S foo (struct S *arg)
{
  struct S s;
  if (bar ())
    baz ("not valid");
  else
    s = *arg;
  return s;
}

has the exactly same difference.
I believe this is caused by ESRA or gimplification.  In *.ealias we have:
<bb 5>:
  [pr25923.f90 : 22:0] D.1570 = res;
  return D.1570;
and in *.esra this is:
<bb 5>:
  # res$yr_9 = PHI <res$yr_8(D)(3), [pr25923.f90 : 20:0] res$yr_3(4)>
  [pr25923.f90 : 22:0] SR.2_10 = res$yr_9;
  D.1570.yr = SR.2_10;
  return D.1570;

Note no locus on D.1570.yr = SR.2_10; assignment.  The question is if ESRA just
forgots to set the locus, or if it sets it from the following stmt
(GIMPLE_RETURN).  If the former, then it would just be a SRA bug, if the
latter,
then the question is why don't we set location on GIMPLE_RETURN.
Note that on the C testcase there apparently is locus on GIMPLE_RETURN between
gimplification and gimple lowering (where the locus on it is lost).
On the Fortran testcase in *.gimple the locus is strange:
  [pr25923.f90 : 22:0] D.1570 = res;
  [pr25923.f90 : 13:0] return D.1570;
Line 22 is the END FUNCTION line, line 13 is the FUNCTION line.  For C it is
obvious where it wants to report the return, for Fortran, given that it doesn't
have any kind of RETURN statement, I guess either of the locations is fine, but
we should be consistent.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jamborm at gcc dot gnu dot
                   |                            |org


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



More information about the Gcc-bugs mailing list