runtimeverification / rv-predict

Code for improved rv-predict and installer
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

`rvpc++` Compilation issue with `-O3` flag #1025

Open shd101wyy opened 5 years ago

shd101wyy commented 5 years ago

Example code:

#include <iostream>
using namespace std;

class Base
 {
 public:
    virtual void function1() {cout<<"Base :: function1()\n";};
    virtual void function2() {cout<<"Base :: function2()\n";};
    virtual ~Base(){};
};

class D1: public Base
{
public:
   ~D1(){};
   virtual void function1() { cout<<"D1 :: function1()\n";};
};

class D2: public Base
{
public:
   ~D2(){};
   virtual void function2() { cout<< "D2 :: function2\n";};
};

int main()
{
  D1 *d = new D1;;
  Base *b = d;

  b->function1();
  b->function2();

  delete (b);

  return (0);
}

It compiled with rvpc++ fine, but failed with rvpc++ and -O3 flag:

➜  logging-test rvpc++ simple.cpp 
➜  logging-test rvpc++ simple.cpp -O3
/tmp/simple-6a473c.o: In function `Base::Base()':
/home/yiyiwang/logging-test/simple.cpp:4: undefined reference to `__rvpredict_vptr_update'
/tmp/simple-6a473c.o: In function `D1::D1()':
/home/yiyiwang/logging-test/simple.cpp:12: undefined reference to `__rvpredict_vptr_update'
/tmp/simple-6a473c.o: In function `main':
/home/yiyiwang/logging-test/simple.cpp:31: undefined reference to `__rvpredict_vptr_load'
/home/yiyiwang/logging-test/simple.cpp:32: undefined reference to `__rvpredict_vptr_load'
/home/yiyiwang/logging-test/simple.cpp:34: undefined reference to `__rvpredict_vptr_load'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
maya-rv commented 5 years ago

see #831