When using "Field=1" in a composed type, that induces an error in the main structure packing when compiling with gcc 32-bit and 64-bit (the same code works when compiling with gas).
Example of bug with gcc 32-bit and gcc 64-bit:
type t12byte field=1
as longint a
as long b
end type
type t16byte
as t12byte a
end type
print sizeof(t12byte)
print sizeof(t16byte)
dim dummy as t16byte
Compilation error:
Compiler output:
.....\FBIDETEMP.c:15:47: error: size of array '__$fb_structsizecheck' is negative
#define __FB_STATIC_ASSERT( expr ) extern int __$fb_structsizecheck
.....\FBIDETEMP.c:20:1: note: in expansion of macro '__FB_STATIC_ASSERT'
__FB_STATIC_ASSERT( sizeof( struct $7T16BYTE ) == 16 );
Results:
Compilation failed
A workaround to the above gcc bug (32-bit and 64-bit):
Last edit: fxm (freebasic.net) 2017-06-18
Should be fixed by [4e2d70]
https://github.com/freebasic/fbc/pull/110
Related
Commit: [4e2d70]