https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127685
Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |slyfox at gcc dot gnu.org
--- Comment #8 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
I got re2 test failure. The reduced example is similar:
$ cat /tmp/a.cc
struct C {
bool m0(bool){return false;}
bool m1(bool){return false;}
bool bug(bool);
};
__attribute__((noipa))
bool C::bug(bool b){
static bool (C::*A[])(bool) = {
&C::m0,
&C::m1,
};
int index = 1 * b;
return (this->*A[index])(b);
}
int main() {
C o;
o.bug(false);
}
$ g++ -O1 /tmp/a.cc -o a -Wall && ./a
Segmentation fault (core dumped) ./a
Looks the same?
(gdb) disassemble _ZN1C3bugEb
Dump of assembler code for function _ZN1C3bugEb:
0x000000000000112a <+0>: push %rbp
0x000000000000112b <+1>: mov %rsp,%rbp
0x000000000000112e <+4>: movzbl %sil,%esi
0x0000000000001132 <+8>: mov $0x0,%eax
0x0000000000001137 <+13>: call *%rax
0x0000000000001139 <+15>: pop %rbp
0x000000000000113a <+16>: ret
End of assembler dump.