Re: [PATCH] fortran: [PR118793] Additional expanded namelist read diagnostics
Jerry DeLisle <[email protected]> Mon, 3 Aug 2026 09:48:46 -0700
| Newsgroups | gmane.comp.gcc.patches,gmane.comp.gcc.fortran |
|---|---|
| Message-ID | <[email protected]> |
In the absence of comments I plan to commit this later today. On 8/1/26 5:52 AM, Jerry DeLisle wrote: > Ping. > > On 7/29/26 7:26 PM, Jerry DeLisle wrote: >> The attached patch is a continuation of my effort to give more >> informative error messages for namelist reads. As mentioned in the PR, >> for users with large namelist files this will help greatly with >> identifying where in the namelist data file the error occurred. >> >> Regression tested on x86_64. A new test case added from Haralds >> example in the PR. >> >> OK for mainline? >> >> Regards, >> >> Jerry >> --- >> >> fortran: [PR118793] Additional expanded namelist read diagnostics >> >> These changes add expanded diagnostics to error locations not addressed >> in the original patch. This is done by using a new helper function that >> saves the error message information for namelist related errors in a >> buffer and keeping a status bit in the st_parameter_dt structure. >> >> PR libfortran/118793 >> >> libgfortran/ChangeLog: >> >> * io/io.h (NML_ERR_MSG_LEN): New macro. >> (st_parameter_dt): Add nml_err_pending bit. >> (gfc_unit): Add nml_err_msg. >> * io/list_read.c (nml_error): New function. >> (eat_separator): Use new function >> (convert_integer): Likewise. >> (convert_unsigned): Likewise. >> (parse_repeat): Likewise. Save the position where the repeat >> count starts and report it. >> (read_logical): Likewise. >> (read_integer): Likewise. >> (parse_real): Likewise. >> (read_complex): Likewise. >> (read_real): Likewise. >> (check_type): Likewise. >> (list_formatted_read_scalar): Likewise. >> (read_character): Likewise. Save the initial position of the value >> (nml_read_obj): Unwind to nml_err_ret on a deferred error. >> (namelist_read): Store deferred errors in the unit's nml_err_msg >> buffer. >> >> gcc/testsuite/ChangeLog: >> >> * gfortran.dg/namelist_101.f90: Fix dg-do directive typo and >> check the expanded diagnostic. >> * gfortran.dg/namelist_104.f90: New test. >