From f9f63ff2153c3b281c17e3de313f9c83ff08f04c Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Wed, 15 Nov 2006 17:04:56 +0000 Subject: [PATCH] re PR tree-optimization/29788 (ICE in var_ann, at tree-flow-inline.h:130) 2006-11-15 Andrew Pinski PR tree-opt/29788 * fold-const.c (fold_indirect_ref_1): Fold *&CONST_DECL down to what is the const decl is a place holder for. 2006-11-15 Andrew Pinski PR tree-opt/29788 * gfortran.fortran-torture/compile/inline_1.f90: New testcase. From-SVN: r118861 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 3 +++ gcc/testsuite/ChangeLog | 6 ++++++ .../compile/inline_1.f90 | 17 +++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 gcc/testsuite/gfortran.fortran-torture/compile/inline_1.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eb0dd2e39c8..382a8a30e09 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-11-15 Andrew Pinski + + PR tree-opt/29788 + * fold-const.c (fold_indirect_ref_1): Fold *&CONST_DECL down + to what is the const decl is a place holder for. + 2006-11-15 Uros Bizjak * config/i386/i386.opt: New target option -mx87regparm. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index eb3b45701a4..143dcadcfa4 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -13038,6 +13038,9 @@ fold_indirect_ref_1 (tree type, tree op0) { tree op = TREE_OPERAND (sub, 0); tree optype = TREE_TYPE (op); + /* *&CONST_DECL -> to the value of the const decl. */ + if (TREE_CODE (op) == CONST_DECL) + return DECL_INITIAL (op); /* *&p => p; make sure to handle *&"str"[cst] here. */ if (type == optype) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d5f56ee2447..b60e1b85832 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-11-15 Andrew Pinski + + PR tree-opt/29788 + * gfortran.fortran-torture/compile/inline_1.f90: + New testcase. + 2006-11-15 Uros Bizjak * gcc.target/i386/x87regparm-1.c: New test. diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/inline_1.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/inline_1.f90 new file mode 100644 index 00000000000..58c02f2c1a3 --- /dev/null +++ b/gcc/testsuite/gfortran.fortran-torture/compile/inline_1.f90 @@ -0,0 +1,17 @@ +program gfcbug43 + call try_fit (1) + call try_fit (1) +contains + subroutine try_fit (k) + call fit (1, debug=.true.) + end subroutine try_fit + subroutine fit (k, debug) + logical, intent(in), optional :: debug + do j = 1, 2 + maxerr1 = funk (r ,x1 , x1) + end do + if (debug) then + print "help" + end if + end subroutine fit +end program gfcbug43