This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/70870] Segmentation violation in gfc_assign_data_value
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 09 Jul 2016 18:17:11 +0000
- Subject: [Bug fortran/70870] Segmentation violation in gfc_assign_data_value
- Auto-submitted: auto-generated
- References: <bug-70870-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70870
--- Comment #3 from kargl at gcc dot gnu.org ---
Index: data.c
===================================================================
--- data.c (revision 238178)
+++ data.c (working copy)
@@ -489,6 +489,15 @@ gfc_assign_data_value (gfc_expr *lvalue,
}
else
{
+ if (lvalue->ts.type == BT_DERIVED
+ && gfc_has_default_initializer (lvalue->ts.u.derived))
+ {
+ gfc_error ("Nonpointer object %qs with default initialization "
+ "shall not appear in a DATA statement at %L",
+ symbol->name, &lvalue->where);
+ return false;
+ }
+
/* Overwriting an existing initializer is non-standard but usually only
provokes a warning from other compilers. */
if (init != NULL)
% gfc -c -Wall a.f90
a.f90:6:4:
data v2/t(2)/ ! this is wrong
1
Error: Nonpointer object 'v2' with default initialization shall not appear in a
DATA statement at (1)