Message ID | A4E0E44E-FB9D-4A7B-87AF-83817F1B81CF@lps.ens.fr |
---|---|
State | New |
Headers | show |
On 04/02/2016 05:42 AM, Dominique d'Humières wrote: > >> Le 2 avr. 2016 à 11:44, Dominique d'Humières <dominiq@lps.ens.fr> a écrit : >> >> Hi Jerry, >> >>> ... >>> I will add an additional test case for the original posted problem in the PR. >>> Two existing tests get exercised, changing the error message. Finding the >>> problems earlier in the matchers I think is the right way to go. I am curious if >>> the old checks ever get triggered (I will look into that a little later. >> >> (2) Before your patch the errors were >> >> Error: Expression at (1) must be of INTEGER type, found REAL >> >> How difficult is it to restore the "found … « ? I like that idea and not too difficult to do. ;) > > --- ../_clean/gcc/fortran/array.c 2016-01-04 19:51:09.000000000 +0100 > +++ gcc/fortran/array.c 2016-04-02 14:31:08.000000000 +0200 > @@ -421,10 +421,15 @@ match_array_element_spec (gfc_array_spec > if (!gfc_expr_check_typed (*upper, gfc_current_ns, false)) > return AS_UNKNOWN; > > - if ((*upper)->expr_type == EXPR_FUNCTION && (*upper)->ts.type == BT_UNKNOWN > - && (*upper)->symtree && strcmp ((*upper)->symtree->name, "null") == 0) > + if (((*upper)->expr_type == EXPR_CONSTANT > + && (*upper)->ts.type != BT_INTEGER) || > + ((*upper)->expr_type == EXPR_FUNCTION > + && (*upper)->ts.type == BT_UNKNOWN > + && (*upper)->symtree > + && strcmp ((*upper)->symtree->name, "null") == 0)) > { > - gfc_error ("Expecting a scalar INTEGER expression at %C"); > + gfc_error ("Expecting a scalar INTEGER expression at %C, found %s", > + gfc_basic_typename ((*upper)->ts.type)); > return AS_UNKNOWN; > } > > @@ -448,10 +453,16 @@ match_array_element_spec (gfc_array_spec > if (!gfc_expr_check_typed (*upper, gfc_current_ns, false)) > return AS_UNKNOWN; > > - if ((*upper)->expr_type == EXPR_FUNCTION && (*upper)->ts.type == BT_UNKNOWN > - && (*upper)->symtree && strcmp ((*upper)->symtree->name, "null") == 0) > - { > - gfc_error ("Expecting a scalar INTEGER expression at %C"); > + if (((*upper)->expr_type == EXPR_CONSTANT > + && (*upper)->ts.type != BT_INTEGER) || > + ((*upper)->expr_type == EXPR_FUNCTION > + && (*upper)->ts.type == BT_UNKNOWN > + && (*upper)->symtree > + && strcmp ((*upper)->symtree->name, "null") == 0)) > + { > + /* gfc_error ("Expecting a scalar INTEGER expression at %C"); */ > + gfc_error ("Expecting a scalar INTEGER expression at %C, found %s", > + gfc_basic_typename ((*upper)->ts.type)); > return AS_UNKNOWN; > } > > Does the trick (not regtested yet). > > Dominique I will do this, also the other test that you showed failed, I thought I fixed already, but will double check it. Jerry
--- ../_clean/gcc/fortran/array.c 2016-01-04 19:51:09.000000000 +0100 +++ gcc/fortran/array.c 2016-04-02 14:31:08.000000000 +0200 @@ -421,10 +421,15 @@ match_array_element_spec (gfc_array_spec if (!gfc_expr_check_typed (*upper, gfc_current_ns, false)) return AS_UNKNOWN; - if ((*upper)->expr_type == EXPR_FUNCTION && (*upper)->ts.type == BT_UNKNOWN - && (*upper)->symtree && strcmp ((*upper)->symtree->name, "null") == 0) + if (((*upper)->expr_type == EXPR_CONSTANT + && (*upper)->ts.type != BT_INTEGER) || + ((*upper)->expr_type == EXPR_FUNCTION + && (*upper)->ts.type == BT_UNKNOWN + && (*upper)->symtree + && strcmp ((*upper)->symtree->name, "null") == 0)) { - gfc_error ("Expecting a scalar INTEGER expression at %C"); + gfc_error ("Expecting a scalar INTEGER expression at %C, found %s", + gfc_basic_typename ((*upper)->ts.type)); return AS_UNKNOWN; } @@ -448,10 +453,16 @@ match_array_element_spec (gfc_array_spec if (!gfc_expr_check_typed (*upper, gfc_current_ns, false)) return AS_UNKNOWN; - if ((*upper)->expr_type == EXPR_FUNCTION && (*upper)->ts.type == BT_UNKNOWN - && (*upper)->symtree && strcmp ((*upper)->symtree->name, "null") == 0) - { - gfc_error ("Expecting a scalar INTEGER expression at %C"); + if (((*upper)->expr_type == EXPR_CONSTANT + && (*upper)->ts.type != BT_INTEGER) || + ((*upper)->expr_type == EXPR_FUNCTION + && (*upper)->ts.type == BT_UNKNOWN + && (*upper)->symtree + && strcmp ((*upper)->symtree->name, "null") == 0)) + { + /* gfc_error ("Expecting a scalar INTEGER expression at %C"); */ + gfc_error ("Expecting a scalar INTEGER expression at %C, found %s", + gfc_basic_typename ((*upper)->ts.type)); return AS_UNKNOWN; }