tinycc-devel
[Top][All Lists]
Advanced

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

Re: [Tinycc-devel] global variables in tcc


From: Lluís Batlle i Rossell
Subject: Re: [Tinycc-devel] global variables in tcc
Date: Mon, 1 Apr 2013 16:55:18 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Apr 01, 2013 at 02:10:35PM +0100, Rob wrote:
> 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?
> 
> 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.
> 
> header.h:
>         int i;
> 
> file1.c:
>         #include "header.h"
> 
> file2.c:
>         #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.

I think that the C standard requires the gcc and clang behaviour, 'extern' never
being a required word.

No?



reply via email to

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