Warnings when compiling gfortran

Jerry DeLisle jvdelisle@verizon.net
Sun Jan 13 17:07:00 GMT 2008


Tobias Burnus wrote:
> 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?
> 
I can not reproduce the warning with a standalone c program using %ld .  I am on 
x86-64-linux

> 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],
> 
I just started seeing these warnings in the last day or so.  I suspect something 
  has been tweaked.

I touched resolve.c and I get many many of these warnings.  I am going to do a 
clean build and look again.

Jerry



More information about the Fortran mailing list