Issue 243843
Summary [clang] malloc(): unaligned tcache chunk detected; when evaluating constexpr function in union declaration.
Labels clang
Assignees
Reporter Pedda1712
    The following:
```c++
union U;
constexpr int foo(U *u);
union U {
  int a = foo(this);
};
constexpr int foo(U *u) {
  *u = {.a = 0};	
  return u->a;
}
U u = {};
```
Crashes on trunk since clang-17, though only when compiling with --std=c++20 (omitting the flag leads to accepting the snippet!). (https://godbolt.org/z/qTT9PnKd5)

Backtrace:
```
malloc(): unaligned tcache chunk detected
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics --std=c++20 <source>
1.	<eof> parser at end of file
2.	Per-file LLVM IR generation
malloc(): unaligned tcache chunk detected
Program terminated with signal SIGABRT (6)
Compiler returned: 134
```

**This test case was generated by a fuzzer.**
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to