Hi All,

As pointed to me by Jeff, after committing patch to fix PR88834, some
tests are failing for target rx-elf. This is because in
preferred_mem_scale_factor we end up with mem_mode which is BLKmode
and hence GET_MODE_UNIT_SIZE returns zero.

I have fixed this by checking for BLKmode. I believe this is the only
way we can have GET_MODE_UNIT_SIZE of 0. Otherwise, we can check for
GET_MODE_UNIT_SIZE of zero.

Bootstrapped and regression tested attached patch on x86_64-linux-gnu
with no new regressions. Is this OK for trunk?

Thanks,
Kugan

gcc/ChangeLog:

2019-06-17  Kugan Vivekanandarajah  <kugan.vivekanandara...@linaro.org>

    * tree-ssa-address.c (preferred_mem_scale_factor): Handle when
mem_mode is BLKmode.
From 5cd4ac35ce8006a6c407a2386175382f053dcdd3 Mon Sep 17 00:00:00 2001
From: Kugan Vivekanandarajah <kugan.vivekanandarajah@linaro.org>
Date: Sun, 16 Jun 2019 21:02:59 +1000
Subject: [PATCH] Fix ICE for rx-elf

Change-Id: I503b6b8316e7d11d63ec7749ff44dbc641078539
---
 gcc/tree-ssa-address.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index cdd432a..1dca779 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -1138,6 +1138,10 @@ preferred_mem_scale_factor (tree base, machine_mode mem_mode,
   addr_space_t as = TYPE_ADDR_SPACE (TREE_TYPE (base));
   unsigned int fact = GET_MODE_UNIT_SIZE (mem_mode);
 
+  /* for BLKmode, we cant do anything so return 1.  */
+  if (mem_mode == BLKmode)
+    return 1;
+
   /* Addressing mode "base + index".  */
   parts.index = integer_one_node;
   parts.base = integer_one_node;
-- 
2.7.4

Reply via email to