diff options
author | Fritz O. Reese <fritzoreese@gmail.com> | 2016-11-09 17:31:27 +0000 |
---|---|---|
committer | Fritz Reese <foreese@gcc.gnu.org> | 2016-11-09 17:31:27 +0000 |
commit | f31adad4cbbb1ece12a84b698e5cbfeea756d4ce (patch) | |
tree | f7a155b241bd205bfc51fc7c88c557b69f28be27 /gcc/fortran/trans-expr.c | |
parent | b349a81aa03c74c0d39fb5ac847c308ab63be76e (diff) | |
download | gcc-f31adad4cbbb1ece12a84b698e5cbfeea756d4ce.zip gcc-f31adad4cbbb1ece12a84b698e5cbfeea756d4ce.tar.gz gcc-f31adad4cbbb1ece12a84b698e5cbfeea756d4ce.tar.bz2 |
Fix ICE in gfc_trans_subcomponent_assign due to NULL components.
PR fortran/78259
* gcc/fortran/trans-expr.c (gfc_trans_subcomponent_assign): Guard
against NULL values.
PR fortran/78259
* gcc/testsuite/gfortran.dg/pr78259.f90: New test.
From-SVN: r242010
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 6121429..48296b8 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -7327,7 +7327,8 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr, gfc_constructor *c = gfc_constructor_first (expr->value.constructor); /* We mark that the entire union should be initialized with a contrived EXPR_NULL expression at the beginning. */ - if (c->n.component == NULL && c->expr->expr_type == EXPR_NULL) + if (c != NULL && c->n.component == NULL + && c->expr != NULL && c->expr->expr_type == EXPR_NULL) { tmp = build2_loc (input_location, MODIFY_EXPR, void_type_node, dest, build_constructor (TREE_TYPE (dest), NULL)); |