From 31ec353514ba83c83b81e053f161256339c7e9f6 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 13 Jan 2015 17:42:22 +0100 Subject: [PATCH] re PR fortran/64528 (ICE: in process_constraint, at tree-ssa-structalias.c:3002 with -O -fno-tree-ccp -fno-tree-dce) 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 | 6 ++++++ gcc/fortran/trans-decl.c | 5 +++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr64528.f90 | 20 ++++++++++++++++++++ 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr64528.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5af89b9752e..09fa7576488 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2015-01-13 Jakub Jelinek + + 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 PR fortran/63733 diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index b099a0b71ef..667ebadf6c5 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e13ef893e38..79a43d628e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-13 Jakub Jelinek + + PR fortran/64528 + * gfortran.dg/pr64528.f90: New test. + 2015-01-13 Richard Sandiford * 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 index 00000000000..f6cca4f73e0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr64528.f90 @@ -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 -- 2.30.2