Hi!

On calls.c testcase on cris we ICE from prepare_call_arguments on
calls like
  typedef void (*T) ();
  ((T) 0x100000) ();
Calling cselib_lookup with VOIDmode can't do any good, but there is
not reason why we should cselib_lookup constants, we can just use them
as is.

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

2011-03-17  Jakub Jelinek  <ja...@redhat.com>

        PR debug/48163
        * var-tracking.c (prepare_call_arguments): If CALL target
        is a non-SYMBOL_REF CONSTANT_P, just add that into the list as
        pc instead of looking it up using cselib_lookup and use
        Pmode for it if x has VOIDmode.
        * dwarf2out.c (gen_subprogram_die): If also both first and
        second CONCAT arguments are VOIDmode, use mode of CONCAT itself.

--- gcc/var-tracking.c.jj       2011-03-17 09:37:59.000000000 +0100
+++ gcc/var-tracking.c  2011-03-17 12:45:18.000000000 +0100
@@ -5807,7 +5807,16 @@ prepare_call_arguments (basic_block bb, 
   if (GET_CODE (x) == CALL && MEM_P (XEXP (x, 0)))
     {
       x = XEXP (XEXP (x, 0), 0);
-      if (GET_CODE (x) != SYMBOL_REF)
+      if (GET_CODE (x) == SYMBOL_REF)
+       /* Don't record anything.  */;
+      else if (CONSTANT_P (x))
+       {
+         x = gen_rtx_CONCAT (GET_MODE (x) == VOIDmode ? Pmode : GET_MODE (x),
+                             pc_rtx, x);
+         call_arguments
+           = gen_rtx_EXPR_LIST (VOIDmode, x, call_arguments);
+       }
+      else
        {
          cselib_val *val = cselib_lookup (x, GET_MODE (x), 0, VOIDmode);
          if (val && cselib_preserved_value_p (val))
--- gcc/dwarf2out.c.jj  2011-03-17 12:07:01.000000000 +0100
+++ gcc/dwarf2out.c     2011-03-17 12:54:51.000000000 +0100
@@ -19479,7 +19479,11 @@ gen_subprogram_die (tree decl, dw_die_re
                         == REGNO (XEXP (XEXP (XEXP (next_arg, 0), 0), 0)))
                    next_arg = XEXP (next_arg, 1);
                  if (mode == VOIDmode)
-                   mode = GET_MODE (XEXP (XEXP (arg, 0), 0));
+                   {
+                     mode = GET_MODE (XEXP (XEXP (arg, 0), 0));
+                     if (mode == VOIDmode)
+                       mode = GET_MODE (XEXP (arg, 0));
+                   }
                  if (GET_MODE_CLASS (mode) != MODE_INT
                      || GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE)
                    continue;

        Jakub

Reply via email to