In trans-common.c there are two calls to gfc_warning that pass a HOST_WIDE_INT
variable and a %d format.  The calls in question are in translate_common, where
we call gfc_warning with the variable 'offset' and again with the variable
'common_segment->offset'.  This will not work when HOST_WIDE_INT is not the same
size as int.  I tried replacing '%d' in the format with the macro
HOST_WIDE_INT_PRINT_DEC, which is defined in gcc/hwint.h but that failed because
the routine error_print in gcc/fortran/error.c parses the format string and
doesn't understand %ld or %lld.

Test case:

      real r1(5)
      common r1
      double precision d1
      equivalence (d1, r1(2))
      end

Output during compile:

Warning: COMMON '__BLNK__' at (1) requires 1074534272 bytes of padding at start

-- 
           Summary: Fortran compiler tries to print HOST_WIDE_INT with %d
                    format
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sje at cup dot hp dot com
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to