[Patch, fortran] PR31803 - Fix pointer => target(range)

Tobias Burnus burnus@net-b.de
Fri May 4 19:23:00 GMT 2007


Hi Brooks,

Thanks for being alert. I was happy to fix a rejects-valid crash, but of
cause one should have dug deeper to find and fix also this
accepts-invalid problem.

gfortran happily accepts your example where as NAG f95 prints:
Error: Differing length type parameters in pointer assignment

gfortran is by the way in good company as ifort and g95 also accept it.
(g95 prints the same: 'bcd' + garbage, ifort prints only 'bcd'.)

There is a very simple reason why ts.cl is NULL: primary.c's
match_varspec contains:

        if (substring)
            primary->ts.cl = NULL;

If one removes these lines, the proper error message is printed:
   Error: Different character lengths in pointer assignment at (1)

The right way is to set ts.cl->length to the proper value if known at
compile time otherwise the whole string length and not the substring
length is used.

I created a new PR for this: PR31821
I also opened a new PR for run-time bound checking such substring
pointer assignments: PR31822

Tobias



More information about the Gcc-patches mailing list