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
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.
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 ***