Hi Mikael, > Gesendet: Mittwoch, 05. Oktober 2022 um 11:23 Uhr > Von: "Mikael Morin" > An: "Harald Anlauf" , "fortran" , "gcc-patches" > Betreff: Re: [PATCH] Fortran: error recovery for invalid types in array constructors [PR107000] > The following does. > > > diff --git a/gcc/fortran/arith.cc b/gcc/fortran/arith.cc > index e6e35ef3c42..2c57c796270 100644 > --- a/gcc/fortran/arith.cc > +++ b/gcc/fortran/arith.cc > @@ -1443,7 +1443,7 @@ reduce_binary_aa (arith (*eval) (gfc_expr *, > gfc_expr *, gfc_expr **), > gfc_replace_expr (c->expr, r); > } > > - if (c || d) > + if (rc == ARITH_OK && (c || d)) > rc = ARITH_INCOMMENSURATE; > > if (rc != ARITH_OK) that's great! It fixes several rather weird cases. (There is at least another PR on the incommensurate arrays, but we should not attempt to fix everything today.) > There is one last thing that I'm dissatisfied with. > The handling of unknown types should be moved to reduce_binary, because > the dispatching in reduce_binary doesn't handle EXPR_OP, so even if > either or both operands are scalar, they are handled by the (array vs > array) reduce_binary_aa function. That's confusing. Do you have an example? Anyway, please find attached an updated patch that incorporates your two changes and regtests fine on x86_64-pc-linux-gnu. Even if you disagree, I think this is really a significant step forwards... (error-recovery wise). OK for mainline? Thanks, Harald