Hi Paul, this looks all good to me.
It is great that you added the handling of nested parentheses to the resolution, as that appears to be needed also in other situations. Thanks for the patch! Harald On 10/26/23 19:14, Paul Richard Thomas wrote:
Hi All, The attached patch fixes the original problem, in which parentheses around the selector in select type constructs caused ICES. Stacked parentheses caused problems in trans-stmt.cc. Rather than tracking this down, the redundant parentheses were removed on resolution of the selector expression. Fixing the primary problem revealed "Unclassifiable statement" errors when using array references of the associate variable and this was fixed as well. Finally, the error triggered by using associate variables associated with non-variable selectors was corrected to ensure that only vector indexed selectors were flagged up as such. The secondary error in associate_55.f90 was corrected for this, since the selector might or might not be vector indexed. Regtests fine - OK for trunk? Paul Fortran: Fix some problems with SELECT TYPE selectors [PR104625]. 2023-10-26 Paul Thomas <pa...@gcc.gnu.org> gcc/fortran PR fortran/104625 * expr.cc (gfc_check_vardef_context): Check that the target does have a vector index before emitting the specific error. * match.cc (copy_ts_from_selector_to_associate): Ensure that class valued operator expressions set the selector rank and use the rank to provide the associate variable with an appropriate array spec. * resolve.cc (resolve_operator): Reduce stacked parentheses to a single pair. (fixup_array_ref): Extract selector symbol from parentheses. gcc/testsuite/ PR fortran/104625 * gfortran.dg/pr104625.f90: New test. * gfortran.dg/associate_55.f90: Change error check text.