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 <stdio.h> > > > 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