<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/56265>56265</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            BOLT: instrumentation looses doubles in virtual overloaded functions
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          dmitriy-philimonov
      </td>
    </tr>
</table>

<pre>
    The small reproducer:
```cpp
#include <stdio.h>


class TProtocol {
public:
        virtual bool store(const char *from) = 0;
        virtual bool store(float from) = 0;
        virtual bool store(double from) = 0;
        virtual ~TProtocol() {}
};


class TProtocolText : public TProtocol {
public:
        bool store(const char *from) {
                printf("CONST CHAR*: '%s'\n", from);
                return true;
        }
        bool store(float from) {
                printf("FLOAT: %f\n", from);
                return true;
        }
        bool store(double from) {
                printf("DOUBLE: %f\n", from);
                return true;
        }
};

int main() {
        TProtocol *p = new TProtocolText();
        p->store("BOLT");
        p->store(1.2);
        p->store(3.55555555558787870);
        delete p;
        return 0;
}
```

Compile, run instrumentation:
```shell
$ g++ --version
g++ (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ -O3 main.cc -fno-reorder-blocks-and-partition -Wl,--emit-relocs
$ llvm-bolt --instrument a.out -o a.bolted --instrumentation-file=$HOME/bolt.profile --instrumentation-binpath=$HOME/a.bolted
$ ./a.out 
CONST CHAR*: 'BOLT'
DOUBLE: 1.200000
DOUBLE: 3.555556
$ ./a.bolted 
CONST CHAR*: 'BOLT'
DOUBLE: 0.000000
DOUBLE: 0.000000
```

As you can see, double passed to virtual functions, magically converts to zero.

* OS: Ubuntu 20.04.4 LTS, EulerOS 2.5
* Affected open source projects: MySQL server.
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