Patchwork [debug] : Fix PR 54177, Segfault in cselib_lookup due to NULL_RTX passed from vt_add_function_parameter

login
register
mail settings
Submitter Uros Bizjak
Date Aug. 7, 2012, 9:07 p.m.
Message ID <CAFULd4aJTkX6vBTvN5-GHMv5k-bbXCViD4_3CkhVwFE1OKNkjA@mail.gmail.com>
Download mbox | patch
Permalink /patch/175804/
State New
Headers show

Comments

Uros Bizjak - Aug. 7, 2012, 9:07 p.m.
Hello!

We can exit early from var_lowpart for matched modes. This avoids
situation, where var_lowpart tries to change

(gdb) p debug_rtx (incoming)
(concat:SC (reg:SF 48 $f16 [ x ])
    (reg:SF 49 $f17 [ x+4 ]))
$1 = void

to SCmode, and returning NULL_RTX, since the RTX is neither REG, neither MEM.

2012-08-07  Uros Bizjak  <ubizjak@gmail.com>

	PR debug/54177
	* var-tracking.c (var_lowpart): Exit early for matched modes.

Tested on x86_64-pc-linux-gnu {,-m32} and alphaev68-unknown-linux-gnu,
where the patch also fixes testsuite failure.

Patch was approved in the PR by Alexandre, and is committed to mainline SVN.

Uros.

Patch

Index: var-tracking.c
===================================================================
--- var-tracking.c	(revision 190150)
+++ var-tracking.c	(working copy)
@@ -5086,12 +5086,12 @@  var_lowpart (enum machine_mode mode, rtx loc)
 {
   unsigned int offset, reg_offset, regno;
 
+  if (GET_MODE (loc) == mode)
+    return loc;
+
   if (!REG_P (loc) && !MEM_P (loc))
     return NULL;
 
-  if (GET_MODE (loc) == mode)
-    return loc;
-
   offset = byte_lowpart_offset (mode, GET_MODE (loc));
 
   if (MEM_P (loc))