Skip to content

.bazelrc: Add ASan config - #460

Open
smcallis wants to merge 1 commit into
google:masterfrom
smcallis:add-asan-config
Open

.bazelrc: Add ASan config#460
smcallis wants to merge 1 commit into
google:masterfrom
smcallis:add-asan-config

Conversation

@smcallis

Copy link
Copy Markdown
Contributor

Enables ASAN builds with e.g. bazel -c opt --config=asan

@jmrjmr changed the title Add config for ASAN builds with bazel..bazelrc: Add ASan configOct 5, 2025

@jmrjmr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this to bazel.yml would be good, too, but can also be done separately.

Comment threadsrc/.bazelrc Outdated
build:asan --copt -DADDRESS_SANITIZER
build:asan --copt -D_GLIBCXX_SANITIZE_VECTOR
build:asan --copt -O1
build:asan --copt -g

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of these seem orthogonal and part of -c dbg.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can theoretically use this with -c opt or -c fastbuild too, it's probably wise to override them because if you have e.g. -O3 on and the compiler elides problematic reads/writes then you'll get false negatives.

Comment threadsrc/.bazelrc Outdated
Comment threadsrc/.bazelrc Outdated
Comment threadsrc/.bazelrc Outdated
Enables ASAN builds with e.g. bazel -c opt --config=asan <targets>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@smcallis@jmr