Commit e132653
Remove O1 from sanitizer feature flag defaults
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 bazelbuild#17355.
PiperOrigin-RevId: 507658773
Change-Id: I3aa4fb92a2dc271cbbedfc6f05e72a8a9b2aba091 parent 6b853e6 commit e132653
File tree
2 files changed
+0
-2
lines changed- tools
- cpp
- osx/crosstool
2 files changed
+0
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2566 | 2566 | | |
2567 | 2567 | | |
2568 | 2568 | | |
2569 | | - | |
2570 | 2569 | | |
2571 | 2570 | | |
2572 | 2571 | | |
| |||
0 commit comments