llvm / llvm/llvm-project

llvm/tools/dsymutil/DebugMap.h:121:54: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]

Open
#188,977 0 comments 0 reactions 0 assignees View on GitHub
build-problem
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

from build.log:

error

```
FAILED: [code=1] tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinkerForBinary.cpp.o
/usr/bin/x86_64-pc-linux-gnu-g++ -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm_build-abi_x86_64.amd64/tools/dsymutil -I/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil -I/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm_build-abi_x86_64.amd64/include -I/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/include -O3 -pipe -march=alderlake -mabm -mno-cldemote -mno-kl -mno-pconfig -mno-sgx -mno-widekl -mshstk --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=30720 -fuse-linker-plugin -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -fgraphite-identity -floop-interchange -floop-strip-mine -floop-nest-optimize -ftree-loop-linear -ggdb3 -frecord-gcc-switches -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-dangling-pointer -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -std=c++17 -UNDEBUG -MD -MT tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinkerForBinary.cpp.o -MF tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinkerForBinary.cpp.o.d -o tools/dsymutil/CMakeFiles/dsymutil.dir/DwarfLinkerForBinary.cpp.o -c /var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp
In file included from /var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil/DwarfLinkerForBinary.h:13,
from /var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil/DwarfLinkerForBinary.cpp:9:
/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil/DebugMap.h: In member function ‘llvm::dsymutil::DebugMap::ObjectContainer& llvm::dsymutil::DebugMap::getObjects()’:
/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil/DebugMap.h:118:48: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
118 | return reinterpret_cast(Objects);
| ^~~~~~~
/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil/DebugMap.h: In member function ‘const llvm::dsymutil::DebugMap::ObjectContainer& llvm::dsymutil::DebugMap::getObjects() const’:
/var/tmp/portage/llvm-core/llvm-23.0.0.9999/work/llvm/tools/dsymutil/DebugMap.h:121:54: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
121 | return reinterpret_cast(Objects);
| ^~~~~~~
cc1plus: some warnings being treated as errors
```

llvm's commit: 06b057d2546ed64018b44df5ebe0e3ecd1c07b26

[build.log.zip](https://github.com/user-attachments/files/26303545/build.log.zip)

`g++ --version`

```
mainlaptop / # g++ --version
g++ (Gentoo 15.2.1_p20260214 p5) 15.2.1 20260214
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.