Commit 0244fc28 authored by ygribov's avatar ygribov

2014-10-20 Yury Gribov <y.gribov@samsung.com>

	Backported from mainline
	2014-05-30  Jakub Jelinek  <jakub@redhat.com>

	* c-c++-common/asan/misalign-1.c: New test.
	* c-c++-common/asan/misalign-2.c: New test.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@216459 138bc75d-0d04-0410-961f-82ee72b054a4
parent 5d9d140b
2014-10-20 Yury Gribov <y.gribov@samsung.com>
Backported from mainline
2014-05-30 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/asan/misalign-1.c: New test.
* c-c++-common/asan/misalign-2.c: New test.
2014-10-17 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/asan/instrument-with-calls-1.c: Add
......
/* { dg-do run { target { ilp32 || lp64 } } } */
/* { dg-options "-O2" } */
/* { dg-shouldfail "asan" } */
struct S { int i; } __attribute__ ((packed));
__attribute__((noinline, noclone)) int
foo (struct S *s)
{
return s->i;
}
__attribute__((noinline, noclone)) int
bar (int *s)
{
return *s;
}
__attribute__((noinline, noclone)) struct S
baz (struct S *s)
{
return *s;
}
int
main ()
{
struct T { char a[3]; struct S b[3]; char c; } t;
int v = 5;
struct S *p = t.b;
asm volatile ("" : "+rm" (p));
p += 3;
if (bar (&v) != 5) __builtin_abort ();
volatile int w = foo (p);
return 0;
}
/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
/* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #0 0x\[0-9a-f\]+ (in _*foo(\[^\n\r]*misalign-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*misalign-1.c:34|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
/* { dg-do run { target { ilp32 || lp64 } } } */
/* { dg-options "-O2" } */
/* { dg-shouldfail "asan" } */
struct S { int i; } __attribute__ ((packed));
__attribute__((noinline, noclone)) int
foo (struct S *s)
{
return s->i;
}
__attribute__((noinline, noclone)) int
bar (int *s)
{
return *s;
}
__attribute__((noinline, noclone)) struct S
baz (struct S *s)
{
return *s;
}
int
main ()
{
struct T { char a[3]; struct S b[3]; char c; } t;
int v = 5;
struct S *p = t.b;
asm volatile ("" : "+rm" (p));
p += 3;
if (bar (&v) != 5) __builtin_abort ();
volatile struct S w = baz (p);
return 0;
}
/* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
/* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #0 0x\[0-9a-f\]+ (in _*baz(\[^\n\r]*misalign-2.c:22|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*misalign-2.c:34|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
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