[Bug c++/98413] New: ICE with placement new
475647575 at qq dot com
gcc-bugzilla@gcc.gnu.org
Mon Dec 21 15:14:51 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98413
Bug ID: 98413
Summary: ICE with placement new
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: 475647575 at qq dot com
Target Milestone: ---
// example program
#include <new>
struct A{
int m{};
};
template<class T>
void f(A *instance, T A::*member_pointer)
{
new (&(instance->*member_pointer)) T{0};
}
int main()
{
A a;
f(&a, &A::m);
return 0;
}
-----------------------------------
error:
<source>: In instantiation of 'void f(A*, T A::*) [with T = int]':
<source>:14:16: required from here
<source>:8:5: internal compiler error: tree check: expected integer_type or
enumeral_type or boolean_type or real_type or fixed_point_type, have
offset_type in get_offset_range, at builtins.c:5108
8 | new (&(instance->*member_pointer)) T{0};
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x1cb9849 internal_error(char const*, ...)
???:0
0x673fd7 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
???:0
0xabc5d8 compute_objsize(tree_node*, int, access_ref*, range_query*)
???:0
0x7ee121 build_new(unsigned int, vec<tree_node*, va_gc, vl_embed>**,
tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, int, int)
???:0
0x90fa2f instantiate_decl(tree_node*, bool, bool)
???:0
0x950f5b instantiate_pending_templates(int)
???:0
0x7c21b9 c_parse_final_cleanups()
???:0
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.
ASM generation compiler returned: 1
------------------------------------
gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/gcc11/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --disable-multilib --prefix=/gcc11
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201217 (experimental) (GCC)
-------------------------------------
exact gcc commit used:
https://github.com/gcc-mirror/gcc/commit/6f8486523f61bf0aa476dfa4197d1e3b71a0a8f3
This bug can be re-producted in godbolt:
https://godbolt.org/z/TeTbET
More information about the Gcc-bugs
mailing list