https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107595

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org
           Keywords|ice-on-valid-code           |

--- Comment #2 from kargl at gcc dot gnu.org ---
I've remove the ice-on-valid-code designation.
Restore it if you believe otherwise.

Allowing old style (aka nonstandard) initialization of variable
declared with a user-defined derived type should be deprecated.
There is no reason to avoid standard conforming code:

   type(t) x /t(4, null())/
   type(t) :: x = t(4, null())



diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index 0f9b2ced4c2..5627ea24245 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -2969,6 +2977,14 @@ variable_decl (int elem)
          goto cleanup;
        }

+      if (current_ts.type == BT_DERIVED)
+       {
+         gfc_error ("Old style initialization incompatiable with a variable "
+                    "declared with a user-defined derived type at %C");
+         m = MATCH_ERROR;
+         goto cleanup;
+       }
+
       /* For structure components, read the initializer as a special
          expression and let the rest of this function apply the initializer
          as usual.  */

Reply via email to