Backported from mainline
2019-02-14 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/89354
+ * combine.c (make_extraction): Punt if extraction_mode is narrower
+ than len bits.
+
PR tree-optimization/89314
* fold-const.c (fold_binary_loc): Cast strlen argument to
const char * before dereferencing it. Formatting fixes.
&& GET_MODE_SIZE (extraction_mode) < GET_MODE_SIZE (mode))
extraction_mode = mode;
+ /* Punt if len is too large for extraction_mode. */
+ if (len > GET_MODE_PRECISION (extraction_mode))
+ return NULL_RTX;
+
if (!MEM_P (inner))
wanted_inner_mode = wanted_inner_reg_mode;
else
Backported from mainline
2019-02-14 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/89354
+ * gcc.dg/pr89354.c: New test.
+
PR tree-optimization/89314
* gcc.dg/pr89314.c: New test.
--- /dev/null
+/* PR rtl-optimization/89354 */
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-msse2" { target sse2_runtime } } */
+
+static unsigned long long q = 0;
+
+__attribute__((noinline, noclone)) static void
+foo (void)
+{
+ q = (q & ~0x1ffffffffULL) | 0x100000000ULL;
+}
+
+int
+main ()
+{
+ __asm volatile ("" : "+m" (q));
+ foo ();
+ if (q != 0x100000000ULL)
+ __builtin_abort ();
+ return 0;
+}