ORC False Positive
- Dominant language
- C++
- Stars
- 99
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
The following code produces an ODRV according to ORC, even though the symbol names are clearly different in the runtime:
```cpp
#include
template
T my_function() {
struct internal_type {
T _value{M_PI};
};
internal_type x;
std::cout << typeid(x).name() << '\n';
return x._value;
}
int main(int argv, char** argc) {
std::cout << "f: " << my_function() << '\n';
std::cout << "d: " << my_function() << '\n';
}
```
Then:
- `clang++ -c -g main.cpp -o main.o --std=c++17`
- `ORC_STANDALONE_MODE=1 orc main.o`
The report says:
```
error: ODRV (structure:byte_size); 2 conflicts with `container_type`
calling_convention: pass by value; 5 (0x5)
name: container_type
byte_size: 8 (0x8)
symbol defintion location(s):
odrv.cpp:4 (used by `odrv.o` and 0 others)
calling_convention: pass by value; 5 (0x5)
name: container_type
byte_size: 4 (0x4)
symbol defintion location(s):
odrv.cpp:4 (used by `odrv.o` and 0 others)
ORC complete.
1 ODRV(s) reported
1 object file(s) processed
3786 dies processed
3611 dies skipped (95.38%)
172 unique symbols
```
But the output of the program shows different symbol names between the two instances of `internal_type`:
```
f: Z11my_functionIfET_vE13internal_type
3.14159
d: Z11my_functionIdET_vE13internal_type
3.14159
```
Contributor guide
Assessment
This issue has not been assessed yet.