https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96946
Bug ID: 96946
Summary: std::shared_ptr makes an "unrelated cast" that causes
Clang's Control Flow Integrity sanitiser to crash
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: cjdb.ns at gmail dot com
Target Milestone: ---
Created attachment 49186
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49186&action=edit
cfi-error temps
# Compiler details
Ubuntu clang version
11.0.0-++20200829062559+2c6a593b5e1-1~exp1~20200829163219.75
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
# System details
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal
# Compiler configuration
Unknown: compiler obtained from apt.llvm.org.
# Build trigger
clang++ -std=c++14 -flto -fvisibility=hidden -g -fsanitize=cfi-unrelated-cast
cfi-error.cpp
# Compiler output
Nothing, builds fine.
# Run-time output
$ ./a.out
Illegal instruction
# Thanks
Martin Hořeňovský distilled this from a Catch2 bug to a minimal repro that
exposes it's embedded in libstdc++'s shared_ptr.