Commit 2028ce45 by Steven G. Kargl

decl.c (match_byte_typespec): New function.

2019-11-01  Steven G. Kargl  <kargl@gcc.gnu.org>

	* decl.c (match_byte_typespec): New function.  Match BYTE type-spec.
	(gfc_match_decl_type_spec): Use it.

2019-11-01  Steven G. Kargl  <kargl@gcc.gnu.org>

	* gfortran.dg/byte_3.f: New test.
	* gfortran.dg/byte_4.f90: Ditto.

From-SVN: r277715
parent c7e34433
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org> 2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org>
* decl.c (match_byte_typespec): New function. Match BYTE type-spec.
(gfc_match_decl_type_spec): Use it.
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/90988 PR fortran/90988
* decl.c (gfc_match_private, gfc_match_public): Fixed-form source code * decl.c (gfc_match_private, gfc_match_public): Fixed-form source code
does not require whitespace between PRIVATE (or PUBLIC) and an entity. does not require whitespace between PRIVATE (or PUBLIC) and an entity.
......
...@@ -3980,6 +3980,38 @@ error_return: ...@@ -3980,6 +3980,38 @@ error_return:
} }
/* Match a legacy nonstandard BYTE type-spec. */
static match
match_byte_typespec (gfc_typespec *ts)
{
if (gfc_match (" byte") == MATCH_YES)
{
if (!gfc_notify_std (GFC_STD_GNU, "BYTE type at %C"))
return MATCH_ERROR;
if (gfc_current_form == FORM_FREE)
{
char c = gfc_peek_ascii_char ();
if (!gfc_is_whitespace (c) && c != ',')
return MATCH_NO;
}
if (gfc_validate_kind (BT_INTEGER, 1, true) < 0)
{
gfc_error ("BYTE type used at %C "
"is not available on the target machine");
return MATCH_ERROR;
}
ts->type = BT_INTEGER;
ts->kind = 1;
return MATCH_YES;
}
return MATCH_NO;
}
/* Matches a declaration-type-spec (F03:R502). If successful, sets the ts /* Matches a declaration-type-spec (F03:R502). If successful, sets the ts
structure to the matched specification. This is necessary for FUNCTION and structure to the matched specification. This is necessary for FUNCTION and
IMPLICIT statements. IMPLICIT statements.
...@@ -4012,22 +4044,10 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag) ...@@ -4012,22 +4044,10 @@ gfc_match_decl_type_spec (gfc_typespec *ts, int implicit_flag)
/* Clear the current binding label, in case one is given. */ /* Clear the current binding label, in case one is given. */
curr_binding_label = NULL; curr_binding_label = NULL;
if (gfc_match (" byte") == MATCH_YES) /* Match BYTE type-spec. */
{ m = match_byte_typespec (ts);
if (!gfc_notify_std (GFC_STD_GNU, "BYTE type at %C")) if (m != MATCH_NO)
return MATCH_ERROR; return m;
if (gfc_validate_kind (BT_INTEGER, 1, true) < 0)
{
gfc_error ("BYTE type used at %C "
"is not available on the target machine");
return MATCH_ERROR;
}
ts->type = BT_INTEGER;
ts->kind = 1;
return MATCH_YES;
}
m = gfc_match (" type ("); m = gfc_match (" type (");
matched_type = (m == MATCH_YES); matched_type = (m == MATCH_YES);
......
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org> 2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org>
* gfortran.dg/byte_3.f: New test.
* gfortran.dg/byte_4.f90: Ditto.
2019-11-01 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/90988 PR fortran/90988
* gfortran.dg/pr90988_4.f: New test. * gfortran.dg/pr90988_4.f: New test.
......
c { dg-do run }
c { dg-options "-std=legacy" }
bytea
a = 1
if (a /= 1 .and. kind(a) /= a) stop 1
end
! { dg-do compile }
! { dg-options "-w" }
bytea ! { dg-error "Unclassifiable statement" }
byte b
byte :: d
a = 1
b = 1
d = 1
print *, a, b * d
end
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