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) <case CONST_DECL>: For EXPAND_WRITE
	return a MEM.

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

From-SVN: r241182
This commit is contained in:
Jakub Jelinek 2016-10-14 21:36:58 +02:00 committed by Jakub Jelinek
parent 6af11d2bf4
commit 9a822fc79d
4 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2016-10-14 Jakub Jelinek <jakub@redhat.com>
PR middle-end/77959
* expr.c (expand_expr_real_1) <case CONST_DECL>: For EXPAND_WRITE
return a MEM.
2016-10-14 Eric Botcazou <ebotcazou@adacore.com>
* config/sparc/sparc-passes.def: New file.

View File

@ -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:

View File

@ -1,5 +1,8 @@
2016-10-14 Jakub Jelinek <jakub@redhat.com>
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.

View File

@ -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