This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]