Warnings when compiling gfortran

Tobias Burnus burnus@net-b.de
Sun Jan 13 17:04:00 GMT 2008


Hi Jerry,

Jerry DeLisle wrote:
>> I noticed this today:
>> ../../gcc43/gcc/fortran/simplify.c: In function ‘gfc_simplify_transfer’:
>> ../../gcc43/gcc/fortran/simplify.c:4165: warning: unknown conversion
>> type character ‘l’ in format
>> ../../gcc43/gcc/fortran/simplify.c:4165: warning: unknown conversion
>> type character ‘l’ in format
> This fixes it:  I don't know if this was the intent.
>
>      gfc_warning("Intrinsic TRANSFER at %L has partly undefined result: "
> -               "source size %ld < result size %ld", &source->where,
> -               (long) source_size, (long) result_size);
> +               "source size %d < result size %d", &source->where,
> +               (int) source_size, (int) result_size);

Well, the source size could be in principle larger than integer(4) and
as the pointer size is 8 bytes using, e.g., x86_64, I decided to use
(long) rather than (int).

However, I do not understand the warning: "%ld" should be valid for
"format" in the printf family. I find in my POSIX 2003 copy:

"l (ell) specifies that a following d, i, o, u, x, or X conversion
specifier applies to a long or unsigned long argument"

Are you on a special platform and does "printf("%ld\n", (long) 42);"
also produce this warning?

While we can in principle change the "(long)" into an "(int)", I really
want to understand first why we get warning.

Do you also get these warnings for:
resolve.c:                     "(%ld < %ld) in dimension %d",
&ar->c_where[i],

Tobias



More information about the Fortran mailing list