abseil / abseil/abseil-cpp

[Bug]: Sanitizer options may disagree between library and user leading to ODR violations

Đang mở
#1,708 4 bình luận 4 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
C++
Star
18.1k
Fork
3.2k
Merge trung bình
20 giờ 36 phút
Pull request đã merge (30 ngày)
1

Mô tả

### Describe the issue

I got an ODR violation stemming from compiling the library without sanitizers and linking against it from code that is compiled with sanitizers enabled. The definition and behavior of some data structures (such as `raw_hash_set`) changes according to `ABSL_HAVE_ADDRESS_SANITIZER` or `ABSL_HAVE_MEMORY_SANITIZER`, and these detect the sanitizer state in the translation unit into which they're included, so ODR violations ensue.

I think perhaps the sanitizer state of the library needs to be "frozen" at build time and propagated as build flags to consumers a-la pkg-config, rather than relying on it matching between library and user.

### Steps to reproduce the problem

Compile the abseil library with sanitizers disabled, link against it from a translation unit in which sanitizers are enabled, try to insert into e.g. an `absl::flat_hash_map`.

### What version of Abseil are you using?

I tried to upgrade our abseil dependency from `20220623.0` to `20230125.3` and ran into the above issue.

### What operating system and version are you using?

Linux/debian-10

### What compiler and version are you using?

clang-16

### What build system are you using?

cmake 3.27.9, and I depend on Abseil through Conan.

### Additional context

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.