diff options
author | Tobias Burnus <burnus@net-b.de> | 2010-01-09 10:11:53 +0100 |
---|---|---|
committer | Tobias Burnus <burnus@gcc.gnu.org> | 2010-01-09 10:11:53 +0100 |
commit | 3d876aba229fdb4807f272e10fb0e91505c2fc36 (patch) | |
tree | 223d57c9d520148b8c3c0991db8b128b0bbbd1a6 /gcc/fortran/resolve.c | |
parent | 6b592ab357dd794ea04f33e9431ad7d7e69c1d11 (diff) | |
download | gcc-3d876aba229fdb4807f272e10fb0e91505c2fc36.zip gcc-3d876aba229fdb4807f272e10fb0e91505c2fc36.tar.gz gcc-3d876aba229fdb4807f272e10fb0e91505c2fc36.tar.bz2 |
[multiple changes]
2010-01-09 Tobias Burnus <burnus@net-b.de>
PR fortran/41298
* trans-expr.c (gfc_trans_structure_assign): Handle
c_null_(fun)ptr.
* symbol.c (gen_special_c_interop_ptr): Add NULL_EXPR
to the constructor for c_null_(fun)ptr.
* resolve.c (resolve_structure_cons): Add special case
for c_null_(fun)ptr.
2010-01-09 Tobias Burnus <burnus@net-b.de>
PR fortran/41298
* gfortran.dg/c_ptr_tests_14.f90: New test.
From-SVN: r155755
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0378d4f..8e8de8d 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1,5 +1,5 @@ /* Perform type resolution on the various structures. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Andy Vaught @@ -842,13 +842,20 @@ resolve_structure_cons (gfc_expr *expr) /* See if the user is trying to invoke a structure constructor for one of the iso_c_binding derived types. */ if (expr->ts.type == BT_DERIVED && expr->ts.u.derived - && expr->ts.u.derived->ts.is_iso_c && cons && cons->expr != NULL) + && expr->ts.u.derived->ts.is_iso_c && cons + && (cons->expr == NULL || cons->expr->expr_type != EXPR_NULL)) { gfc_error ("Components of structure constructor '%s' at %L are PRIVATE", expr->ts.u.derived->name, &(expr->where)); return FAILURE; } + /* Return if structure constructor is c_null_(fun)prt. */ + if (expr->ts.type == BT_DERIVED && expr->ts.u.derived + && expr->ts.u.derived->ts.is_iso_c && cons + && cons->expr && cons->expr->expr_type == EXPR_NULL) + return SUCCESS; + for (; comp; comp = comp->next, cons = cons->next) { int rank; |