diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2005-11-06 20:05:12 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2005-11-06 20:05:12 +0000 |
commit | 4075a94ef5610e42839970b49f25ae1bbf176520 (patch) | |
tree | cf705dd04dbbcc1d3afb58821a83148e48c5ea47 /gcc/fortran/data.c | |
parent | c5a35c3c50228be69ecbb579b53925d7be73377d (diff) | |
download | gcc-4075a94ef5610e42839970b49f25ae1bbf176520.zip gcc-4075a94ef5610e42839970b49f25ae1bbf176520.tar.gz gcc-4075a94ef5610e42839970b49f25ae1bbf176520.tar.bz2 |
re PR fortran/24534 (PUBLIC derived types with private components)
2005-11-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24534
* resolve.c (resolve_symbol): Exclude case of PRIVATE declared
within derived type from error associated with PRIVATE type
components within derived type.
PR fortran/20838
PR fortran/20840
* gfortran.h: Add prototype for gfc_has_vector_index.
* io.c (gfc_resolve_dt): Error if internal unit has a vector index.
* expr.c (gfc_has_vector_index): New function to check if any of
the array references of an expression have vector inidices.
(gfc_check_pointer_assign): Error if internal unit has a vector index.
PR fortran/17737
* data.c (gfc_assign_data_value): Remove gcc_assert that caused the ICE
and replace by a standard dependent warning/error if overwriting an
existing initialization.
* decl.c (gfc_data_variable): Remove old error for already initialized
variable and the unused error check for common block variables. Add
error for hots associated variable and standard dependent error for
common block variables, outside of blockdata.
* symbol.c (check_conflict): Add constraints for DATA statement.
2005-11-06 Paul Thomas <pault@gcc.gnu.org>
PR fortran/24534
gfortran.dg/private_type_2.f90: Modified to check that case with
PRIVATE declaration within derived type is accepted.
PR fortran/20838
gfortran.dg/pointer_assign_1.f90: New test.
PR fortran/20840
* gfortran.dg/arrayio_0.f90: New test.
PR fortran/17737
gfortran.dg/data_initialized.f90: New test.
gfortran.dg/data_constraints_1.f90: New test.
gfortran.dg/data_constraints_2.f90: New test.
From-SVN: r106567
Diffstat (limited to 'gcc/fortran/data.c')
-rw-r--r-- | gcc/fortran/data.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c index d614db4..fdb9856 100644 --- a/gcc/fortran/data.c +++ b/gcc/fortran/data.c @@ -315,8 +315,19 @@ gfc_assign_data_value (gfc_expr * lvalue, gfc_expr * rvalue, mpz_t index) expr = create_character_intializer (init, last_ts, ref, rvalue); else { - /* We should never be overwriting an existing initializer. */ - gcc_assert (!init); + /* Overwriting an existing initializer is non-standard but usually only + provokes a warning from other compilers. */ + if (init != NULL) + { + /* Order in which the expressions arrive here depends on whether they + are from data statements or F95 style declarations. Therefore, + check which is the most recent. */ + expr = (init->where.lb->linenum > rvalue->where.lb->linenum) ? + init : rvalue; + gfc_notify_std (GFC_STD_GNU, "Extension: re-initialization " + "of '%s' at %L", symbol->name, &expr->where); + return; + } expr = gfc_copy_expr (rvalue); if (!gfc_compare_types (&lvalue->ts, &expr->ts)) |