Closed GoogleCodeExporter closed 8 years ago
Looks like the sx-gcc proclaims already at compile time that the "sizeof(struct
S) !=
sizeof(int)" condition is be always true.
Original comment by nou...@gmail.com
on 11 Dec 2008 at 4:00
If I insert the "printf" functions to print out the values of the "sizeof"
function,
{{{
typedef int new_int __attribute__ ((aligned(16)));
struct S { int x; };
int main()
{
printf("sizeof(struct S) = %lld\n", sizeof(struct S));
printf("sizeof(int) = %lld\n", sizeof(int));
if (sizeof(struct S) != sizeof(int))
abort ();
return 0;
}
}}}
I get the following output:
sizeof(struct S) = 8
sizeof(int) = 4
ABORT instruction (core dumped)
So it is obvious the sizes don't match.
Original comment by nou...@gmail.com
on 11 Dec 2008 at 4:31
Could this be an alignment issue (if I remember correctly the default alignment
with
SX is 8-bytes)?
Furthermore, if I replace the "int" type with the "new_int":
{{{
typedef int new_int __attribute__ ((aligned(16)));
struct S { new_int x; };
int main()
{
printf("sizeof(struct S) = %lld\n", sizeof(struct S));
printf("sizeof(new_int) = %lld\n", sizeof(new_int));
if (sizeof(struct S) != sizeof(new_int))
abort ();
return 0;
}
}}}
I get the following printout:
sizeof(struct S) = 16
sizeof(int) = 4
ABORT instruction (core dumped)
Original comment by nou...@gmail.com
on 11 Dec 2008 at 4:43
this was caused by us requiring structure size alignment of 64 bits (sx.h, macro
STRUCTURE_SIZE_BOUNDARY).
I am certain that there is nothing about our target that would require this,
thus I
removed the macro in r165 (resetting the boundary to its default of 8 bits),
which
fixes this issue.
Original comment by jmoc...@gmail.com
on 11 Dec 2008 at 6:57
Original issue reported on code.google.com by
nou...@gmail.com
on 11 Dec 2008 at 3:57