Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove O1 from sanitizer feature flag defaults (#17439)
This PR removes `-O1` from the current set of sanitizer related feature flags defaults. **Context and Repro** 1. Heap buffer overflow in the following code block is not caught by asan. example.cc ``` #include <cstdlib> int main(int argc, char **argv) { int *array = new int[100]; array[0] = 0; int res = array[argc + 100]; // BOOM delete [] array; return res; } ``` BUILD ``` cc_binary( name = 'example', srcs = ['example.cc'], features = ['asan'], ) ``` execute: ``` bazel run :example ``` **Expectation:** Address sanitizer should detect and report heap buffer overflow. But this doesn't happen in the above case. It is because of O1 being applied by default and since this is added at the last, it also overrides explicit copts passed(O0). It would be nice if the optimization level is a bit de-coupled from the default group here. Closes #17355. PiperOrigin-RevId: 507658773 Change-Id: I3aa4fb92a2dc271cbbedfc6f05e72a8a9b2aba09 Co-authored-by: Chirag Ramani <chirag.ramani7@gmail.com>
- Loading branch information