]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/64528 (ICE: in process_constraint, at tree-ssa-structalias...
authorJakub Jelinek <jakub@redhat.com>
Sun, 1 Feb 2015 21:51:40 +0000 (22:51 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sun, 1 Feb 2015 21:51:40 +0000 (22:51 +0100)
Backported from mainline
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.

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

From-SVN: r220333

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

index 93db3380c7d89f13fd6d0d1e99fce79a53fead89..81c4c1d860e454696bf32cf47d272656f9d5f427 100644 (file)
@@ -1,3 +1,12 @@
+2015-02-01  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       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-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/56867
index b4b0fc536b014d2ec998a43df7fd60056adfb622..b473d660e736f5a7bba3ca9d4745f74d4a4900e9 100644 (file)
@@ -2186,8 +2186,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 909c125d9623ac16299d03f1af98e56b9a5ec2ab..0287bccee613e5a353a71dcb080ad8b3662209ea 100644 (file)
@@ -1,6 +1,11 @@
 2015-02-01  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2015-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/64528
+       * gfortran.dg/pr64528.f90: New test.
+
        2015-01-12  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/64563
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