]> gcc.gnu.org Git - gcc.git/commitdiff
re PR debug/43166 (ICE in simplify_subreg on fortran code)
authorJakub Jelinek <jakub@redhat.com>
Thu, 25 Feb 2010 10:50:24 +0000 (11:50 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 25 Feb 2010 10:50:24 +0000 (11:50 +0100)
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

gcc/ChangeLog
gcc/cfgexpand.c
gcc/fortran/ChangeLog
gcc/fortran/trans-common.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/debug/pr43166.f [new file with mode: 0644]

index a8c96f2754c8e01319b4c97c1de3332b3d4d8cf2..c66acfa1914693bcb61e2ad042e1d62c4f5c7b3a 100644 (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.
index e60df8744822f37ffb8ee216757e051ad2b9ce87..7b8df04bed01603729b49de89c1fa3073a33c380 100644 (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);
index af4bf20d3f480b397db1f4e5cb3ce26194104cd8..08a6b6803305ea0f60211f788d5d7214cb0f459c 100644 (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
index 62a2e018210ff01158c32e3d31a0f5016c710dfd..844ac1d26745f97b7cd1bd66f1a40000411d06e0 100644 (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);
        }
      }
 
index 14685fdad5e7689ba02e392359dbfb4e1f6ad065..c3fbe6646b5367f0984510690ea1d8430651f919 100644 (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.
 
diff --git a/gcc/testsuite/gfortran.dg/debug/pr43166.f b/gcc/testsuite/gfortran.dg/debug/pr43166.f
new file mode 100644 (file)
index 0000000..a314615
--- /dev/null
@@ -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
This page took 0.085422 seconds and 5 git commands to generate.