+2018-06-04 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85981
+ * resolve.c (resolve_allocate_deallocate): Check errmsg is default
+ character kind.
+
2018-06-03 Paul Thomas <pault@gcc.gnu.org>
PR fortran/36497
gfc_check_vardef_context (errmsg, false, false, false,
_("ERRMSG variable"));
+ /* F18:R928 alloc-opt is ERRMSG = errmsg-variable
+ F18:R930 errmsg-variable is scalar-default-char-variable
+ F18:R906 default-char-variable is variable
+ F18:C906 default-char-variable shall be default character. */
if ((errmsg->ts.type != BT_CHARACTER
&& !(errmsg->ref
&& (errmsg->ref->type == REF_ARRAY
|| errmsg->ref->type == REF_COMPONENT)))
- || errmsg->rank > 0 )
- gfc_error ("Errmsg-variable at %L must be a scalar CHARACTER "
+ || errmsg->rank > 0
+ || errmsg->ts.kind != gfc_default_character_kind)
+ gfc_error ("ERRMSG variable at %L shall be a scalar default CHARACTER "
"variable", &errmsg->where);
for (p = code->ext.alloc.list; p; p = p->next)
+2018-06-04 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/85981
+ * gfortran.dg/allocate_alloc_opt_14.f90: New test.
+ * gfortran.dg/allocate_alloc_opt_1.f90: Update error string.
+ * gfortran.dg/allocate_stat_2.f90: Ditto.
+ * gfortran.dg/deallocate_alloc_opt_1.f90: Ditto.
+
2018-06-04 Richard Sandiford <richard.sandiford@linaro.org>
* gcc.target/aarch64/sve/extract_5.c: New test.
allocate(i(2))) ! { dg-error "Syntax error in ALLOCATE" }
allocate(i(2), errmsg=err, errmsg=err) ! { dg-error "Redundant ERRMSG" }
allocate(i(2), errmsg=err) ! { dg-warning "useless without a STAT" }
- allocate(i(2), stat=j, errmsg=x) ! { dg-error "must be a scalar CHARACTER" }
+ allocate(i(2), stat=j, errmsg=x) ! { dg-error "shall be a scalar default CHARACTER" }
allocate(err) ! { dg-error "neither a data pointer nor an allocatable" }
--- /dev/null
+! { dg-do compile }
+program p
+ integer, allocatable :: arr(:)
+ integer :: stat
+ character(len=128, kind=4) :: errmsg = ' '
+ allocate (arr(3), stat=stat, errmsg=errmsg) ! { dg-error "shall be a scalar default CHARACTER" }
+ print *, allocated(arr), stat, trim(errmsg)
+end
character(len=30), dimension(2) :: er
integer, dimension (:), allocatable :: a
allocate (a (16), stat = ier) ! { dg-error "must be a scalar INTEGER" }
- allocate (a (14), stat=ier(1),errmsg=er) ! { dg-error "must be a scalar CHARACTER" }
+ allocate (a (14), stat=ier(1),errmsg=er) ! { dg-error "shall be a scalar default CHARACTER" }
end
deallocate(i)) ! { dg-error "Syntax error in DEALLOCATE" }
deallocate(i, errmsg=err, errmsg=err) ! { dg-error "Redundant ERRMSG" }
deallocate(i, errmsg=err) ! { dg-warning "useless without a STAT" }
- deallocate(i, stat=j, errmsg=x) ! { dg-error "must be a scalar CHARACTER" }
+ deallocate(i, stat=j, errmsg=x) ! { dg-error "shall be a scalar default CHARACTER" }
deallocate(err) ! { dg-error "nonprocedure pointer nor an allocatable" }