Commit 06796564 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 7d5d39bb
2010-02-25 Jakub Jelinek <jakub@redhat.com> 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 PR debug/43165
* cfgexpand.c (expand_debug_expr): Don't call simplify_gen_subreg * cfgexpand.c (expand_debug_expr): Don't call simplify_gen_subreg
if bitpos isn't multiple of mode's bitsize. if bitpos isn't multiple of mode's bitsize.
......
...@@ -2316,7 +2316,11 @@ expand_debug_expr (tree exp) ...@@ -2316,7 +2316,11 @@ expand_debug_expr (tree exp)
else else
op0 = copy_rtx (op0); 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)); gcc_assert (MEM_P (op0));
op0 = adjust_address_nv (op0, mode, 0); op0 = adjust_address_nv (op0, mode, 0);
......
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> 2010-02-24 Tobias Burnus <burnus@net-b.de>
PR fortran/43042 PR fortran/43042
......
/* Common block and equivalence list handling /* 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. Free Software Foundation, Inc.
Contributed by Canqun Yang <canqun@nudt.edu.cn> 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) ...@@ -399,8 +399,11 @@ build_common_decl (gfc_common_head *com, tree union_type, bool is_init)
if (strcmp (com->name, BLANK_COMMON_NAME)) if (strcmp (com->name, BLANK_COMMON_NAME))
gfc_warning ("Named COMMON block '%s' at %L shall be of the " gfc_warning ("Named COMMON block '%s' at %L shall be of the "
"same size", com->name, &com->where); "same size", com->name, &com->where);
DECL_SIZE (decl) = TYPE_SIZE (union_type);
DECL_SIZE_UNIT (decl) = size; DECL_SIZE_UNIT (decl) = size;
DECL_MODE (decl) = TYPE_MODE (union_type);
TREE_TYPE (decl) = union_type; TREE_TYPE (decl) = union_type;
layout_decl (decl, 0);
} }
} }
......
2010-02-25 Jakub Jelinek <jakub@redhat.com> 2010-02-25 Jakub Jelinek <jakub@redhat.com>
PR debug/43166
* gfortran.dg/debug/pr43166.f: New test.
PR debug/43165 PR debug/43165
* gcc.dg/torture/pr43165.c: New test. * gcc.dg/torture/pr43165.c: New test.
......
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment