I have reduced the failure for intrinsic_rrspacing.f90 to:

integer i
real x
x = 3.0
print *, exponent (x)
i = exponent (x)
print *, i
end

which gives with -fdefault-integer-8

           8589934720
                                2

cat intrinsic_rrspacing_red.f90.003t.original gives:

MAIN__ ()
{
  real4 x;
  int8 i;
  static int4 options.0[7] = {68, 127, 0, 0, 0, 1, 0};

  _gfortran_set_options (7, (void *) &options.0);
  x = 3.0e+0;
  {
    struct __st_parameter_dt dt_parm.1;

    dt_parm.1.common.filename = &"intrinsic_rrspacing_red.f90"[1]{lb: 1 sz: 1};
    dt_parm.1.common.line = 4;
    dt_parm.1.common.flags = 128;
    dt_parm.1.common.unit = 6;
    _gfortran_st_write (&dt_parm.1);
    {
      int4 D.961;

      D.961 = _gfortran_exponent_r4 (x);
      _gfortran_transfer_integer (&dt_parm.1, &D.961, 8);
    }
    _gfortran_st_write_done (&dt_parm.1);
  }
  i = (int8) _gfortran_exponent_r4 (x);
  {
    struct __st_parameter_dt dt_parm.2;

    dt_parm.2.common.filename = &"intrinsic_rrspacing_red.f90"[1]{lb: 1 sz: 1};
    dt_parm.2.common.line = 6;
    dt_parm.2.common.flags = 128;
    dt_parm.2.common.unit = 6;
    _gfortran_st_write (&dt_parm.2);
    _gfortran_transfer_integer (&dt_parm.2, &i, 8);
    _gfortran_st_write_done (&dt_parm.2);
  }
}

where the cause of the failure is obvious: D.961 is int4, but is transfered as
8 bytes.

Although I did not test it, this is likely to happen for all the intrinsics
returning a 4-byte integer.

Note that I have added a print of exponent (x) in intrinsic_rrspacing.f90 and I
get:

           8589934720
Abort

with -m64 the test pass, but I get:

           8589934592

Any explanation?


-- 
           Summary: Wrong code with with -fdefault-integer-8
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dominiq at lps dot ens dot fr


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

Reply via email to