This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/43843] New: Wrong-code due to missing temporary with user-defined operatator


Reported by Kyle Horne at http://gcc.gnu.org/ml/fortran/2010-04/msg00215.html

There is a missing temporary for user-defined operators:

   type(polar_t),dimension(3)::b
   b = polar_t(1.0,0.5)
   b(:) = b(:)/b(1)

The latter is translated into:
    struct polar_t * D.1551;
    D.1551 = &b[0];

      S.5 = 1;
      while (1)
        {
          if (S.5 > 3) goto L.3;
          b[S.5 + -1] = div_pp (&b[S.5 + -1], D.1551);
          S.5 = S.5 + 1;
        }
      L.3:;

but that fails as one overrides *D.1551 alias b[0] alias B(1) in the first
iteration instead of evaluating first all of the RHS before assigning to the
LHS.

Work with ifort and NAG, fails with GCC 4.1, 4.2, 4.3, 4.4, 4.5, and 4.6


-- 
           Summary: Wrong-code due to missing temporary with user-defined
                    operatator
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]