[Bug target/78460] [7 Regression] [SH] OOM building glibc string tst-cmp.c

2016-11-24 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78460

Oleg Endo  changed:

   What|Removed |Added

 CC||olegendo at gcc dot gnu.org

--- Comment #2 from Oleg Endo  ---
(In reply to Martin Liška from comment #1)
> 
> Apart from that, I wondering why there's no limit, as for instance:
> strncmp (left, right, 1000); emits battalion of instructions.

Oh yeah, that's PR 67712.

[Bug target/78460] [7 Regression] [SH] OOM building glibc string tst-cmp.c

2016-11-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78460

Martin Liška  changed:

   What|Removed |Added

   Keywords||memory-hog
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-11-22
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Martin Liška  ---
Simple test-case:
int foo(char *left, char *right)
{
  return strncmp (left, right, 4294967295U);
}

triggers ICE after I added:
diff --git a/gcc/config/sh/sh-mem.cc b/gcc/config/sh/sh-mem.cc
index f91afa5..018d8bb 100644
--- a/gcc/config/sh/sh-mem.cc
+++ b/gcc/config/sh/sh-mem.cc
@@ -364,6 +364,7 @@ sh_expand_cmpnstr (rtx *operands)
   rtx_code_label *L_end_loop_long = gen_label_rtx ();

   int bytes = INTVAL (operands[3]);
+  gcc_assert (bytes >= 0);
   int witers = bytes / 4;

   if (witers > 1)

Looks 'int' should be replaces with unsigned HOST_WIDE_INT, but still using a
cross compiler, where host is x86_64, I get:

(gdb) p debug_rtx(operands[3])
(const_int -1 [0x])
$1 = void

and thus unsigned HOST_WIDE_INT bytes = INTVAL (operands[3]);
is 18446744073709551615 (0x).

Apart from that, I wondering why there's no limit, as for instance:
strncmp (left, right, 1000); emits battalion of instructions.

[Bug target/78460] [7 Regression] [SH] OOM building glibc string tst-cmp.c

2016-11-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78460

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P4
   Target Milestone|--- |7.0