/* PR debug/43051 */
|
/* PR debug/43051 */
|
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-options "-g" } */
|
/* { dg-options "-g" } */
|
|
|
extern void abort (void);
|
extern void abort (void);
|
|
|
static void __attribute__ ((noinline))
|
static void __attribute__ ((noinline))
|
foo (const char *x, long long y, int z)
|
foo (const char *x, long long y, int z)
|
{
|
{
|
asm volatile ("" : : "r" (x), "r" ((int) y), "r" (z) : "memory");
|
asm volatile ("" : : "r" (x), "r" ((int) y), "r" (z) : "memory");
|
}
|
}
|
|
|
struct S
|
struct S
|
{
|
{
|
struct S *n;
|
struct S *n;
|
int v;
|
int v;
|
};
|
};
|
|
|
struct S a[10];
|
struct S a[10];
|
|
|
struct S * __attribute__ ((noinline))
|
struct S * __attribute__ ((noinline))
|
bar (struct S *c, int v, struct S *e)
|
bar (struct S *c, int v, struct S *e)
|
{
|
{
|
#ifdef __i386__
|
#ifdef __i386__
|
register int si asm ("esi"), di asm ("edi"), bx
|
register int si asm ("esi"), di asm ("edi"), bx
|
# if !defined (__pic__) && !defined (__APPLE__)
|
# if !defined (__pic__) && !defined (__APPLE__)
|
asm ("ebx")
|
asm ("ebx")
|
# endif
|
# endif
|
;
|
;
|
asm volatile ("" : "=r" (si), "=r" (di), "=r" (bx));
|
asm volatile ("" : "=r" (si), "=r" (di), "=r" (bx));
|
#endif
|
#endif
|
while (c < e)
|
while (c < e)
|
{
|
{
|
foo ("c", (__UINTPTR_TYPE__) c, 0); /* { dg-final { gdb-test 34 "c" "\&a\[0\]" } } */
|
foo ("c", (__UINTPTR_TYPE__) c, 0); /* { dg-final { gdb-test 34 "c" "\&a\[0\]" } } */
|
foo ("v", v, 1); /* { dg-final { gdb-test 35 "v" "1" } } */
|
foo ("v", v, 1); /* { dg-final { gdb-test 35 "v" "1" } } */
|
foo ("e", (__UINTPTR_TYPE__) e, 2); /* { dg-final { gdb-test 36 "e" "\&a\[1\]" } } */
|
foo ("e", (__UINTPTR_TYPE__) e, 2); /* { dg-final { gdb-test 36 "e" "\&a\[1\]" } } */
|
if (c->v == v)
|
if (c->v == v)
|
return c;
|
return c;
|
foo ("c", (__UINTPTR_TYPE__) c, 3); /* { dg-final { gdb-test 39 "c" "\&a\[0\]" } } */
|
foo ("c", (__UINTPTR_TYPE__) c, 3); /* { dg-final { gdb-test 39 "c" "\&a\[0\]" } } */
|
foo ("v", v, 4); /* { dg-final { gdb-test 40 "v" "1" } } */
|
foo ("v", v, 4); /* { dg-final { gdb-test 40 "v" "1" } } */
|
foo ("e", (__UINTPTR_TYPE__) e, 5); /* { dg-final { gdb-test 41 "e" "\&a\[1\]" } } */
|
foo ("e", (__UINTPTR_TYPE__) e, 5); /* { dg-final { gdb-test 41 "e" "\&a\[1\]" } } */
|
c++;
|
c++;
|
}
|
}
|
#ifdef __i386__
|
#ifdef __i386__
|
asm volatile ("" : : "r" (si), "r" (di), "r" (bx));
|
asm volatile ("" : : "r" (si), "r" (di), "r" (bx));
|
#endif
|
#endif
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int
|
int
|
main ()
|
main ()
|
{
|
{
|
asm volatile ("" : : "r" (&a[0]) : "memory");
|
asm volatile ("" : : "r" (&a[0]) : "memory");
|
if (bar (&a[a[0].v], a[0].v + 1, &a[a[0].v + 1]))
|
if (bar (&a[a[0].v], a[0].v + 1, &a[a[0].v + 1]))
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|