Comments
Patch
===================================================================
@@ -3145,51 +3145,20 @@ gfc_simplify_ishftc (gfc_expr *e, gfc_ex
if (e->expr_type != EXPR_CONSTANT || s->expr_type != EXPR_CONSTANT)
return NULL;
- if (gfc_extract_int (s, &shift) != NULL)
- {
- gfc_error ("Invalid second argument of ISHFTC at %L", &s->where);
- return &gfc_bad_expr;
- }
+ gfc_extract_int (s, &shift);
k = gfc_validate_kind (e->ts.type, e->ts.kind, false);
- isize = gfc_integer_kinds[k].bit_size;
+ ssize = isize = gfc_integer_kinds[k].bit_size;
if (sz != NULL)
{
if (sz->expr_type != EXPR_CONSTANT)
return NULL;
- if (gfc_extract_int (sz, &ssize) != NULL || ssize <= 0)
- {
- gfc_error ("Invalid third argument of ISHFTC at %L", &sz->where);
- return &gfc_bad_expr;
- }
-
- if (ssize > isize)
- {
- gfc_error ("Magnitude of third argument of ISHFTC exceeds "
- "BIT_SIZE of first argument at %L", &s->where);
- return &gfc_bad_expr;
- }
+ gfc_extract_int (sz, &ssize);
}
- else
- ssize = isize;
-
- if (shift >= 0)
- ashift = shift;
- else
- ashift = -shift;
- if (ashift > ssize)
- {
- if (sz != NULL)
- gfc_error ("Magnitude of second argument of ISHFTC exceeds "
- "third argument at %L", &s->where);
- else
- gfc_error ("Magnitude of second argument of ISHFTC exceeds "
- "BIT_SIZE of first argument at %L", &s->where);
- return &gfc_bad_expr;
- }
+ ashift = (shift >= 0) ? shift : -shift;
result = gfc_get_constant_expr (e->ts.type, e->ts.kind, &e->where);