[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [csmith-dev] Pragma pack clang/gcc difference
Here is the unreduced program. I have modified it a bit in order to understand what was happening, so I suggest you regenerate it from the header information. I unfortunately erased the original when I understood what was happening (which seemed benign enough to me).
The compilations below are for a 64-bit little-endian platform.
~/csmith_new$ clang -Iruntime t.c
~/csmith_new$ ./a.out
checksum = 94020CBC
~/csmith_new$ gcc -Iruntime t.c
t.c:36: warning: overflow in implicit constant conversion
t.c:36: warning: overflow in implicit constant conversion
t.c:36: warning: large integer implicitly truncated to unsigned type
~/csmith_new$ ./a.out
checksum = C3DA6B5
Pascal
/*
* This is a RANDOMLY GENERATED PROGRAM.
*
* Generator: csmith 2.1.0
* Git version: f0ba611
* Options: --max-pointer-depth 3 --max-funcs 2 --max-array-dim 2 --max-array-len-per-dim 3 --max-struct-fields 5 --no-volatiles --no-argc --unions
* Seed: 3399244203
*/
#include "csmith.h"
static long __undefined;
/* --- Struct/Union Declarations --- */
#pragma pack(push)
#pragma pack(1)
struct S0 {
signed f0 : _CSMITH_BITFIELD(38);
signed f1 : _CSMITH_BITFIELD(39);
signed : _CSMITH_BITFIELD(0);
const unsigned f2 : _CSMITH_BITFIELD(49);
signed f3 : _CSMITH_BITFIELD(2);
};
#pragma pack(pop)
union U1 {
const int64_t f0;
int8_t f1;
uint16_t f2;
struct S0 f3;
};
/* --- GLOBAL VARIABLES --- */
static uint16_t g_11 = 0xFE5EL;
static const struct S0 g_20 = {-378812,-657333,23139205,1};
static uint16_t g_24 = 0UL;
static uint16_t * const g_23 = &g_24;
static uint16_t *g_32 = &g_11;
static const uint16_t g_35[2] = {0xEBE6L, 0xEBE6L};
static const uint16_t *g_36 = (void*)0;
static const uint16_t g_38 = 65529UL;
static const uint16_t *g_37 = &g_38;
static const struct S0 *g_43 = (void*)0;
static int64_t g_46 = 0x961F9DA978833E6FLL;
static uint16_t g_61 = 0xAA6FL;
static union U1 g_62[3][1] = {{{-10L}}, {{-10L}}, {{-10L}}};
static int64_t g_63 = 0L;
static int32_t g_69 = 0x0438810CL;
static int32_t *g_68 = &g_69;
/* --- FORWARD DECLARATIONS --- */
static uint32_t func_1(void);
static const int16_t func_4(uint16_t p_5, int32_t p_6, uint16_t p_7, union U1 p_8, uint32_t p_9);
/* --- FUNCTIONS --- */
/* ------------------------------------------ */
/*
* reads : g_11 g_20 g_23 g_24 g_46 g_35 g_62
* writes: g_11 g_24 g_32 g_36 g_37 g_43 g_46 g_61 g_63 g_62.f3.f3 g_68
*/
static uint32_t func_1(void)
{ // Frama_C_show_each(0);
uint16_t *l_10[1][1];
int32_t l_12 = (-1L);
int32_t l_13 = 0L;
int32_t l_14 = 0xE6F885EAL;
int32_t l_15 = 1L;
uint16_t *l_25 = &g_24;
int64_t l_26 = (-1L);
union U1 l_27 = {-6L};
int32_t *l_44 = (void*)0;
int32_t *l_45[3][3];
struct S0 *l_55 = (void*)0;
struct S0 **l_54 = &l_55;
const uint8_t l_60 = 0xEAL;
uint16_t ***l_65 = (void*)0;
uint16_t ****l_64 = &l_65;
int32_t **l_66 = (void*)0;
int32_t **l_67[3];
int i, j;
for (i = 0; i < 1; i++)
{
for (j = 0; j < 1; j++)
l_10[i][j] = &g_11;
}
for (i = 0; i < 3; i++)
{
for (j = 0; j < 3; j++)
l_45[i][j] = &l_15;
}
for (i = 0; i < 3; i++)
l_67[i] = &l_45[1][1];
g_46 ^= (safe_lshift_func_int16_t_s_s(func_4((g_11++), (safe_lshift_func_uint16_t_u_u(((*g_23) &= ((((((g_20 , (l_10[0][0] = l_10[0][0])) == (void*)0) , l_10[0][0]) == (((safe_div_func_uint32_t_u_u(g_20.f1, g_20.f1)) && ((void*)0 != g_23)) , l_25)) < g_20.f0) == g_20.f0)), l_13)), l_26, l_27, g_20.f1), l_27.f1));
g_62[0][0].f3.f3 = (safe_unary_minus_func_uint8_t_u((l_27 , (0x28285606L ^ (safe_div_func_uint64_t_u_u((safe_div_func_int8_t_s_s((((g_63 = (safe_div_func_uint8_t_u_u(((g_35[1] , &g_43) != &g_43), func_4(((void*)0 == l_54), (g_61 = (+(safe_lshift_func_uint8_t_u_s(g_20.f0, (safe_rshift_func_uint16_t_u_u(65535UL, l_60)))))), (*g_23), g_62[0][0], g_24)))) & (-5L)) == g_11), 251UL)), 18446744073709551615UL))))));
(*l_64) = (void*)0;
g_68 = &l_15;
return g_20.f0;
}
/* ------------------------------------------ */
/*
* reads : g_23 g_24 g_20.f3
* writes: g_24 g_32 g_36 g_37 g_43
*/
static const int16_t func_4(uint16_t p_5, int32_t p_6, uint16_t p_7, union U1 p_8, uint32_t p_9)
{ // Frama_C_show_each(4);
int32_t l_28[2][3] = {{(-2L), (-2L), 0x1EE3199FL}, {(-2L), (-2L), 0x1EE3199FL}};
uint16_t *l_31 = &g_11;
const uint16_t *l_34[1];
const uint16_t **l_33[1][3];
int32_t *l_39[2][2];
int32_t l_40 = 0x82EA9177L;
const struct S0 *l_42 = (void*)0;
const struct S0 **l_41[2];
int i, j;
for (i = 0; i < 1; i++)
l_34[i] = &g_35[1];
for (i = 0; i < 1; i++)
{
for (j = 0; j < 3; j++)
l_33[i][j] = &l_34[0];
}
for (i = 0; i < 2; i++)
{
for (j = 0; j < 2; j++)
l_39[i][j] = &l_28[1][1];
}
for (i = 0; i < 2; i++)
l_41[i] = &l_42;
l_40 = (l_28[0][1] , (((*g_23)++) >= (((g_32 = l_31) == (g_37 = (g_36 = &p_7))) == 1L)));
g_43 = &g_20;
return g_20.f3;
}
/* ---------------------------------------- */
int main (void)
{
int i, j;
int print_hash_value = 0;
platform_main_begin();
crc32_gentab();
func_1();
transparent_crc(g_62[0][0].f0, "g_62[0][0].f0", print_hash_value);
platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
return 0;
}
/************************ statistics *************************
XXX max struct depth: 1
breakdown:
depth: 0, occurrence: 22
depth: 1, occurrence: 1
XXX total union variables: 2
XXX non-zero bitfields defined in structs: 5
XXX zero bitfields defined in structs: 1
XXX const bitfields defined in structs: 1
XXX volatile bitfields defined in structs: 0
XXX structs with bitfields in the program: 3
breakdown:
indirect level: 0, occurrence: 1
indirect level: 1, occurrence: 1
indirect level: 2, occurrence: 1
XXX full-bitfields structs in the program: 1
breakdown:
indirect level: 0, occurrence: 1
XXX times a bitfields struct's address is taken: 1
XXX times a bitfields struct on LHS: 0
XXX times a bitfields struct on RHS: 2
XXX times a single bitfield on LHS: 1
XXX times a single bitfield on RHS: 8
XXX max expression depth: 21
breakdown:
depth: 1, occurrence: 11
depth: 9, occurrence: 1
depth: 20, occurrence: 1
depth: 21, occurrence: 1
XXX total number of pointers: 22
XXX times a variable address is taken: 14
XXX times a pointer is dereferenced on RHS: 1
breakdown:
depth: 1, occurrence: 1
XXX times a pointer is dereferenced on LHS: 3
breakdown:
depth: 1, occurrence: 3
XXX times a pointer is compared with null: 2
XXX times a pointer is compared with address of another variable: 0
XXX times a pointer is compared with another pointer: 0
XXX times a pointer is qualified to be dereferenced: 101
XXX max dereference level: 1
breakdown:
level: 0, occurrence: 0
level: 1, occurrence: 9
XXX number of pointers point to pointers: 7
XXX number of pointers point to scalars: 12
XXX number of pointers point to structs: 3
XXX percent of pointers has null in alias set: 27.3
XXX average alias set size: 1.23
XXX times a non-volatile is read: 32
XXX times a non-volatile is write: 18
XXX times a volatile is read: 0
XXX times read thru a pointer: 0
XXX times a volatile is write: 0
XXX times written thru a pointer: 0
XXX times a volatile is available for access: 0
XXX percentage of non-volatile access: 100
XXX forward jumps: 0
XXX backward jumps: 0
XXX stmts: 8
XXX max block depth: 0
breakdown:
depth: 0, occurrence: 8
XXX percentage a fresh-made variable is used: 36.5
XXX percentage an existing variable is used: 63.5
********************* end of statistics **********************/