🌐 AI搜索 & 代理 主页
Skip to content

ORC False Positive #94

@fosterbrereton

Description

@fosterbrereton

The following code produces an ODRV according to ORC, even though the symbol names are clearly different in the runtime:

#include <iostream>

template<class T>
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<float>() << '\n';
    std::cout << "d: " << my_function<double>() << '\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<value_type>`
    calling_convention: pass by value; 5 (0x5)
    name: container_type<value_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<value_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

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions