Hi!

The ICE here is when calling multiple_p with GET_MODE_BITSIZE (BLKmode),
so SIGFPE because it is 0.  BLKmode can leak into the debug stmts through
generic vectors without HW support, but doing say (plus:BLK ...) etc.
just doesn't look like a valid RTL, so instead of just not trying to subreg
it and not call multiple_p, this patch punts when unary/binary/ternary
ops have BLKmode.

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

2018-01-03  Jakub Jelinek  <ja...@redhat.com>

        PR debug/83621
        * cfgexpand.c (expand_debug_expr): Return NULL if mode is
        BLKmode for ternary, binary or unary expressions.

        * gcc.dg/pr83621.c: New test.

--- gcc/cfgexpand.c.jj  2018-01-03 10:19:54.000000000 +0100
+++ gcc/cfgexpand.c     2018-01-03 16:56:28.375179714 +0100
@@ -4208,6 +4208,8 @@ expand_debug_expr (tree exp)
 
     binary:
     case tcc_binary:
+      if (mode == BLKmode)
+       return NULL_RTX;
       op1 = expand_debug_expr (TREE_OPERAND (exp, 1));
       if (!op1)
        return NULL_RTX;
@@ -4232,6 +4234,8 @@ expand_debug_expr (tree exp)
 
     unary:
     case tcc_unary:
+      if (mode == BLKmode)
+       return NULL_RTX;
       inner_mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)));
       op0 = expand_debug_expr (TREE_OPERAND (exp, 0));
       if (!op0)
--- gcc/testsuite/gcc.dg/pr83621.c.jj   2018-01-03 17:01:21.244249712 +0100
+++ gcc/testsuite/gcc.dg/pr83621.c      2018-01-03 17:00:56.414243769 +0100
@@ -0,0 +1,12 @@
+/* PR debug/83621 */
+/* { dg-do compile } */
+/* { dg-options "-O -g" } */
+
+typedef int __attribute__ ((__vector_size__ (64))) V;
+V v;
+
+void
+foo ()
+{
+  V u = v >> 1;
+}

        Jakub

Reply via email to