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/66328] New: Wrong initialization of derived-type DATA


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66328

            Bug ID: 66328
           Summary: Wrong initialization of derived-type DATA
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org
  Target Milestone: ---

A report from comp.lang.fortran:

Yep, it's a bug (and dates back to gfortran 4.3 or even earlier).
It is triggered by the use of the integer literal 1 in the constructor
for e1: if you use a real, gfortran behaves as expected.

  TYPE t
    REAL r
  END TYPE t
  TYPE (t) e1, e2

  DATA e1 / t(1) /
  DATA e2 / t(1.0) /
  print *, e1, e2
  print *, t(1), t(1.0)
END

and the "reason" it prints out 1.40129846E-45 is that this is the value 
of TRANSFER(1, 0.0) on x86 architecture.

We're missing a cast in assigning value to e1.


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