* [Committed] fortra/50821 -- fix regression in ishft[c]
@ 2011-10-22 0:03 Steve Kargl
0 siblings, 0 replies; only message in thread
From: Steve Kargl @ 2011-10-22 0:03 UTC (permalink / raw)
To: fortran, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 378 bytes --]
I've committed the attached patch to address a
regression caused by my recent change to argument
checking in ISHFT[C]. Both my regression test
and Dominiq's regression test passed. Sorry
about the breakage.
2011-10-20 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/50821
* check.c (gfc_check_ishftc): Check args are constant before
extracting the integer.
--
Steve
[-- Attachment #2: check.diff --]
[-- Type: text/x-diff, Size: 1301 bytes --]
Index: check.c
===================================================================
--- check.c (revision 180264)
+++ check.c (working copy)
@@ -1967,22 +1967,29 @@ gfc_check_ishftc (gfc_expr *i, gfc_expr
if (less_than_bitsize1 ("I", i, "SIZE", size, true) == FAILURE)
return FAILURE;
- gfc_extract_int (size, &i3);
- if (i3 <= 0)
+ if (size->expr_type == EXPR_CONSTANT)
{
- gfc_error ("SIZE at %L must be positive", &size->where);
- return FAILURE;
- }
+ gfc_extract_int (size, &i3);
+ if (i3 <= 0)
+ {
+ gfc_error ("SIZE at %L must be positive", &size->where);
+ return FAILURE;
+ }
- gfc_extract_int (shift, &i2);
- if (i2 < 0)
- i2 = -i2;
+ if (shift->expr_type == EXPR_CONSTANT)
+ {
+ gfc_extract_int (shift, &i2);
+ if (i2 < 0)
+ i2 = -i2;
- if (i2 > i3)
- {
- gfc_error ("The absolute value of SHIFT at %L must be less than "
- "or equal to SIZE at %L", &shift->where, &size->where);
- return FAILURE;
+ if (i2 > i3)
+ {
+ gfc_error ("The absolute value of SHIFT at %L must be less "
+ "than or equal to SIZE at %L", &shift->where,
+ &size->where);
+ return FAILURE;
+ }
+ }
}
}
else if (less_than_bitsize1 ("I", i, NULL, shift, true) == FAILURE)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-21 22:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-22 0:03 [Committed] fortra/50821 -- fix regression in ishft[c] Steve Kargl
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).