0

What is the meaning of this code line?? and What is the solution for the error?? I have this issue in Sniper Simulator version 7.2 with Pin 3.5 on Linux Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux. My gcc version is 8.3.0 Besides This is not my codes...

The code is:

IALARM* ALARM_MANAGER::GenAddress(){

string hex = "0x";
BOOL ctxt = _control_chain->NeedContext();
if (_alarm_value.compare(0, 2, hex) == 0){
    //this is a raw address
    return new ALARM_ADDRESS(_alarm_value,_tid,_count,ctxt,this);
}


if (_alarm_value.find("+",0) == string::npos){
    //this is a symbol
    return new ALARM_SYMBOL(_alarm_value,_tid,_count,ctxt,this);
}

else{
    vector<string> tokens;
    PARSER::SplitArgs("+",_alarm_value,tokens);
    return new ALARM_IMAGE(tokens[0],tokens[1],_tid,_count,ctxt,this);
}

The error is:

alarm_manager.cpp:137:67: error: ‘new’ of type ‘CONTROLLER::ALARM_SYMBOL’ with extended alignment 64 [-Werror=aligned-new=]
     return new ALARM_SYMBOL(_alarm_value,_tid,_count,ctxt,this);
                                                               ^
alarm_manager.cpp:157:64: note: uses ‘void* operator new(size_t)’, which does not have an alignment parameter
alarm_manager.cpp:157:64: note: use ‘-faligned-new’ to enable C++17 over-aligned new support
ahmad sedigh
  • 81
  • 1
  • 8
  • You didn't post/read the full error messages. The solution is exactly int he two `note` messages after this error. – KamilCuk Oct 20 '19 at 16:08
  • Possible duplicate of [gcc over-aligned new support (alignas )](https://stackoverflow.com/questions/49373287/gcc-over-aligned-new-support-alignas) – KamilCuk Oct 20 '19 at 16:08
  • Thanks @KamilCuk , but i dont know how to solve the problem as you said by the instructions of the notes. Besides i have investigated the make files and CXXFLAGS and i have done any recommendation online but the problem is still there. – ahmad sedigh Oct 20 '19 at 16:32
  • `use ‘-faligned-new’ to enable C++17 over-aligned new support` – KamilCuk Oct 20 '19 at 17:00
  • Sorry but Where i should use that? in makefile i don't see such a thing but in alarm_manager.cpp at CXXFLAGS i added the 'faligned-new' but it didn't work – ahmad sedigh Oct 20 '19 at 20:42
  • You should use that with the compiler options you are passing to your compiler. What (if any) [build system](https://en.wikipedia.org/wiki/List_of_build_automation_software) are you using? You mentioned a `makefile` if that is a hand-written makefile, you have to modify it, but most makefiles are autogenerated by tools like `cmake` or `automake` or `configure`-like scripts. How do you compiler that "Sniper Simulator" project? – KamilCuk Oct 20 '19 at 20:54
  • Sniper Simulator is an open source multi-core simulator which i compile it for the first time according to the manual by changing directory to the simulator directory and writing make in the terminal. http://snipersim.com/documents/sniper-manual.pdf – ahmad sedigh Oct 20 '19 at 21:20
  • Thanks @KamilCuk i found the related Makefile and added the flag and it is solved. – ahmad sedigh Oct 24 '19 at 23:29

1 Answers1

0

As Kamil said it gets solved by adding -faligned-new to the relative makefile.

use ‘-faligned-new’ to enable C++17 over-aligned new support
ahmad sedigh
  • 81
  • 1
  • 8