Search code examples
gccgcc-warning

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


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

Solution

  • 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