1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#include <float.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
struct large {
char buf[4096];
};
struct small {
unsigned char bit : 1;
};
struct large return_large(char patt)
{
struct large l;
memset(l.buf, patt, sizeof(l.buf));
return l;
}
#if __clang__
__attribute__((optnone))
#endif
struct small
return_small(void)
{
struct small s = { .bit = 1 };
return s;
}
#if __clang__
__attribute__((optnone))
#endif
long double
return_long_double(void)
{
return LDBL_MAX;
}
int main(void)
{
struct large l;
struct small s;
long double ld;
l = return_large(1);
if (l.buf[10] != 1)
return 1;
s = return_small();
if (s.bit != 1)
return 1;
ld = return_long_double();
if (ld != LDBL_MAX)
return 1;
return 0;
}
|