2016-11-09 Jakub Jelinek <jakub@redhat.com>
+ PR target/77718
+ * builtins.c (expand_builtin_memcmp): Formatting fix.
+
* flag-types.h (enum sanitize_code): Add SANITIZE_SHIFT_BASE
and SANITIZE_SHIFT_EXPONENT, change SANITIZE_SHIFT to bitwise
or of them, renumber other enumerators.
2016-09-29 Bernd Schmidt <bschmidt@redhat.com>
- * builtins.c (expand_builtin_memcmp): don't swap args unless
+ PR target/77718
+ * builtins.c (expand_builtin_memcmp): Don't swap args unless
result is only being compared with zero.
2016-09-29 Marek Polacek <polacek@redhat.com>
{
src_str = c_getstr (arg1);
if (src_str != NULL)
- std::swap (arg1_rtx, arg2_rtx);
+ std::swap (arg1_rtx, arg2_rtx);
}
/* If SRC is a string constant and block move would be done
2016-11-09 Jakub Jelinek <jakub@redhat.com>
+ PR target/77718
+ * gcc.c-torture/execute/pr77718.c: New test.
+
* gcc.dg/ubsan/c99-shift-3.c: New test.
* gcc.dg/ubsan/c99-shift-4.c: New test.
* gcc.dg/ubsan/c99-shift-5.c: New test.
--- /dev/null
+/* PR middle-end/77718 */
+
+char a[64] __attribute__((aligned (8)));
+
+__attribute__((noinline, noclone)) int
+foo (void)
+{
+ return __builtin_memcmp ("bbbbbb", a, 6);
+}
+
+__attribute__((noinline, noclone)) int
+bar (void)
+{
+ return __builtin_memcmp (a, "bbbbbb", 6);
+}
+
+int
+main ()
+{
+ __builtin_memset (a, 'a', sizeof (a));
+ if (((foo () < 0) ^ ('a' > 'b'))
+ || ((bar () < 0) ^ ('a' < 'b')))
+ __builtin_abort ();
+ return 0;
+}