diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index c62a966e9180126edc682ff933b3d46fb0a92c1e..02415cb1b5c3a0b9001fd6571a525cfc813ba6a4 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -6054,6 +6054,9 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
   location_t loc = EXPR_LOCATION (*expr_p);
   gimple_stmt_iterator gsi;
 
+  if (error_operand_p (*from_p) || error_operand_p (*to_p))
+    return GS_ERROR;
+
   gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
 	      || TREE_CODE (*expr_p) == INIT_EXPR);
 
diff --git a/gcc/testsuite/gcc.dg/redecl-23.c b/gcc/testsuite/gcc.dg/redecl-23.c
new file mode 100644
index 0000000000000000000000000000000000000000..425721df2ff4703285d325c4397003653b54ddf9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/redecl-23.c
@@ -0,0 +1,6 @@
+/* We used to ICE in the gimplifier, PR 106560. */
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+void **a; /* { dg-note "" } */
+void b() { void **c = a; }
+a; /* { dg-error "" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-24.c b/gcc/testsuite/gcc.dg/redecl-24.c
new file mode 100644
index 0000000000000000000000000000000000000000..f0f7a723ab81674d6390e31a8c056091a1144e05
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/redecl-24.c
@@ -0,0 +1,6 @@
+/* We used to ICE in the gimplifier, PR 106560 */
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+void **a, **b; /* { dg-note "" } */
+c(){b = a;}  
+a = /* { dg-error "" } */
diff --git a/gcc/testsuite/gcc.dg/redecl-25.c b/gcc/testsuite/gcc.dg/redecl-25.c
new file mode 100644
index 0000000000000000000000000000000000000000..4232e19d9a7cbabee663a97cacd27e646e35cf07
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/redecl-25.c
@@ -0,0 +1,9 @@
+/* We used to ICE in the gimplifier, PR 106560 */
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+void **a; /* { dg-note "" } */
+void b() {
+  void **c; 
+    c = a /* { dg-error "" } */
+}
+a; /* { dg-error "" } */