re PR fortran/64528 (ICE: in process_constraint, at tree-ssa-structalias.c:3002 with...
authorJakub Jelinek <jakub@redhat.com>
Tue, 13 Jan 2015 16:42:22 +0000 (17:42 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 13 Jan 2015 16:42:22 +0000 (17:42 +0100)
PR fortran/64528
* trans-decl.c (create_function_arglist): Don't set TREE_READONLY
on dummy args with VALUE attribute.

* gfortran.dg/pr64528.f90: New test.

From-SVN: r219543

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

index 5af89b9752edc786f874920b6f6dba2a1f6ce12d..09fa75764880023f5572ea1e2d0a56e86ba2cef2 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/64528
+       * trans-decl.c (create_function_arglist): Don't set TREE_READONLY
+       on dummy args with VALUE attribute.
+
 2015-01-11  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/63733
index b099a0b71ef70654515404b423c2338b213963eb..667ebadf6c54b8ecae3088c9a325b2b83bb4ee62 100644 (file)
@@ -2327,8 +2327,9 @@ create_function_arglist (gfc_symbol * sym)
       /* Fill in arg stuff.  */
       DECL_CONTEXT (parm) = fndecl;
       DECL_ARG_TYPE (parm) = TREE_VALUE (typelist);
-      /* All implementation args are read-only.  */
-      TREE_READONLY (parm) = 1;
+      /* All implementation args except for VALUE are read-only.  */
+      if (!f->sym->attr.value)
+       TREE_READONLY (parm) = 1;
       if (POINTER_TYPE_P (type)
          && (!f->sym->attr.proc_pointer
              && f->sym->attr.flavor != FL_PROCEDURE))
index e13ef893e3893aa8da7a6eae7b3e0fd9c5ac0be5..79a43d628e86fc99573071a275f1d2efe9da70a2 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/64528
+       * gfortran.dg/pr64528.f90: New test.
+
 2015-01-13  Richard Sandiford  <richard.sandiford@arm.com>
 
        * gcc.target/aarch64/subsp.c: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr64528.f90 b/gcc/testsuite/gfortran.dg/pr64528.f90
new file mode 100644 (file)
index 0000000..f6cca4f
--- /dev/null
@@ -0,0 +1,20 @@
+! PR fortran/64528
+! { dg-do compile }
+! { dg-options "-O -fno-tree-dce -fno-tree-ccp" }
+
+program pr64528
+  interface
+     subroutine foo(x)
+       integer, value :: x
+     end subroutine foo
+  end interface
+  integer :: x
+  x = 10
+  call foo(x)
+  if(x .ne. 10) then
+  endif
+end program pr64528
+subroutine foo(x)
+  integer, value :: x
+  x = 11
+end subroutine foo