This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Global variable in static library - double free or corruption error


On 10/22/2010 04:46 PM, Alexey Skidanov wrote:
> 
> Do you mean, once I break the ODR the further behaviour is unexpected?

Certainly not.  Once you break the ODR you have undefined behaviour, so
there is no behaviour that is really unexpected.

> You are right. I break it. And I would like to get linker/loader error/warning 
> as I get linking two object files with the same global variable defined in each 
> file ( "Symbol zzz already defined" or something like that). 

Mmm, but you'd get false positives for places it's done deliberately.
Some thread libraries, for example, contain thread-safe versions of
system library functions.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]