diff mbox

Don't ICE in dwarf2out_switch_section with -g0 (PR debug/52027)

Message ID 20120130134012.GE18768@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 30, 2012, 1:40 p.m. UTC
Hi!

dwarf2out_switch_text_section is called even when -g0 or when not generating
dwarf debug info, if we need to handle there unwinding stuff.
But with -g0 e.g. line info tables aren't initialized.  Already a few lines
above this spot we guard it with cold_text_section != NULL, so this patch
just adds the same check to another needed spot.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2012-01-30  Jakub Jelinek  <jakub@redhat.com>

	PR debug/52027
	* dwarf2out.c (dwarf2out_switch_text_section): Don't call
	set_cur_line_info_table if not emitting debug info.

	* gcc.dg/tree-prof/pr52027.c: New test.


	Jakub

Comments

Richard Biener Jan. 30, 2012, 1:41 p.m. UTC | #1
On Mon, Jan 30, 2012 at 2:40 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> dwarf2out_switch_text_section is called even when -g0 or when not generating
> dwarf debug info, if we need to handle there unwinding stuff.
> But with -g0 e.g. line info tables aren't initialized.  Already a few lines
> above this spot we guard it with cold_text_section != NULL, so this patch
> just adds the same check to another needed spot.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2012-01-30  Jakub Jelinek  <jakub@redhat.com>
>
>        PR debug/52027
>        * dwarf2out.c (dwarf2out_switch_text_section): Don't call
>        set_cur_line_info_table if not emitting debug info.
>
>        * gcc.dg/tree-prof/pr52027.c: New test.
>
> --- gcc/dwarf2out.c.jj  2012-01-26 09:22:21.000000000 +0100
> +++ gcc/dwarf2out.c     2012-01-30 12:09:42.186932405 +0100
> @@ -1177,7 +1177,8 @@ dwarf2out_switch_text_section (void)
>
>   var_location_switch_text_section ();
>
> -  set_cur_line_info_table (sect);
> +  if (cold_text_section != NULL)
> +    set_cur_line_info_table (sect);
>  }
>
>  /* And now, the subset of the debugging information support code necessary
> --- gcc/testsuite/gcc.dg/tree-prof/pr52027.c.jj 2012-01-30 12:14:37.073184372 +0100
> +++ gcc/testsuite/gcc.dg/tree-prof/pr52027.c    2012-01-30 12:15:08.042005858 +0100
> @@ -0,0 +1,19 @@
> +/* PR debug/52027 */
> +/* { dg-require-effective-target freorder } */
> +/* { dg-options "-O -freorder-blocks-and-partition -fno-reorder-functions" } */
> +
> +void
> +foo (int len)
> +{
> +  char array[1000];
> +  __builtin_memset (array, 0, len);
> +}
> +
> +int
> +main ()
> +{
> +  int i;
> +  for (i = 0; i < 1000; i++)
> +    foo (8);
> +  return 0;
> +}
>
>        Jakub
diff mbox

Patch

--- gcc/dwarf2out.c.jj	2012-01-26 09:22:21.000000000 +0100
+++ gcc/dwarf2out.c	2012-01-30 12:09:42.186932405 +0100
@@ -1177,7 +1177,8 @@  dwarf2out_switch_text_section (void)
 
   var_location_switch_text_section ();
 
-  set_cur_line_info_table (sect);
+  if (cold_text_section != NULL)
+    set_cur_line_info_table (sect);
 }
 
 /* And now, the subset of the debugging information support code necessary
--- gcc/testsuite/gcc.dg/tree-prof/pr52027.c.jj	2012-01-30 12:14:37.073184372 +0100
+++ gcc/testsuite/gcc.dg/tree-prof/pr52027.c	2012-01-30 12:15:08.042005858 +0100
@@ -0,0 +1,19 @@ 
+/* PR debug/52027 */
+/* { dg-require-effective-target freorder } */
+/* { dg-options "-O -freorder-blocks-and-partition -fno-reorder-functions" } */
+
+void
+foo (int len)
+{
+  char array[1000];
+  __builtin_memset (array, 0, len);
+}
+
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 1000; i++)
+    foo (8);
+  return 0;
+}