It's likely the glibc headers doing it. eg if you look at https://godbolt.org/z/n534T114s and comment out #include <stdio.h> it will work as expected.
See also https://lists.nongnu.org/archive/html/tinycc-devel/2025-10/msg00006.html as this issue bites people on a semi regular basis. Thanks Liam On Thu, 20 Nov 2025 at 08:34, [email protected] <[email protected]> wrote: > > > s.c > > #include <stdio.h> > struct __attribute__((__packed__)) MyS { > char a; > short b; > }; > void main() { > printf("sizeof(MyS) = %ld\n", sizeof(struct MyS)); > } > > > gcc will produce a result of 3, but tcc will produce a result of 4. > > ________________________________ > [email protected] > _______________________________________________ > Tinycc-devel mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/tinycc-devel
