Commit 4f353581 by Jakub Jelinek

re PR middle-end/77718 (expand_builtin_memcmp swaps args)

	PR target/77718
	* builtins.c (expand_builtin_memcmp): Formatting fix.

	* gcc.c-torture/execute/pr77718.c: New test.

From-SVN: r242007
parent 2e955d50
2016-11-09 Jakub Jelinek <jakub@redhat.com> 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 * flag-types.h (enum sanitize_code): Add SANITIZE_SHIFT_BASE
and SANITIZE_SHIFT_EXPONENT, change SANITIZE_SHIFT to bitwise and SANITIZE_SHIFT_EXPONENT, change SANITIZE_SHIFT to bitwise
or of them, renumber other enumerators. or of them, renumber other enumerators.
...@@ -5059,7 +5062,8 @@ ...@@ -5059,7 +5062,8 @@
2016-09-29 Bernd Schmidt <bschmidt@redhat.com> 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. result is only being compared with zero.
2016-09-29 Marek Polacek <polacek@redhat.com> 2016-09-29 Marek Polacek <polacek@redhat.com>
2016-11-09 Jakub Jelinek <jakub@redhat.com> 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-3.c: New test.
* gcc.dg/ubsan/c99-shift-4.c: New test. * gcc.dg/ubsan/c99-shift-4.c: New test.
* gcc.dg/ubsan/c99-shift-5.c: New test. * gcc.dg/ubsan/c99-shift-5.c: New test.
......
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment