Commit 6d8c9e5c by Steven G. Kargl

re PR fortran/50821 (3 new GCC HEAD@180266 regressions)

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.

From-SVN: r180316
parent 74b388c3
2011-10-20 Steven G. Kargl <kargl@gcc.gnu.org> 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.
2011-10-20 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/50514 PR fortran/50514
* check.c (less_than_bitsize1): Check |shift| <= bit_size(i). * check.c (less_than_bitsize1): Check |shift| <= bit_size(i).
(gfc_check_ishftc): Check |shift| <= bit_size(i) and check (gfc_check_ishftc): Check |shift| <= bit_size(i) and check
......
...@@ -1967,22 +1967,29 @@ gfc_check_ishftc (gfc_expr *i, gfc_expr *shift, gfc_expr *size) ...@@ -1967,22 +1967,29 @@ gfc_check_ishftc (gfc_expr *i, gfc_expr *shift, gfc_expr *size)
if (less_than_bitsize1 ("I", i, "SIZE", size, true) == FAILURE) if (less_than_bitsize1 ("I", i, "SIZE", size, true) == FAILURE)
return FAILURE; return FAILURE;
gfc_extract_int (size, &i3); if (size->expr_type == EXPR_CONSTANT)
if (i3 <= 0)
{ {
gfc_error ("SIZE at %L must be positive", &size->where); gfc_extract_int (size, &i3);
return FAILURE; if (i3 <= 0)
} {
gfc_error ("SIZE at %L must be positive", &size->where);
return FAILURE;
}
gfc_extract_int (shift, &i2); if (shift->expr_type == EXPR_CONSTANT)
if (i2 < 0) {
i2 = -i2; gfc_extract_int (shift, &i2);
if (i2 < 0)
i2 = -i2;
if (i2 > i3) if (i2 > i3)
{ {
gfc_error ("The absolute value of SHIFT at %L must be less than " gfc_error ("The absolute value of SHIFT at %L must be less "
"or equal to SIZE at %L", &shift->where, &size->where); "than or equal to SIZE at %L", &shift->where,
return FAILURE; &size->where);
return FAILURE;
}
}
} }
} }
else if (less_than_bitsize1 ("I", i, NULL, shift, true) == FAILURE) else if (less_than_bitsize1 ("I", i, NULL, shift, true) == FAILURE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment