Fortran: reject BOZ type argument to SIZEOF().

gcc/fortran/ChangeLog:

	PR fortran/103412
	* check.c (gfc_check_sizeof): Reject BOZ type argument.

gcc/testsuite/ChangeLog:

	PR fortran/103412
	* gfortran.dg/illegal_boz_arg_2.f90: New test.
This commit is contained in:
Harald Anlauf 2021-12-18 23:21:35 +01:00
parent 31048012db
commit fd74a2ee40
2 changed files with 9 additions and 0 deletions

View file

@ -5135,6 +5135,9 @@ gfc_check_sizeof (gfc_expr *arg)
return false;
}
if (illegal_boz_arg (arg))
return false;
/* TYPE(*) is acceptable if and only if it uses an array descriptor. */
if (arg->ts.type == BT_ASSUMED
&& (arg->symtree->n.sym->as == NULL

View file

@ -0,0 +1,6 @@
! { dg-do compile }
! PR fortran/103412
program p
integer, parameter :: a = sizeof(z'1') ! { dg-error "cannot be an actual" }
end