No warning: copying padding in long double
ch3root opened this issue · 1 comments
ch3root commented
It seems a full implementation of long double is not really required to illustrated the issue with padding in it.
Source code:
#include <string.h>
#include <stdio.h>
int main()
{
long double x, y;
memset(&x, 0, sizeof x);
memset(&y, -1, sizeof y);
y = x;
printf("%d\n", ((unsigned char *)&y)[10]);
}
tis-interpreter (72384b0) output:
[value] Analyzing a complete application starting at main
[value] Computing initial state
[value] Initial state computed
0
[value] done for function main
gcc (GCC) 7.0.0 20160608 (experimental):
$ gcc -std=c11 -pedantic -Wall -Wextra test.c && ./a.out
255
clang version 3.9.0 (trunk 271312):
$ clang -std=c11 -Weverything test.c && ./a.out
255
pascal-cuoq commented
It's not that long double
is not fully implemented, it's that it is not supported, period. tis-interpreter does not require as pre-requisite a platform where 80-bit long doubles are available, and these would be a pain to emulate in software, so long double
can not be used at all in interpreted programs. The examples showing how it is interesting because it's a scalar type with padding on x86-64 are not making a case for adding support for it.