70

I have a C++ project that builds fine and without warnings with gcc 7.2 on x86 Linux and Windows, I needed to port it to an ARM device so I tried to crosscompile it with an "arm-linux-gnueabihf" gcc 7.2 that runs on my x86 machine, it builds but I get a lot of warnings of this kind

note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<P2d*, std::vector<P2d> >' changed in GCC 7.1
_M_realloc_insert(end(), __x);

and

/opt/armv7-gcc-2017/arm-linux-gnueabihf/include/c++/7.2.0/bits/vector.tcc:105:21: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<cpzparser::Anchor*, std::vector<cpzparser::Anchor> >' changed in GCC 7.1
    _M_realloc_insert(end(), std::forward<_Args>(__args)...);

or

/opt/armv7-gcc-2017/arm-linux-gnueabihf/include/c++/7.2.0/bits/vector.tcc:394:7: note: parameter passing for argument of type 'std::vector<cpzparser::PointEntity>::iterator {aka __gnu_cxx::__normal_iterator<cpzparser::PointEntity*, std::vector<cpzparser::PointEntity> >}' changed in GCC 7.1
       vector<_Tp, _Alloc>::

the generated executable seems to work fine but I am worried by the presence of all those warnings since I have no idea of what they mean.. any clue?

Cœur
  • 37,241
  • 25
  • 195
  • 267
woggioni
  • 1,261
  • 1
  • 9
  • 19

1 Answers1

83

That warning is telling you that there was a subtle ABI change (actually a conformance fix) between 6 and 7.1, such that libraries built with 6.x or earlier may not work properly when called from code built with 7.x (and vice-versa). As long as all your C++ code is built with GCC 7.1 or later, you can safely ignore this warning. To disable it, pass -Wno-psabi to the compiler.

For more details on the context of the change, see the GCC 7 changelog, and the associated bug.

Sneftel
  • 40,271
  • 12
  • 71
  • 104
  • 2
    Is it possible to disable this warning in system-wide GCC config? – kyb Apr 15 '20 at 14:01
  • 2
    @kyb Yes, you could use a spec file for this. But please, don't. Having a local GCC which works differently from other people's GCC is just asking for trouble. Instead, add the option to your Makefile or CMakeLists.txt or to whatever else you're using to build your program. – Sneftel Feb 14 '21 at 12:28
  • Yes i do so. Thank you for the answer – kyb Feb 14 '21 at 12:53
  • But, how to solve it? i mean, what i need change in the code to not get this "notes" @Sneftel –  Feb 26 '21 at 10:42
  • 3
    @ValentinoZaffrani There's nothing you *need* to change, because there's nothing wrong with your code. You could change the offending function parameter to a reference type (the change only affects structs passed by value) but that would be silly. Disable the warning on the command line using `-Wno-psabi`, or in your code as per [this Q/A](https://stackoverflow.com/questions/3378560/how-to-disable-gcc-warnings-for-a-few-lines-of-code). – Sneftel Feb 26 '21 at 10:50