From: Jerry DeLisle <jvdelisle@charter.net>
To: fortran@gcc.gnu.org
Cc: gcc-patches@gcc.gnu.org
Subject: [patch, fortran] Bug 35849 - "wrong" line shown in error message for parameter
Date: Mon, 04 Jul 2016 19:14:00 -0000 [thread overview]
Message-ID: <c897817f-6674-00e8-5683-62abc2c4313b@charter.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 367 bytes --]
I will commit attached patch provided by Steve and reviewed and tested
by myself to trunk. Test case provided.
Self explanatory.
Regards,
Jerry
2016-07-04 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/35849
* simplify.c (gfc_simplify_ishftc): Check that absolute value of
SHIFT is less than or equal to SIZE.
[-- Attachment #2: pr35849.diff --]
[-- Type: text/x-patch, Size: 697 bytes --]
Index: simplify.c
===================================================================
--- simplify.c (revision 237855)
+++ simplify.c (working copy)
@@ -3280,7 +3280,6 @@ gfc_simplify_ishftc (gfc_expr *e, gfc_ex
return NULL;
gfc_extract_int (sz, &ssize);
-
}
else
ssize = isize;
@@ -3294,7 +3293,10 @@ gfc_simplify_ishftc (gfc_expr *e, gfc_ex
{
if (sz == NULL)
gfc_error ("Magnitude of second argument of ISHFTC exceeds "
- "BIT_SIZE of first argument at %L", &s->where);
+ "BIT_SIZE of first argument at %C");
+ else
+ gfc_error ("Absolute value of SHIFT shall be less than or equal "
+ "to SIZE at %C");
return &gfc_bad_expr;
}
[-- Attachment #3: pr35849.f90 --]
[-- Type: text/x-fortran, Size: 601 bytes --]
! { dg-do compile }
! PR35849
INTEGER, PARAMETER :: j = 15
INTEGER, PARAMETER, DIMENSION(10) :: A = [(i, i = 1,10)]
INTEGER, PARAMETER, DIMENSION(10) :: B = ISHFTC(j, A, -20) ! { dg-error "must be positive" }
INTEGER, PARAMETER, DIMENSION(10) :: C = ISHFTC(1_1, A, j) ! { dg-error "less than or equal to BIT_SIZE" }
INTEGER, PARAMETER, DIMENSION(10) :: D = ISHFTC(3, A, 5) ! { dg-error "Absolute value of SHIFT shall be less than or equal" }
INTEGER, PARAMETER, DIMENSION(10) :: E = ISHFTC(3_1, A) ! { dg-error "second argument of ISHFTC exceeds BIT_SIZE of first argument" }
end
reply other threads:[~2016-07-04 19:14 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c897817f-6674-00e8-5683-62abc2c4313b@charter.net \
--to=jvdelisle@charter.net \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/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).