This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: [gfortran,patch] Fix wrong-code for ASSOCIATED


Steve Kargl wrote:
Arguments.
  POINTER    shall be a pointer and may be of any type.
             Its pointer association status shall not be undefined.

With the program the FX posted, gfortran needs to issue an
error and exit.

Does it? I agree that it would be nice if it did, but I don't think it "needs to" diagnose this error -- this text you quote isn't a compiler constraint. The situation is exactly akin to referencing a variable with an undefined value, and we don't diagnose that in the general case. I don't think this _can_ always be diagnosed in the general case.


We could possibly do something like automatically initializing all pointers to a value that means "undefined", but even that's tricky when they're deep in an array of derived types as in the given case. Any solution to that one ought, in my opinion, be written generally enough to handle initializing variable values to an "undefined" sentinel value as well.

- Brooks


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