diff options
author | Janus Weil <janus@gcc.gnu.org> | 2016-11-13 10:56:10 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2016-11-13 10:56:10 +0100 |
commit | 9cbf8673106e24e33f2ab2ed9a054c3a759d84e1 (patch) | |
tree | 64c45c010d747e598543fbee00fee803369db4e8 /gcc/fortran/decl.c | |
parent | 559f2bbc362f311ab424232e72bb4f9f601b54eb (diff) | |
download | gcc-9cbf8673106e24e33f2ab2ed9a054c3a759d84e1.zip gcc-9cbf8673106e24e33f2ab2ed9a054c3a759d84e1.tar.gz gcc-9cbf8673106e24e33f2ab2ed9a054c3a759d84e1.tar.bz2 |
re PR fortran/66366 ([OOP] ICE on invalid with non-allocatable CLASS variable)
2016-11-13 Janus Weil <janus@gcc.gnu.org>
PR fortran/66366
* resolve.c (resolve_component): Move check for C437
to ...
* decl.c (build_struct): ... here. Fix indentation.
2016-11-13 Janus Weil <janus@gcc.gnu.org>
PR fortran/66366
* gfortran.dg/class_57.f90: Changed error message.
* gfortran.dg/class_60.f90: New test.
From-SVN: r242351
Diffstat (limited to 'gcc/fortran/decl.c')
-rw-r--r-- | gcc/fortran/decl.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index b17a8aa..4f5c0cf 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1866,9 +1866,18 @@ build_struct (const char *name, gfc_charlen *cl, gfc_expr **init, } else if (current_attr.allocatable == 0) { - gfc_error ("Component at %C must have the POINTER attribute"); - return false; + gfc_error ("Component at %C must have the POINTER attribute"); + return false; + } } + + /* F03:C437. */ + if (current_ts.type == BT_CLASS + && !(current_attr.pointer || current_attr.allocatable)) + { + gfc_error ("Component %qs with CLASS at %C must be allocatable " + "or pointer", name); + return false; } if (gfc_current_block ()->attr.pointer && (*as)->rank != 0) |