OSDN Git Service

* dwarf2out.c (rtl_for_decl_location): Avoid segfault if
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Oct 2004 21:43:11 +0000 (21:43 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Oct 2004 21:43:11 +0000 (21:43 +0000)
DECL_INCOMING_RTL is NULL.

* gcc.dg/debug/20041023-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89554 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/20041023-1.c [new file with mode: 0644]

index bcdfb1a..e8bdb1f 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * dwarf2out.c (rtl_for_decl_location): Avoid segfault if
+       DECL_INCOMING_RTL is NULL.
+
 2004-10-25  Steven Bosscher  <stevenb@suse.de>
 
        * timevar.def (TV_FIND_REFERENCED_VARS): New.
index f4c5974..a6b923c 100644 (file)
@@ -9807,7 +9807,8 @@ rtl_for_decl_location (tree decl)
          if (dmode == pmode)
            rtl = DECL_INCOMING_RTL (decl);
          else if (SCALAR_INT_MODE_P (dmode)
-                  && GET_MODE_SIZE (dmode) <= GET_MODE_SIZE (pmode))
+                  && GET_MODE_SIZE (dmode) <= GET_MODE_SIZE (pmode)
+                  && DECL_INCOMING_RTL (decl))
            {
              rtx inc = DECL_INCOMING_RTL (decl);
              if (REG_P (inc))
index 765daa2..19c32bb 100644 (file)
@@ -1,3 +1,7 @@
+2004-10-25  Jakub Jelinek  <jakub@redhat.com>
+
+       * gcc.dg/debug/20041023-1.c: New test.
+
 2004-10-25  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR middle-end/17407
diff --git a/gcc/testsuite/gcc.dg/debug/20041023-1.c b/gcc/testsuite/gcc.dg/debug/20041023-1.c
new file mode 100644 (file)
index 0000000..12b7cb9
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+static void
+foo (unsigned char x)
+{
+  unsigned char a[5 + x];
+}
+
+void
+bar (void)
+{
+  foo (80);
+}