aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-11-30 10:39:36 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-11-30 10:39:36 +0000
commitffab1d071ca78b02490bb39ae784d1ad45f4eb04 (patch)
tree70e5c4b5c8abb762105af6b9e0ae79b0bd32f9c8
parentc84b434f46aabff791f59a45ec74c8b9a3cf32f2 (diff)
downloadgcc-ffab1d071ca78b02490bb39ae784d1ad45f4eb04.zip
gcc-ffab1d071ca78b02490bb39ae784d1ad45f4eb04.tar.gz
gcc-ffab1d071ca78b02490bb39ae784d1ad45f4eb04.tar.bz2
re PR middle-end/42119 (internal compiler error: in expand_expr_addr_expr_1, at expr.c:6862)
2009-11-30 Richard Guenther <rguenther@suse.de> PR middle-end/42119 PR fortran/38530 * expr.c (expand_expr_addr_expr_1): Properly expand the initializer of CONST_DECLs. * gfortran.dg/pr42119.f90: New testcase. From-SVN: r154778
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/expr.c5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gfortran.dg/pr42119.f9024
4 files changed, 39 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e9b2e73..0aa39ad 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2009-11-30 Richard Guenther <rguenther@suse.de>
+ PR middle-end/42119
+ PR fortran/38530
+ * expr.c (expand_expr_addr_expr_1): Properly expand the initializer
+ of CONST_DECLs.
+
+2009-11-30 Richard Guenther <rguenther@suse.de>
+
* tree-into-ssa.c (insert_phi_nodes): Add PHI nodes in
variable UID order.
diff --git a/gcc/expr.c b/gcc/expr.c
index 75c1792..13ae5ff 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6840,9 +6840,8 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
return expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
case CONST_DECL:
- /* Recurse and make the output_constant_def clause above handle this. */
- return expand_expr_addr_expr_1 (DECL_INITIAL (exp), target,
- tmode, modifier, as);
+ /* Expand the initializer like constants above. */
+ return XEXP (expand_expr_constant (DECL_INITIAL (exp), 0, modifier), 0);
case REALPART_EXPR:
/* The real part of the complex number is always first, therefore
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f09f148..6d75d60 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2009-11-30 Richard Guenther <rguenther@suse.de>
+
+ PR middle-end/42119
+ PR fortran/38530
+ * gfortran.dg/pr42119.f90: New testcase.
+
2009-11-30 Dodji Seketeli <dodji@redhat.com>
PR c++/42069
diff --git a/gcc/testsuite/gfortran.dg/pr42119.f90 b/gcc/testsuite/gfortran.dg/pr42119.f90
new file mode 100644
index 0000000..f848e9e
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr42119.f90
@@ -0,0 +1,24 @@
+! { dg-do compile }
+
+module Test
+use ISO_C_BINDING
+
+contains
+
+subroutine Callback(arg) bind(C)
+ integer(C_INT) :: arg
+end subroutine Callback
+
+subroutine Check(proc)
+ type(C_FUNPTR) :: proc
+end subroutine Check
+
+end module Test
+
+
+program Main
+ use Test
+ type(C_FUNPTR) :: proc
+
+ call Check(C_FUNLOC(Callback))
+end program Main