Ignoring lexical errors in read

Is there a way to avoid crashing on a lexical error? e.g.

PGFIO-F-225/list-directed read/internal file/lexical error-- unknown token type.
 In source file ./e_trinit.f, at line number 72

I have code that was built using the xlf compiler which responds to these types of errors with

1525-097 A READ statement using decimal base input found the invalid digit 'P' in the input file.  The program will recover by assuming a zero in its
 place.

But when run with PGI (pgi 13.10 sandybridge) the execution is immediately aborted.

Is there a trap or something I can set/unset?

THanks

I think that it is highly undesirable to have the compiler runtime make ad-hoc changes to the input data and continue execution with erroneous data. Reliance on such a feature makes your code non-portable.

Use the ERR=, IOSTAT= and EOR= clauses in the READ statement to handle errors in the input data, and make sure that the program uses list-directed or formatted READ statements that are appropriate for the format of the input data. If the data file contains errors, it may be entirely proper for the program to print a suitable diagnostic message and abort, giving you an opportunity to correct the input data.

I completely agree, however in this circumstance I’m working with someone else’s codebase … and the people who wrote this code depend on non-standard compiler defaulting behaviour…

While I may have to fix every instance these bad READ()'s, I was hoping a compiler flag might exist that would catch the error.

I forgot about ERR actually, for now I’ve implemented a different kind of check, but I’ll keep that in mind.

Thanks for your reply.