Re: [Tinycc-devel] two fixes (was: Cannot code on TinyCC for now)

2014-09-24 Thread Thomas Preud'homme
Le mardi 23 septembre 2014, 12:37:24 grischka a écrit :
> Thomas Preud'homme wrote:
> > Grischka: it would be nice to have a release now (Debian is freezing soon)
> > after the issue I'm discussing with Michael is sorted out. I would have
> > liked to have the two fixes Jiang is working on but he didn't reply in
> > some time.
> I fixed one:
> http://repo.or.cz/w/tinycc.git/commitdiff/9d7fb3336049243a16ce20ba907946d1de
> 9e1c0d

Wow, so short change. I'm not sure I understand. It seems before the 
destination would have lost its bitfield (since the gv_dup is done after). But 
you also changed gv_dup + vswap + vrott into vdup, is that just an improvement 
unrelated to the bug or it also matters?

I feel quite ashamed with all the review I gave Jiang about this to not have 
seen a simpler solution. It doesn't seem I'm close to increase the bus factor…

> 
> What was the other?  (Anyway I'd leave it for someone else to try.)

http://lists.nongnu.org/archive/html/tinycc-devel/2014-08/msg00051.html

It's another instance of being able to redefined something in a local context. 
As suggested, I think this should be fixed more globally in sym_push2.

> 
> --- grischka

Cheers,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Alignment issue

2014-09-24 Thread Thomas Preud'homme
Le lundi 22 septembre 2014, 07:50:33 Daniel Fiala a écrit :
> Hello.It seems that alignment in tcc is not working properly. I tried
> following program:
> 
> 
> #include 
> 
> 
> static float x[4] = { 1, 2, 3, 4 };
> static float y[4] __attribute__((aligned(32))) = { 4, 5, 6, 7 };
> 
> 
> int
> main(void) {
> fprintf(stderr, "%p\n", x);
> fprintf(stderr, "%p\n", y);
> 
> 
> return 0;
> }
> 
> 
> 
> I compiled it with tcc 0.9.5 under Ubuntu 14.04 and I got following output:
> 
> 
> 0x8049544
> 0x8049554
> 
> 
> 
> It looks that address is not aligned. :-(

From tcc.h:

struct Attribute {
unsigned
func_call : 3, /* calling convention (0..5), see below */
aligned   : 5, /* alignement (0..16) */
packed: 1,
func_export   : 1,
func_import   : 1,
func_args : 5,
func_proto: 1,
mode  : 4,
weak  : 1,
visibility: 2,
fill  : 8; // 8 bits left to fit well in union below
};

You get the picture I think. Aligned should probably be a separate field of 
type unsigned char (so alignment from 0 to 64 (size of most cacheline). If 
more is necessary we can bump to an unsigned short instead.

Feel free to do the change.

Best regards,

Thomas

signature.asc
Description: This is a digitally signed message part.
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel