https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84550
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-02-28
Ever confirmed|0 |1
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I can reproduce it also with simplified:
struct A { int a; };
struct B { struct A *b; };
struct C { struct B *c; };
__attribute__((noipa)) bool
foo (struct A *p)
{
asm volatile ("" : : "r" (p) : "memory");
return false;
}
__attribute__((noipa)) bool
bar (struct A *p, void *q)
{
asm volatile ("" : : "r" (p), "r" (q) : "memory");
return false;
}
__attribute__((noipa)) int
baz (int x)
{
asm volatile ("" : : "r" (x) : "memory");
return 0;
}
__attribute__((noipa)) void
qux (struct C *p)
{
struct A *a;
bool b;
int c;
if (!p->c) __builtin_abort ();
a = p->c->b;
b = (a->a == 4)
&& (foo (a)
|| bar (a, 0));
c = baz (0);
baz (b);
}
int
main ()
{
struct A a = { 4 };
struct B b = { &a };
struct C c = { &b };
qux (&c);
return 0;
}
compiled with -g -O2 by trunk gcc on x86_64-linux. If I do
b qux
r
s
s
s
then I get:
(gdb) b qux
Breakpoint 1 at 0x400440: qux. (2 locations)
(gdb) r
Starting program: /home/jakub/src/gcc/obj08/gcc/vau
Missing separate debuginfos, use: dnf debuginfo-install
glibc-2.26-24.fc27.x86_64
Breakpoint 1, qux(C*) () at vau.c:33
33 if (!p->c) __builtin_abort ();
Missing separate debuginfos, use: dnf debuginfo-install
libgcc-7.3.1-2.fc27.x86_64
(gdb) s
34 a = p->c->b;
(gdb) s
36 b = (a->a == 4)
(gdb) s
[Inferior 1 (process 25359) exited normally]