[Top][All Lists]

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

Re: [Tinycc-devel] global variables in tcc

From: Rob
Subject: Re: [Tinycc-devel] global variables in tcc
Date: Mon, 1 Apr 2013 14:10:35 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Apr 01, 2013 at 01:20:22PM +0200, Lluís Batlle i Rossell wrote:
> Hello,
> I'm testing tcc 0.9.26, and I see that for global variables liek this:
> int x;
> It generates a 'B' symbols (nm naming). But gcc and clang generate 'C'
> symbols. That makes tcc generate errors (or warnings?) linking. It
> says error, but it links.
> Is this a tcc problem?
> Regards,
> Lluís.
> _______________________________________________
> Tinycc-devel mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Shouldn't be - gcc and clang generate uninitialised globals via .comm,
meaning these can be overridden if the sizes and alignment are the same.
tcc doesn't, which is just as valid.

        int i;

        #include "header.h"

        #include "header.h"

GCC and Clang allow these to be merged together at link-time, which
means users who make mistakes such as missing `extern' in header files
still get the multiple definitions merged.

tcc is stricter and perhaps more conformant in disallowing this.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]