re PR debug/43166 (ICE in simplify_subreg on fortran code)

PR debug/43166
	* cfgexpand.c (expand_debug_expr) <case VAR_DECL>: If mode is
	BLKmode, assert op0 is a MEM and just adjust its mode.

	* trans-common.c (build_common_decl): Also update DECL_MODE,
	and DECL_SIZE when encountering a larger common block and call
	layout_decl.

	* gfortran.dg/debug/pr43166.f: New test.

From-SVN: r157063
This commit is contained in:
Jakub Jelinek 2010-02-25 11:50:24 +01:00 committed by Jakub Jelinek
parent 7d5d39bb9d
commit 0679656478
6 changed files with 37 additions and 2 deletions

View file

@ -1,5 +1,9 @@
2010-02-25 Jakub Jelinek <jakub@redhat.com>
PR debug/43166
* cfgexpand.c (expand_debug_expr) <case VAR_DECL>: If mode is
BLKmode, assert op0 is a MEM and just adjust its mode.
PR debug/43165
* cfgexpand.c (expand_debug_expr): Don't call simplify_gen_subreg
if bitpos isn't multiple of mode's bitsize.

View file

@ -2316,7 +2316,11 @@ expand_debug_expr (tree exp)
else
op0 = copy_rtx (op0);
if (GET_MODE (op0) == BLKmode)
if (GET_MODE (op0) == BLKmode
/* If op0 is not BLKmode, but BLKmode is, adjust_mode
below would ICE. While it is likely a FE bug,
try to be robust here. See PR43166. */
|| mode == BLKmode)
{
gcc_assert (MEM_P (op0));
op0 = adjust_address_nv (op0, mode, 0);

View file

@ -1,3 +1,10 @@
2010-02-25 Jakub Jelinek <jakub@redhat.com>
PR debug/43166
* trans-common.c (build_common_decl): Also update DECL_MODE,
and DECL_SIZE when encountering a larger common block and call
layout_decl.
2010-02-24 Tobias Burnus <burnus@net-b.de>
PR fortran/43042

View file

@ -1,5 +1,5 @@
/* Common block and equivalence list handling
Copyright (C) 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009
Copyright (C) 2000, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
Contributed by Canqun Yang <canqun@nudt.edu.cn>
@ -399,8 +399,11 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
if (strcmp (com->name, BLANK_COMMON_NAME))
gfc_warning ("Named COMMON block '%s' at %L shall be of the "
"same size", com->name, &com->where);
DECL_SIZE (decl) = TYPE_SIZE (union_type);
DECL_SIZE_UNIT (decl) = size;
DECL_MODE (decl) = TYPE_MODE (union_type);
TREE_TYPE (decl) = union_type;
layout_decl (decl, 0);
}
}

View file

@ -1,5 +1,8 @@
2010-02-25 Jakub Jelinek <jakub@redhat.com>
PR debug/43166
* gfortran.dg/debug/pr43166.f: New test.
PR debug/43165
* gcc.dg/torture/pr43165.c: New test.

View file

@ -0,0 +1,14 @@
C PR debug/43166
C { dg-do compile }
C { dg-options "-O" }
SUBROUTINE FOO ()
INTEGER V1
COMMON // V1
END
SUBROUTINE BAR ()
INTEGER V0,V1,V2,V3
COMMON // V1(4),V2(85,4),V3
DO V3=1,V1(1)
V0=V2(V3,1)
END DO
END