public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix segfault in rtl_for_decl_location
@ 2004-10-24  0:28 Jakub Jelinek
  2004-10-24  9:41 ` James A. Morrison
  2004-10-25  6:10 ` Mark Mitchell
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Jelinek @ 2004-10-24  0:28 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc-patches

Hi!

The attached testcase causes segfault in rtl_for_decl_location
on x86_64-redhat-linux with -O{2,3} -g.
The bug was introduced by the PR debug/15860 patch, before that
DECL_INCOMING_RTL just caused rtl to not be set (i.e. left
NULL or is_pseudo_reg ()) and later code dealt with that.

The following patch fixes that, ok to commit to HEAD/3.4?

2004-10-23  Jakub Jelinek  <jakub@redhat.com>

	* dwarf2out.c (rtl_for_decl_location): Avoid segfault if
	DECL_INCOMING_RTL is NULL.

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

--- gcc/dwarf2out.c.jj	2004-10-18 14:33:33.000000000 +0200
+++ gcc/dwarf2out.c	2004-10-23 23:46:17.810003735 +0200
@@ -9480,7 +9480,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))
--- gcc/testsuite/gcc.dg/debug/20041023-1.c.jj	2004-10-23 23:48:23.154745859 +0200
+++ gcc/testsuite/gcc.dg/debug/20041023-1.c	2004-10-23 22:24:45.000000000 +0200
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+static void
+foo (unsigned char x)
+{
+  unsigned char a[5 + x];
+}
+
+void
+bar (void)
+{
+  foo (80);
+}

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix segfault in rtl_for_decl_location
  2004-10-24  0:28 [PATCH] Fix segfault in rtl_for_decl_location Jakub Jelinek
@ 2004-10-24  9:41 ` James A. Morrison
  2004-10-24 17:03   ` Jakub Jelinek
  2004-10-25  6:10 ` Mark Mitchell
  1 sibling, 1 reply; 4+ messages in thread
From: James A. Morrison @ 2004-10-24  9:41 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Henderson, gcc-patches


 Does this also fix PR18067?

-- 
Thanks,
Jim

http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix segfault in rtl_for_decl_location
  2004-10-24  9:41 ` James A. Morrison
@ 2004-10-24 17:03   ` Jakub Jelinek
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2004-10-24 17:03 UTC (permalink / raw)
  To: James A. Morrison; +Cc: Richard Henderson, gcc-patches

On Sat, Oct 23, 2004 at 11:06:59PM -0400, James A. Morrison wrote:
> 
>  Does this also fix PR18067?

No, this is unrelated.

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix segfault in rtl_for_decl_location
  2004-10-24  0:28 [PATCH] Fix segfault in rtl_for_decl_location Jakub Jelinek
  2004-10-24  9:41 ` James A. Morrison
@ 2004-10-25  6:10 ` Mark Mitchell
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Mitchell @ 2004-10-25  6:10 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Richard Henderson, gcc-patches

Jakub Jelinek wrote:

>Hi!
>
>The attached testcase causes segfault in rtl_for_decl_location
>on x86_64-redhat-linux with -O{2,3} -g.
>The bug was introduced by the PR debug/15860 patch, before that
>DECL_INCOMING_RTL just caused rtl to not be set (i.e. left
>NULL or is_pseudo_reg ()) and later code dealt with that.
>
>The following patch fixes that, ok to commit to HEAD/3.4?
>  
>
OK.

-- 
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-10-25  3:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-24  0:28 [PATCH] Fix segfault in rtl_for_decl_location Jakub Jelinek
2004-10-24  9:41 ` James A. Morrison
2004-10-24 17:03   ` Jakub Jelinek
2004-10-25  6:10 ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).