Fortran parser recovers from invalid inquiry references
Fortran parser handles invalid inquiry references more gracefully and fixes memory leaks.
The Fortran compiler now replaces an assertion with a failure return value when encountering invalid inquiry references during parsing. This change improves error recovery and also addresses minor memory leaks in the frontend’s error return path. A new test case is included to verify the fix.
In Details
The gfc_match_varspec function in primary.cc previously had an assertion that could trigger on invalid inquiry references. This commit replaces the assertion with a failure return and fixes memory leaks on error paths. The changes in symbol.cc ensure gfc_find_derived_types returns a null symbol pointer when an associated symbol is null, preventing a potential dereference of a null pointer.