"gfc_code2string(): Bad code" error for gfortran-4.3.2 on Darwin PPC

Tobias Burnus tobias.burnus@physik.fu-berlin.de
Thu Sep 4 20:47:00 GMT 2008


Hi Chris,

Chris Talley wrote:
> By changing the line in dummy_mod.F from
> > logical (kind=1) :: MEMCHEKDONE = .false.
> to
> > logical :: MEMCHEKDONE = .false.
> the code compiles without an error.
>
> What is the difference between a 'logical (kind=1)' and a 'logical'?

"logical" has the same size as an "integer", which is [usually] 4 bytes.
"logical(kind=1)" has the same storage size as "integer(kind=1)", namely
1 byte.

If I recall correctly, "logical(kind=4)" is a tiny bit faster while
"logical(kind=1)" uses less memory (a quarter). In most programs,
neither the storage size for logical variables is negligible.

(Unless your variable "MEMCHEKDONE" is in a COMMON block, changing the
size should cause no algorithmic problems.)

 * * *

Coming back to your problem: Similar to Daniel, I cannot reproduce it
on x86-64-linux with either gfortran 4.3 nor with today's 4.4.0.

The "gfc_code2string()" function is used to read/write data from/to
module files. At a glance I cannot see what could go wrong there.

Can you run gfortran in a debugger and provide thus more information.
Steps:
1. Run: "gfortran-432 -ffree-form -S -v dummy_mod.F"
   and find in the output the line containing
   .../4.3.2/f951 ...
2. Run: gdb --args .../4.3.2/f951 ...
3. Set a break point in "gdb" at gfc_code2string
4. Type "run"

When you are in "gfc_code2string", can you print the value of "m->string"
and of "code"? It would be interesting to know for which values it
fails.

Tobias



Tobias



More information about the Fortran mailing list