Fix two issues with unused/unset variable warnings.
Improves variable warning diagnostics in GFortran, fixing an ICE and clarifying warnings for namelist I/O and STOP statements.
This commit resolves two issues in GFortran concerning variable warnings. It fixes an internal compiler error (ICE) related to namelist I/O by ensuring that variables used in namelists are correctly marked as accessed and by adding a nml_where field to track their location. Additionally, it improves diagnostics for STOP and ERROR STOP statements, preventing incorrect warnings about unused variables by marking their associated expressions as used.
In Details
Fixes GFortran issues PR fortran/126058 and PR fortran/126090 by enhancing handling of namelist I/O and STOP statements. A nml_where field is added to gfc_dt, and match_dt_element, gfc_resolve_dt, and match_io are updated to correctly set this member, ensuring variables participating in namelist I/O are properly tracked and flagged. For PAUSE, STOP, and ERROR STOP, code->expr1 is marked as used, suppressing spurious 'variable not used' warnings.
- Gfortran
- The GNU Fortran compiler, part of the GCC suite.
- ICE
- Internal Compiler Error, a critical failure within the compiler itself, where the compiler crashes rather than producing an error message about the user's code.
- namelist I/O
- A Fortran feature that allows reading from or writing to external files using variable names specified within a NAMELIST group, rather than explicit format control.
- diagnostics
- Messages issued by the compiler to inform the user about potential errors, warnings, or other issues in their code.
- STOP statement
- A Fortran statement that terminates program execution.
- variable passing
- The mechanism by which values are transferred between different parts of a program, such as between functions or during input/output operations. This commit specifically relates to how variables are passed or accessed during namelist I/O.