[Bug libfortran/32770] New: -fdefault-integer-8 and the library

tkoenig at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sun Jul 15 09:26:00 GMT 2007


-fdefault-integer-8 has some "interesting" interactions with
the library, especially on big-endian systems.

Look at the following program:

$ cat maxloc-mask.f90 
program main
  real, dimension(2) :: a
  call random_number(a)
  print *,maxloc(a,mask=.true.)
end program main
$ gfortran -fdump-tree-original -fdefault-integer-8 -fdefault-real-8
maxloc-mask.f90 

This produces

    {
      int8 A.4[1];
      struct array1_int8 atmp.3;
      static logical8 C.1015 = 1;
      struct array1_real8 parm.2;

      parm.2.dtype = 537;
      parm.2.dim[0].lbound = 1;
      parm.2.dim[0].ubound = 2;
      parm.2.dim[0].stride = 1;
      parm.2.data = (void *) &a[0];
      parm.2.offset = -1;
      atmp.3.dtype = 521;
      atmp.3.dim[0].stride = 1;
      atmp.3.dim[0].lbound = 0;
      atmp.3.dim[0].ubound = 0;
      atmp.3.data = (void *) &A.4;
      atmp.3.offset = 0;
      _gfortran_smaxloc0_8_r8 (&atmp.3, &parm.2, &C.1015);

and the function called is

extern void smaxloc0_8_r8 (gfc_array_i8 * const restrict,
        gfc_array_r8 * const restrict, GFC_LOGICAL_4 *);

Works on little-endian systems, won't work on big-endian systems.

Intrinsics this probably causes problems on:

maxloc, maxval, minloc, minval.

There may be other places like this.

I don't have a big-endian system, so I can't test this.  I'd appreciate a
confirmation.


-- 
           Summary: -fdefault-integer-8 and the library
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list