https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98160
--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
New reduced test-case:
$ cat 1.ii
namespace xercesc_2_5 {
class MemoryManager;
class XMemory {
void *operator new(unsigned long, MemoryManager *);
};
class MemoryManager {
public:
virtual void *allocate();
};
void *XMemory::operator new(unsigned long, MemoryManager *manager) {
long headerSize(sizeof(MemoryManager));
void *block = manager->allocate();
return block + headerSize;
}
} // namespace xercesc_2_5
$ cat 2.ii
namespace xercesc_2_5 {
class MemoryManager;
class XMemory {
public:
void *operator new(unsigned long, MemoryManager *);
void operator delete(void *, MemoryManager *);
};
class XMLPlatformUtils {
public:
static MemoryManager *fgMemoryManager;
};
class ValueStackOf : public XMemory {
public:
ValueStackOf(int, bool);
};
class XPathMatcherStack {
XPathMatcherStack();
ValueStackOf *fContextStack;
};
XPathMatcherStack::XPathMatcherStack()
: fContextStack(new (XMLPlatformUtils::fgMemoryManager)
ValueStackOf(8, XMLPlatformUtils::fgMemoryManager)) {}
} // namespace xercesc_2_5
$ g++ 1.ii 2.ii -O2 -flto=16 -shared
1.ii: In static member function 'static void* xercesc_2_5::XMemory::operator
new(long unsigned int, xercesc_2_5::MemoryManager*)':
1.ii:13:16: warning: pointer of type 'void *' used in arithmetic
[-Wpointer-arith]
13 | return block + headerSize;
| ~~~~~~^~~~~~~~~~~~
during RTL pass: expand
2.ii: In member function '__ct_base ':
2.ii:22:74: internal compiler error: Segmentation fault
22 | ValueStackOf(8,
XMLPlatformUtils::fgMemoryManager)) {}
|
^
0xcce44f crash_signal
/home/marxin/Programming/gcc/gcc/toplev.c:327
0x81da08 tree_check(tree_node*, char const*, int, char const*, tree_code)
/home/marxin/Programming/gcc/gcc/tree.h:3337
0x81da08 warn_dealloc_offset
/home/marxin/Programming/gcc/gcc/builtins.c:13413
0x836127 maybe_emit_free_warning(tree_node*)
/home/marxin/Programming/gcc/gcc/builtins.c:13586
0x84545e initialize_argument_information
/home/marxin/Programming/gcc/gcc/calls.c:2629
0x84545e expand_call(tree_node*, rtx_def*, int)
/home/marxin/Programming/gcc/gcc/calls.c:4009
0x978104 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
/home/marxin/Programming/gcc/gcc/expr.c:11276
0x8590cd expand_expr
/home/marxin/Programming/gcc/gcc/expr.h:282
0x8590cd expand_call_stmt
/home/marxin/Programming/gcc/gcc/cfgexpand.c:2831
0x8590cd expand_gimple_stmt_1
/home/marxin/Programming/gcc/gcc/cfgexpand.c:3835
0x8590cd expand_gimple_stmt
/home/marxin/Programming/gcc/gcc/cfgexpand.c:3999
0x85e5fa expand_gimple_basic_block
/home/marxin/Programming/gcc/gcc/cfgexpand.c:6036
0x8600b6 execute
/home/marxin/Programming/gcc/gcc/cfgexpand.c:6720
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
make: *** [/tmp/cc3Mo9q4.mk:2: /tmp/ccFzg763.ltrans0.ltrans.o] Error 1
lto-wrapper: fatal error: make returned 2 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status