diff options
author | Fritz Reese <fritzoreese@gmail.com> | 2017-05-17 15:13:58 +0000 |
---|---|---|
committer | Fritz Reese <foreese@gcc.gnu.org> | 2017-05-17 15:13:58 +0000 |
commit | e5b1f5a1d11f73ff289ffebfeccbc0650531367b (patch) | |
tree | 97f41faa2225a37fd33f60fa60b8950f5daa87c9 /gcc/fortran/expr.c | |
parent | 3ca8120f640818a80ffdcb64f50c2091570e8657 (diff) | |
download | gcc-e5b1f5a1d11f73ff289ffebfeccbc0650531367b.zip gcc-e5b1f5a1d11f73ff289ffebfeccbc0650531367b.tar.gz gcc-e5b1f5a1d11f73ff289ffebfeccbc0650531367b.tar.bz2 |
re PR fortran/80668 (wrong error message with -finit-derived)
2017-05-17 Fritz Reese <fritzoreese@gmail.com>
PR fortran/80668
gcc/fortran/ChangeLog:
PR fortran/80668
* expr.c (component_initializer): Don't generate initializers for
pointer components.
* invoke.texi (-finit-derived): Document.
gcc/testsuite/ChangeLog:
PR fortran/80668
* gfortran.dg/pr80668.f90: New.
From-SVN: r248158
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index c7d3e54..9b2e565 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4280,9 +4280,13 @@ component_initializer (gfc_typespec *ts, gfc_component *c, bool generate) { gfc_expr *init = NULL; - /* See if we can find the initializer immediately. */ + /* See if we can find the initializer immediately. + Some components should never get initializers. */ if (c->initializer || !generate - || (ts->type == BT_CLASS && !c->attr.allocatable)) + || (ts->type == BT_CLASS && !c->attr.allocatable) + || c->attr.pointer + || c->attr.class_pointer + || c->attr.proc_pointer) return c->initializer; /* Recursively handle derived type components. */ |