Bug 19387 - Fortran compiler tries to print HOST_WIDE_INT with %d format
Summary: Fortran compiler tries to print HOST_WIDE_INT with %d format
Status: RESOLVED DUPLICATE of bug 20059
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks: 20059 20405
  Show dependency treegraph
 
Reported: 2005-01-11 23:37 UTC by Steve Ellcey
Modified: 2005-04-11 00:38 UTC (History)
1 user (show)

See Also:
Host:
Target: ia64-hp-hpux*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-01-14 23:08:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Ellcey 2005-01-11 23:37:26 UTC
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
Comment 1 Andrew Pinski 2005-01-14 23:08:20 UTC
There are two ways to fix this, one way is to use gcc's diagnostic hooks (which is the long term fix).
Another way to fix this would be to make a new format for fortran's diagnostic functions which takes a 
HOST_WIDE_INT and that will fix this problem very quickly and most likely can be done for 4.0.0.
Comment 2 Andrew Pinski 2005-04-11 00:38:08 UTC
This actually can cause an ICE on some targets see PR 20059 which I am going to close this as a dup of 
because there is a patch there already.

*** This bug has been marked as a duplicate of 20059 ***