From: Jakub Jelinek Date: Fri, 14 Oct 2016 19:36:58 +0000 (+0200) Subject: re PR middle-end/77959 (ICE in ix86_decompose_address, at i386/i386.c:14954) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9a822fc79deecdc3bad1bcca0bb1ffebdd3b404c;p=gcc.git re PR middle-end/77959 (ICE in ix86_decompose_address, at i386/i386.c:14954) PR middle-end/77959 * expr.c (expand_expr_real_1) : For EXPAND_WRITE return a MEM. * gfortran.dg/pr77959.f90: New test. From-SVN: r241182 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 63034cd6d58..732ccb28f0e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-10-14 Jakub Jelinek + + PR middle-end/77959 + * expr.c (expand_expr_real_1) : For EXPAND_WRITE + return a MEM. + 2016-10-14 Eric Botcazou * config/sparc/sparc-passes.def: New file. diff --git a/gcc/expr.c b/gcc/expr.c index b587da82180..28242b2551d 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9915,6 +9915,19 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, } case CONST_DECL: + if (modifier == EXPAND_WRITE) + { + /* Writing into CONST_DECL is always invalid, but handle it + gracefully. */ + addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (exp)); + machine_mode address_mode = targetm.addr_space.address_mode (as); + op0 = expand_expr_addr_expr_1 (exp, NULL_RTX, address_mode, + EXPAND_NORMAL, as); + op0 = memory_address_addr_space (mode, op0, as); + temp = gen_rtx_MEM (mode, op0); + set_mem_addr_space (temp, as); + return temp; + } return expand_expr (DECL_INITIAL (exp), target, VOIDmode, modifier); case REAL_CST: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 25115d4130d..849c6e49de6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2016-10-14 Jakub Jelinek + PR middle-end/77959 + * gfortran.dg/pr77959.f90: New test. + DR 1511 - const volatile variables and ODR * g++.dg/DRs/dr1511-1.C: New test. * g++.dg/DRs/dr1511-2.C: New test. diff --git a/gcc/testsuite/gfortran.dg/pr77959.f90 b/gcc/testsuite/gfortran.dg/pr77959.f90 new file mode 100644 index 00000000000..36754a0bd32 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr77959.f90 @@ -0,0 +1,16 @@ +! PR middle-end/77959 +! { dg-do compile } +! { dg-options "-O2" } + +program pr77959 + interface + subroutine foo(x) ! { dg-warning "Type mismatch in argument" } + real :: x + end + end interface + call foo(1.0) +end +subroutine foo(x) + complex :: x + x = x + 1 +end