From: "Dominique d'Humières" <dominiq@lps.ens.fr>
To: "jvdelisle@charter.net" <jvdelisle@charter.net>
Cc: fortran@gcc.gnu.org, gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch, fortran] PR68566 ICE on using unusable array in reshape
Date: Sat, 02 Apr 2016 12:43:00 -0000 [thread overview]
Message-ID: <A4E0E44E-FB9D-4A7B-87AF-83817F1B81CF@lps.ens.fr> (raw)
In-Reply-To: <C647A1A2-F258-41DE-B5E2-19C615E5A379@lps.ens.fr>
> 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 … « ?
--- ../_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
next prev parent reply other threads:[~2016-04-02 12:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-02 9:44 Dominique d'Humières
2016-04-02 12:43 ` Dominique d'Humières [this message]
2016-04-02 14:40 ` Jerry DeLisle
2016-04-04 2:39 ` Jerry DeLisle
-- strict thread matches above, loose matches on Subject: below --
2016-04-01 21:58 Jerry DeLisle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A4E0E44E-FB9D-4A7B-87AF-83817F1B81CF@lps.ens.fr \
--to=dominiq@lps.ens.fr \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jvdelisle@charter.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).