Re: C++ name mangling in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/09/2014 09:50 PM, daniel@xxxxxxxxxxxxxxxxxxxxxxx wrote:
When this code is compiled using C++ compiler, such error will be
reported at linking phase as "undefined reference to 'test(int)'".
Unfortunately in C compilation and linking will succeed, so bug will
appear at runtime. But such bugs may be very hard to find.

If you have such issues in the code base, a conversion to C++ will be very difficult and is unlikely to uncover all such issues. For example, neither function return nor structure layout influence name mangling.

-flto should really warn about this, but it didn't with my tests (based on GCC 4.8). Does anybody know what's going on there? How can GCC even pretend to generate correct code in the face of such blatant typing violations?

--
Florian Weimer / Red Hat Product Security




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux