OSDN Git Service

2010-02-01 Tobias Burnus <burnus@net-b.de>
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Feb 2010 21:37:49 +0000 (21:37 +0000)
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 1 Feb 2010 21:37:49 +0000 (21:37 +0000)
        PR fortran/42922
        * decl.c (variable_decl): Allow default initializer in
        TYPE declarations in PURE functions.

2010-02-01  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42922
        * gfortran.dg/pure_initializer_3.f90: News test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156433 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 0271eb9..9e76755 100644 (file)
@@ -1,3 +1,9 @@
+2010-02-01  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/42922
+       * decl.c (variable_decl): Allow default initializer in
+       TYPE declarations in PURE functions.
+
 2010-01-31  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/42888
 
 2010-01-31  Paul Thomas  <pault@gcc.gnu.org>
 
-        PR fortran/38324
+       PR fortran/38324
        * expr.c (gfc_get_full_arrayspec_from_expr): New function.
        * gfortran.h : Add prototype for above.
-        * trans-expr.c (gfc_trans_alloc_subarray_assign): New function.
+       * trans-expr.c (gfc_trans_alloc_subarray_assign): New function.
        (gfc_trans_subcomponent_assign): Call new function to replace
        the code to deal with allocatable components.
        * trans-intrinsic.c (gfc_conv_intrinsic_bound): Call
index 9f65fe4..015d6a4 100644 (file)
@@ -1809,7 +1809,8 @@ variable_decl (int elem)
              m = MATCH_ERROR;
            }
 
-         if (current_attr.flavor != FL_PARAMETER && gfc_pure (NULL))
+         if (current_attr.flavor != FL_PARAMETER && gfc_pure (NULL)
+             && gfc_state_stack->state != COMP_DERIVED)
            {
              gfc_error ("Initialization of variable at %C is not allowed in "
                         "a PURE procedure");
index a2d8344..c68fe11 100644 (file)
@@ -1,3 +1,8 @@
+2010-02-01  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/42922
+       * gfortran.dg/pure_initializer_3.f90: News test.
+
 2010-01-31  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/42888
@@ -15,9 +20,9 @@
 
 2010-01-31  Paul Thomas  <pault@gcc.gnu.org>
 
-        PR fortran/38324
-        * gfortran.dg/alloc_comp_basics_1.f90: Remove option -O2.
-        * gfortran.dg/alloc_comp_bounds_1.f90: New test.
+       PR fortran/38324
+       * gfortran.dg/alloc_comp_basics_1.f90: Remove option -O2.
+       * gfortran.dg/alloc_comp_bounds_1.f90: New test.
 
 2010-01-30  Paolo Bonzini  <bonzini@gnu.org>
 
diff --git a/gcc/testsuite/gfortran.dg/pure_initializer_3.f90 b/gcc/testsuite/gfortran.dg/pure_initializer_3.f90
new file mode 100644 (file)
index 0000000..91ec178
--- /dev/null
@@ -0,0 +1,14 @@
+! { dg-do compile }
+!
+! PR fortran/42922
+!
+! Contributed by mrestelli@gmail.com
+!
+pure subroutine psub()
+  implicit none
+  type ilist
+    integer :: i = 0
+  end type ilist
+  type(ilist) :: x
+  x%i = 1
+end subroutine psub