This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Yet another expand_debug_expr BLKmode fix (PR debug/83666)


Hi!

Another spot where we need to punt on BLKmode, otherwise we try to create
a subreg with BLKmode, or ZERO/SIGN_EXTEND with BLKmode.

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

Eventually, we should try to handle both hw and generic vectors in the debug
info better, but we'd need to discuss that with the GDB folks.  E.g.
we could lower debuginfo for the generic vectors during the vector lowering
pass into DEBUG_EXPRs representing individual elements kind like how SRA
splits arrays.

2018-01-04  Jakub Jelinek  <jakub@redhat.com>

	PR debug/83666
	* cfgexpand.c (expand_dbeug_expr) <case BIT_FIELD_REF>: Punt if mode
	is BLKmode and bitpos not zero or mode change is needed.

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

--- gcc/cfgexpand.c.jj	2018-01-03 16:56:28.375179714 +0100
+++ gcc/cfgexpand.c	2018-01-03 19:45:43.807687499 +0100
@@ -4560,7 +4560,7 @@ expand_debug_expr (tree exp)
 	if (maybe_lt (bitpos, 0))
           return NULL;
 
-	if (GET_MODE (op0) == BLKmode)
+	if (GET_MODE (op0) == BLKmode || mode == BLKmode)
 	  return NULL;
 
 	poly_int64 bytepos;
--- gcc/testsuite/gcc.dg/pr83666.c.jj	2018-01-03 19:47:46.370733409 +0100
+++ gcc/testsuite/gcc.dg/pr83666.c	2018-01-03 19:47:26.106725818 +0100
@@ -0,0 +1,28 @@
+/* PR debug/83666 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g --param=sccvn-max-scc-size=10 -Wno-psabi" } */
+
+typedef int __attribute__ ((vector_size (64))) V;
+
+int c, d;
+short e;
+V g;
+
+V
+bar (void)
+{
+  g[1] = d;
+  do
+    {
+      e += c;
+      g = g > 0;
+    }
+  while (g[1]);
+  return g;
+}
+
+void
+foo (void)
+{
+  int x = bar ()[3];
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]