]> gcc.gnu.org Git - gcc.git/commitdiff
re PR fortran/41070 (Error: Components of structure constructor '' at (1) are PRIVATE)
authorJanus Weil <janus@gcc.gnu.org>
Fri, 14 Aug 2009 22:02:45 +0000 (00:02 +0200)
committerJanus Weil <janus@gcc.gnu.org>
Fri, 14 Aug 2009 22:02:45 +0000 (00:02 +0200)
2009-08-14  Janus Weil  <janus@gcc.gnu.org>

PR fortran/41070
* resolve.c (resolve_structure_cons): Make sure that ts.u.derived is
only used if type is BT_DERIVED.

2009-08-14  Janus Weil  <janus@gcc.gnu.org>

PR fortran/41070
* gfortran.dg/structure_constructor_10.f90: New.

From-SVN: r150781

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/structure_constructor_10.f90 [new file with mode: 0644]

index f48729e34b270ae9f41fa879ad17e7b22ffcd068..4f807eaf2991a42d8cab53913729d21bccf04537 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-14  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/41070
+       * resolve.c (resolve_structure_cons): Make sure that ts.u.derived is
+       only used if type is BT_DERIVED.
+
 2009-08-13  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/40941
index 9baef621eac6e13ee6368be9d411644761448758..ff32ae6e21d104d608b73d4ed5463932392f37fb 100644 (file)
@@ -830,8 +830,8 @@ 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.u.derived && expr->ts.u.derived->ts.is_iso_c && cons
-      && cons->expr != NULL)
+  if (expr->ts.type == BT_DERIVED && expr->ts.u.derived
+      && expr->ts.u.derived->ts.is_iso_c && cons && cons->expr != NULL)
     {
       gfc_error ("Components of structure constructor '%s' at %L are PRIVATE",
                 expr->ts.u.derived->name, &(expr->where));
index 1a47faeef950b2f7f4f70bc34f89e259be417dcd..44329fb3c5306eafbcdd94240930f79ea33f1e47 100644 (file)
@@ -1,3 +1,8 @@
+2009-08-14  Janus Weil  <janus@gcc.gnu.org>
+
+       PR fortran/41070
+       * gfortran.dg/structure_constructor_10.f90: New.
+
 2009-08-14  Olatunji Ruwase <tjruwase@google.com>
 
        * gcc.dg/pragma-re-1.c: Supported on all platforms.
diff --git a/gcc/testsuite/gfortran.dg/structure_constructor_10.f90 b/gcc/testsuite/gfortran.dg/structure_constructor_10.f90
new file mode 100644 (file)
index 0000000..eed7fa3
--- /dev/null
@@ -0,0 +1,28 @@
+! { dg-do compile }
+!
+! PR 41070: [4.5 Regression] Error: Components of structure constructor '' at (1) are PRIVATE
+!
+! Contributed by Michael Richmond <michael.a.richmond@nasa.gov>
+
+MODULE cdf_aux_mod
+IMPLICIT NONE
+
+TYPE :: one_parameter
+  CHARACTER (8) :: name
+END TYPE one_parameter
+
+TYPE :: the_distribution
+  CHARACTER (8) :: name
+END TYPE the_distribution
+
+TYPE (the_distribution), PARAMETER :: the_beta = the_distribution('cdf_beta')
+END MODULE cdf_aux_mod
+
+SUBROUTINE cdf_beta()
+  USE cdf_aux_mod
+  IMPLICIT NONE
+  CALL check_complements(the_beta%name)
+END SUBROUTINE cdf_beta
+
+! { dg-final { cleanup-modules "cdf_aux_mod" } }
+
This page took 0.108966 seconds and 5 git commands to generate.