Skip to content

[RISCV][MISched] Miscompilation due to incorrect scheduling #82616

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dtcxzyw opened this issue Feb 22, 2024 · 3 comments
Open

[RISCV][MISched] Miscompilation due to incorrect scheduling #82616

dtcxzyw opened this issue Feb 22, 2024 · 3 comments
Labels
backend:RISC-V generated by fuzzer llvm:codegen miscompilation needs-reduction Large reproducer that should be reduced into a simpler form TBAA Type-Based Alias Analysis / Strict Aliasing

Comments

@dtcxzyw
Copy link
Member

dtcxzyw commented Feb 22, 2024

Reproducer (it is a RISC-V-only bug):

/*
 * This is a RANDOMLY GENERATED PROGRAM.
 *
 * Generator: csmith 2.4.0
 * Git version: 0ec6f1b
 * Options:   --max-funcs 3 --max-block-depth 3 --quiet --no-volatiles --no-volatile-pointers --output ./csmith2024-02-22@05:14/test71188.c
 * Seed:      2561487490
 */

#include "csmith.h"


static long __undefined;


#pragma pack(push)
#pragma pack(1)
struct S0 {
   unsigned f0 : 15;
   unsigned f1 : 8;
   const signed f2 : 10;
   unsigned f3 : 14;
   signed f4 : 5;
   signed f5 : 8;
};
#pragma pack(pop)

#pragma pack(push)
#pragma pack(1)
struct S1 {
   uint16_t  f0;
   int8_t  f1;
};
#pragma pack(pop)

union U2 {
   int32_t  f0;
   struct S1  f1;
   struct S1  f2;
   const signed f3 : 7;
};

union U3 {
   uint16_t  f0;
   struct S1  f1;
   uint32_t  f2;
   int32_t  f3;
   int32_t  f4;
};

union U4 {
   int64_t  f0;
};

union U5 {
   uint64_t  f0;
};


static union U2 g_4[8][4] = {{{0x8B78ACC4L},{0xC58BDFADL},{-9L},{-9L}},{{0xEA964A90L},{0xEA964A90L},{0x6D21CD43L},{-8L}},{{0x7C7008B1L},{4L},{0x9642E40CL},{9L}},{{0x9642E40CL},{9L},{0x8B78ACC4L},{0x9642E40CL}},{{0xEA964A90L},{9L},{-1L},{9L}},{{9L},{4L},{-9L},{-8L}},{{0x79A20B28L},{0xEA964A90L},{0x8B78ACC4L},{-9L}},{{0x7C7008B1L},{0xC58BDFADL},{-4L},{9L}}};
static union U4 g_13 = {0x3E270BB1DCEDE6A6LL};
static int32_t *g_17 = &g_4[7][0].f0;
static union U2 g_29 = {1L};
static union U2 *g_28 = &g_29;
static uint16_t g_45 = 0x6D00L;
static uint32_t g_71[5] = {3UL,3UL,3UL,3UL,3UL};
static int16_t g_73 = 2L;
static uint64_t g_116 = 8UL;
static uint64_t *g_115 = &g_116;
static uint16_t g_144 = 0x7DB8L;
static struct S1 g_149 = {0x80BAL,1L};
static uint64_t g_165 = 0xD4FCCDB890218128LL;
static uint16_t *g_175 = &g_144;
static uint16_t **g_174 = &g_175;
static uint8_t g_181 = 0xE9L;
static union U5 g_189 = {18446744073709551615UL};
static union U3 g_226[8][3] = {{{0xA0C0L},{0UL},{0UL}},{{1UL},{4UL},{0x96E7L}},{{0xA0C0L},{0x4B21L},{0xA0C0L}},{{1UL},{0x4671L},{4UL}},{{0UL},{0UL},{0xA0C0L}},{{0x96E7L},{0x4671L},{0x4671L}},{{0xA0C0L},{0xFD01L},{0x4B21L}},{{0x96E7L},{0xC28FL},{0x96E7L}}};
static uint8_t g_244[9][5] = {{246UL,246UL,0x41L,246UL,246UL},{0x4EL,0x61L,0x4EL,0x4EL,0x61L},{246UL,2UL,2UL,246UL,2UL},{0x61L,0x61L,0xC3L,0x61L,0x61L},{2UL,246UL,2UL,2UL,246UL},{0x61L,0x4EL,0x4EL,0x61L,0x4EL},{246UL,246UL,0x41L,246UL,246UL},{0x4EL,0x61L,0x4EL,0x4EL,0x61L},{246UL,2UL,2UL,246UL,2UL}};
static int64_t g_255 = 1L;
static int32_t g_256 = 6L;
static int64_t g_257 = 0L;
static int32_t g_258 = (-1L);
static int16_t g_259 = 0xF022L;
static uint16_t g_260 = 0x509BL;
static int32_t g_268 = 0xBA2C1D85L;
static uint8_t g_270 = 0x7DL;



static struct S1  func_1(void);
static struct S1  func_5(union U5  p_6, union U4  p_7, uint64_t  p_8);
static union U5  func_9(struct S0  p_10, struct S1  p_11);





static struct S1  func_1(void)
{ 
    union U2 **l_2 = (void*)0;
    union U2 *l_3[8][9][3] = {{{&g_4[7][0],(void*)0,&g_4[7][0]},{&g_4[5][0],&g_4[7][0],&g_4[0][2]},{&g_4[0][1],&g_4[6][0],&g_4[7][0]},{&g_4[7][1],&g_4[6][0],&g_4[7][0]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]},{&g_4[7][3],(void*)0,&g_4[7][0]},{(void*)0,&g_4[7][0],&g_4[0][2]},{(void*)0,&g_4[7][0],&g_4[4][0]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]}},{{&g_4[0][2],(void*)0,&g_4[5][3]},{&g_4[1][1],(void*)0,&g_4[7][0]},{&g_4[7][0],(void*)0,&g_4[3][0]},{&g_4[5][2],&g_4[7][0],&g_4[3][3]},{&g_4[7][2],&g_4[7][2],&g_4[7][0]},{&g_4[0][1],&g_4[5][3],&g_4[7][0]},{&g_4[0][2],&g_4[6][0],&g_4[6][2]},{&g_4[7][0],&g_4[3][3],&g_4[6][0]},{&g_4[2][1],&g_4[0][2],&g_4[6][2]}},{{&g_4[7][0],(void*)0,&g_4[7][0]},{(void*)0,&g_4[3][0],&g_4[7][0]},{&g_4[4][3],(void*)0,&g_4[3][3]},{&g_4[5][1],&g_4[5][0],&g_4[3][0]},{(void*)0,&g_4[1][0],&g_4[7][0]},{&g_4[4][0],&g_4[4][0],&g_4[5][3]},{&g_4[7][0],(void*)0,&g_4[7][0]},{&g_4[6][0],&g_4[7][0],&g_4[4][0]},{&g_4[6][0],&g_4[7][0],&g_4[0][2]}},{{&g_4[7][0],(void*)0,&g_4[7][0]},{&g_4[0][2],&g_4[2][1],&g_4[7][0]},{&g_4[6][0],&g_4[7][0],&g_4[7][0]},{(void*)0,&g_4[7][0],&g_4[7][0]},{(void*)0,&g_4[7][0],&g_4[0][2]},{&g_4[6][0],&g_4[7][0],&g_4[7][0]},{&g_4[0][2],&g_4[0][2],&g_4[7][0]},{&g_4[7][0],&g_4[0][0],&g_4[0][2]},{&g_4[6][0],&g_4[5][1],&g_4[7][1]}},{{&g_4[6][0],&g_4[7][0],&g_4[4][1]},{&g_4[7][0],(void*)0,&g_4[4][0]},{&g_4[4][0],&g_4[0][0],&g_4[2][1]},{(void*)0,&g_4[7][0],&g_4[7][0]},{&g_4[5][1],&g_4[3][2],&g_4[3][2]},{&g_4[4][3],&g_4[7][0],&g_4[0][2]},{(void*)0,&g_4[7][3],&g_4[7][0]},{&g_4[7][0],&g_4[5][2],&g_4[7][0]},{(void*)0,&g_4[0][1],&g_4[5][0]}},{{&g_4[7][0],&g_4[7][0],&g_4[5][1]},{&g_4[0][2],&g_4[7][3],&g_4[7][0]},{&g_4[5][3],&g_4[0][2],&g_4[7][0]},{&g_4[6][0],&g_4[6][2],&g_4[6][2]},{&g_4[7][0],&g_4[5][1],&g_4[7][3]},{(void*)0,&g_4[7][0],(void*)0},{&g_4[7][0],&g_4[6][2],&g_4[7][0]},{&g_4[6][0],&g_4[3][3],(void*)0},{&g_4[4][0],&g_4[3][1],&g_4[7][0]}},{{&g_4[4][3],(void*)0,(void*)0},{&g_4[0][1],&g_4[6][0],&g_4[6][0]},{&g_4[7][0],(void*)0,&g_4[0][0]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]},{&g_4[0][1],&g_4[7][0],&g_4[7][0]},{&g_4[7][0],&g_4[7][0],&g_4[0][0]},{&g_4[7][3],(void*)0,&g_4[6][0]},{&g_4[7][0],&g_4[0][2],(void*)0},{&g_4[7][0],&g_4[7][2],&g_4[7][0]}},{{&g_4[7][0],&g_4[7][0],(void*)0},{&g_4[2][1],&g_4[7][0],&g_4[7][0]},{&g_4[7][0],&g_4[7][0],(void*)0},{&g_4[1][0],&g_4[7][0],&g_4[7][3]},{&g_4[7][0],&g_4[7][3],&g_4[6][2]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]},{&g_4[7][0],&g_4[0][0],&g_4[7][0]},{&g_4[7][0],(void*)0,&g_4[5][1]},{(void*)0,&g_4[0][2],&g_4[5][0]}}};
    struct S0 l_12 = {12,6,31,30,2,7};
    struct S1 l_14 = {0xDB1AL,0x3BL};
    int32_t l_266 = 0xC236062CL;
    int32_t l_267 = 0xB78067A0L;
    int32_t l_269[3];
    int i, j, k;
    for (i = 0; i < 3; i++)
        l_269[i] = 4L;
    l_3[2][7][2] = (void*)0;
    l_14 = func_5(func_9(l_12, (g_13 , l_14)), g_13, l_12.f4);
    for (g_29.f1.f1 = 0; (g_29.f1.f1 == (-26)); --g_29.f1.f1)
    { 
        int32_t *l_265[6][2] = {{(void*)0,(void*)0},{&g_256,(void*)0},{(void*)0,&g_256},{(void*)0,(void*)0},{&g_256,(void*)0},{(void*)0,&g_256}};
        int i, j;
        g_270--;
    }
    return l_14;
}




static struct S1  func_5(union U5  p_6, union U4  p_7, uint64_t  p_8)
{ 
    int64_t l_79 = 0x5013F2C8C67737D6LL;
    int16_t *l_99 = &g_73;
    uint16_t *l_107 = &g_4[7][0].f1.f0;
    int32_t *l_117[2][5] = {{&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0},{&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0}};
    int32_t l_143[9][6] = {{(-2L),0x645DA593L,0x16BB261DL,(-2L),7L,7L},{0x7B4A3B70L,0x645DA593L,0x645DA593L,0x7B4A3B70L,7L,0x16BB261DL},{8L,0x645DA593L,7L,8L,7L,0x645DA593L},{(-2L),0x645DA593L,0x16BB261DL,(-2L),7L,7L},{0x7B4A3B70L,0x645DA593L,0x645DA593L,0x7B4A3B70L,7L,0x16BB261DL},{8L,0x645DA593L,7L,8L,7L,0x645DA593L},{(-2L),0x645DA593L,0x16BB261DL,(-2L),7L,7L},{0x7B4A3B70L,0x645DA593L,0x645DA593L,0x7B4A3B70L,7L,0x16BB261DL},{8L,0x645DA593L,7L,8L,7L,0x645DA593L}};
    struct S1 l_204[2][4] = {{{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L}},{{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L}}};
    union U2 **l_209 = &g_28;
    int32_t **l_254 = &l_117[0][1];
    int i, j;
    if ((safe_sub_func_uint16_t_u_u((safe_sub_func_int16_t_s_s(9L, l_79)), (safe_rshift_func_int32_t_s_s((g_29.f0 = (safe_add_func_int8_t_s_s((((safe_lshift_func_uint16_t_u_s((((safe_sub_func_uint8_t_u_u(((safe_div_func_uint8_t_u_u(((safe_unary_minus_func_uint64_t_u((safe_div_func_int32_t_s_s((safe_add_func_uint8_t_u_u((safe_div_func_uint64_t_u_u(((safe_add_func_int16_t_s_s(((*l_99) = g_29.f0), (~(safe_sub_func_int64_t_s_s((safe_lshift_func_int8_t_s_s(0x22L, 1)), (safe_div_func_uint16_t_u_u(((*l_107) = l_79), ((safe_mul_func_uint16_t_u_u((safe_div_func_uint8_t_u_u((l_79 & (0xC4L ^ (!(safe_div_func_uint8_t_u_u(((((void*)0 != g_115) ^ g_29.f0) <= g_71[1]), 1L))))), 255UL)), 0x4290L)) & g_29.f0)))))))) && g_71[1]), (*g_115))), 1L)), g_29.f0)))) < p_6.f0), 8UL)) <= 0x5C710B0AL), g_116)) < 0x47AC3CA6ABCE8417LL) && l_79), g_45)) , (*g_115)) || p_6.f0), 0x24L))), 2)))))
    { 
        const int8_t l_135 = 0xF0L;
        int32_t l_142[9][10] = {{(-6L),0x6F6008F0L,(-1L),1L,9L,0L,0x56E8D107L,0L,9L,1L},{0x2AEDA2CAL,0xD69FAF8FL,0x2AEDA2CAL,0x30D721F5L,0xA0BFB30CL,0x7B95470CL,0L,0x77A9A3A1L,0x6F6008F0L,0x3BCE19DEL},{(-1L),0xB7F3AE84L,(-1L),0x7B95470CL,(-2L),1L,0xDCF32642L,4L,0xD69FAF8FL,0L},{0x23CDDDF8L,0xB442378EL,0x7B95470CL,1L,0x3BCE19DEL,7L,0xA0BFB30CL,(-1L),0x77A9A3A1L,9L},{0xB442378EL,0x56E8D107L,0L,4L,0x6F6008F0L,0x6F6008F0L,4L,0L,0x56E8D107L,0xB442378EL},{(-1L),(-1L),0xA0BFB30CL,(-1L),(-6L),1L,(-9L),(-10L),0x2AEDA2CAL,(-1L)},{0xD69FAF8FL,0x6F6008F0L,1L,(-1L),(-6L),(-3L),9L,(-1L),0x30D721F5L,0xB442378EL},{(-6L),(-9L),0xB442378EL,0L,0x6F6008F0L,(-1L),0xD69FAF8FL,9L,1L,9L},{0xD6BF538CL,0xDCF32642L,0x3BCE19DEL,1L,0x3BCE19DEL,0xDCF32642L,0xD6BF538CL,(-1L),4L,0L}};
        union U3 l_199 = {8UL};
        int32_t l_200 = 2L;
        int32_t **l_251[1][7] = {{&g_17,&g_17,&l_117[0][1],&g_17,&g_17,&l_117[0][1],&g_17}};
        int32_t * const l_252 = &l_200;
        int32_t **l_253 = &g_17;
        int i, j;
        for (p_6.f0 = 0; (p_6.f0 > 16); p_6.f0 = safe_add_func_int16_t_s_s(p_6.f0, 6))
        { 
            uint32_t l_126 = 0xA4EB99B8L;
            int32_t l_136 = (-1L);
            int32_t l_169 = 1L;
            int32_t l_170 = 0x87D1255FL;
            uint8_t *l_180[5][5] = {{&g_181,&g_181,&g_181,&g_181,&g_181},{(void*)0,(void*)0,(void*)0,(void*)0,(void*)0},{&g_181,&g_181,&g_181,&g_181,&g_181},{(void*)0,&g_181,&g_181,(void*)0,&g_181},{&g_181,&g_181,&g_181,&g_181,&g_181}};
            struct S0 l_185 = {53,0,31,75,3,6};
            uint16_t **l_186 = &g_175;
            union U5 *l_190 = &g_189;
            uint32_t *l_191 = &l_126;
            int i, j;
        }
        for (p_7.f0 = (-12); (p_7.f0 <= (-12)); p_7.f0++)
        { 
            uint16_t *l_227 = &l_204[0][0].f0;
            int32_t l_228 = (-3L);
            uint8_t *l_229 = &g_181;
            int32_t l_237 = 8L;
            int16_t l_238 = 1L;
            int32_t l_239[1][1][4] = {{{8L,8L,8L,8L}}};
            uint32_t l_247 = 4294967295UL;
            int32_t **l_250 = (void*)0;
            int i, j, k;
            for (g_29.f0 = 1; (g_29.f0 <= 4); g_29.f0 += 1)
            { 
                int32_t **l_207 = &l_117[0][1];
                (*l_207) = g_17;
            }
            if ((~((l_209 == (void*)0) < ((*l_229) = (safe_sub_func_uint16_t_u_u((--(*g_175)), (((((-6L) && (safe_mod_func_uint16_t_u_u(l_142[4][3], (safe_rshift_func_uint64_t_u_s((safe_mul_func_uint16_t_u_u((((*l_107) = ((safe_mul_func_uint8_t_u_u(g_116, (l_199.f4 = (g_165 || (safe_add_func_uint16_t_u_u(l_142[6][9], 1L)))))) <= (safe_div_func_uint16_t_u_u(((*l_227) ^= (g_226[3][2] , 0UL)), 0x501EL)))) ^ l_142[4][3]), p_8)), l_142[4][3]))))) , p_8) , (*g_17)) & l_228)))))))
            { 
                union U2 l_234 = {-8L};
                int32_t l_240 = 1L;
                int32_t l_241 = 0xB8815D8FL;
                int32_t l_242 = 0xFF450A72L;
                int32_t l_243 = 0x8C6111A7L;
                l_200 |= ((safe_mul_func_int64_t_s_s((safe_div_func_int16_t_s_s(0xA634L, (**g_174))), (0L | (l_234 , (-1L))))) || (l_228 , (safe_lshift_func_uint32_t_u_u(0UL, 24))));
                g_244[5][3]++;
                l_247++;
            }
            else
            { 
                if ((*g_17))
                    break;
            }
            l_117[0][1] = l_117[0][1];
        }
        g_17 = g_17;
        (*l_253) = l_252;
    }
    else
    { 
        (*g_17) |= p_7.f0;
        return g_149;
    }
    (*l_254) = l_117[1][1];
    g_260--;
    return l_204[0][2];
}




static union U5  func_9(struct S0  p_10, struct S1  p_11)
{ 
    int8_t l_15 = (-1L);
    union U5 l_16 = {0x9D7FCCEA59F7C1AELL};
    int32_t **l_18 = &g_17;
    const int32_t *l_24 = &g_4[7][0].f0;
    union U4 l_25[10] = {{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL}};
    struct S1 l_35[1][9] = {{{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL}}};
    uint16_t l_52 = 1UL;
    int16_t l_72 = 0xCDD4L;
    union U5 l_74 = {18446744073709551613UL};
    int i, j;
    l_15 = (g_4[7][0].f0 >= (-4L));
    (*l_18) = (l_16 , g_17);
    for (l_15 = 25; (l_15 == (-19)); l_15 = safe_sub_func_int16_t_s_s(l_15, 6))
    { 
        const int32_t *l_21 = &g_4[7][0].f0;
        const int32_t **l_22 = (void*)0;
        const int32_t **l_23[8] = {&l_21,&l_21,&l_21,&l_21,&l_21,&l_21,&l_21,&l_21};
        int i;
        l_24 = l_21;
    }
    for (p_11.f1 = 9; (p_11.f1 >= 0); p_11.f1 -= 1)
    { 
        int8_t l_31[3][1][10] = {{{0xCBL,0xCBL,(-1L),4L,(-1L),0xCBL,0xCBL,(-1L),4L,(-1L)}},{{0xCBL,0xCBL,(-1L),4L,(-1L),0xCBL,0xCBL,(-1L),4L,(-1L)}},{{0xCBL,0xCBL,(-1L),4L,(-1L),0xCBL,0xCBL,(-1L),4L,(-1L)}}};
        int32_t *l_41[10][8][3] = {{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}}};
        union U2 *l_51 = &g_4[6][1];
        int8_t l_70 = (-1L);
        int i, j, k;
        for (l_15 = 9; (l_15 >= 0); l_15 -= 1)
        { 
            union U2 *l_27[8];
            union U2 **l_26 = &l_27[4];
            uint64_t *l_30[6][10][4] = {{{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0}},{{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0}},{{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0}},{{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0}},{{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,(void*)0}},{{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,(void*)0}}};
            int32_t l_32[10] = {3L,3L,0x0C4F586FL,(-1L),0x0C4F586FL,3L,3L,0x0C4F586FL,(-1L),0x0C4F586FL};
            uint64_t l_46 = 0xE796224A103C2894LL;
            int i, j, k;
            for (i = 0; i < 8; i++)
                l_27[i] = &g_4[7][0];
            if (((p_10.f3 == (l_31[2][0][6] |= ((g_28 = ((*l_26) = (void*)0)) == &g_29))) >= p_10.f5))
            { 
                uint16_t *l_42 = (void*)0;
                uint16_t *l_43 = (void*)0;
                uint16_t *l_44 = &g_4[7][0].f1.f0;
                g_45 |= ((-5L) <= ((g_29.f0 != ((0xEDB0L > g_13.f0) != (l_32[5] & (((safe_sub_func_uint32_t_u_u((l_35[0][0] , (safe_div_func_uint16_t_u_u(((*l_44) = (((safe_rshift_func_uint8_t_u_s(g_29.f0, p_10.f3)) & (!((l_41[4][6][1] = g_17) != (void*)0))) < (**l_18))), g_29.f0))), p_10.f2)) , 0x92L) < 0xFCL)))) < p_11.f1));
            }
            else
            { 
                ++l_46;
                if (p_10.f4)
                    break;
            }
            g_73 ^= ((l_52 = (p_10 , (((void*)0 == l_51) == ((void*)0 == &g_17)))) != ((g_13.f0 && (l_32[5] = ((-1L) || (safe_mul_func_uint8_t_u_u((safe_add_func_int32_t_s_s(((*g_17) = (((((((8L || (safe_mul_func_int64_t_s_s((~((safe_mul_func_uint64_t_u_u((g_71[1] = ((safe_div_func_int16_t_s_s(((safe_mul_func_uint64_t_u_u((safe_add_func_uint8_t_u_u((safe_add_func_uint64_t_u_u(0UL, (-10L))), g_4[7][0].f0)), 0L)) && g_29.f0), l_70)) != (**l_18))), p_10.f5)) && g_71[2])), (**l_18)))) && l_72) < p_10.f3) && 0x4046E41CA980D529LL) == (*g_17)) , (**l_18)) < (*g_17))), p_10.f1)), (-1L)))))) < p_10.f3));
        }
    }
    return l_74;
}





int main (int argc, char* argv[])
{
    int i, j;
    int print_hash_value = 0;
    if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
    platform_main_begin();
    crc32_gentab();
    func_1();
    for (i = 0; i < 8; i++)
    {
        for (j = 0; j < 4; j++)
        {
            transparent_crc(g_4[i][j].f0, "g_4[i][j].f0", print_hash_value);
            if (print_hash_value) printf("index = [%d][%d]\n", i, j);

        }
    }
    transparent_crc(g_13.f0, "g_13.f0", print_hash_value);
    transparent_crc(g_29.f0, "g_29.f0", print_hash_value);
    transparent_crc(g_45, "g_45", print_hash_value);
    for (i = 0; i < 5; i++)
    {
        transparent_crc(g_71[i], "g_71[i]", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    transparent_crc(g_73, "g_73", print_hash_value);
    transparent_crc(g_116, "g_116", print_hash_value);
    transparent_crc(g_144, "g_144", print_hash_value);
    transparent_crc(g_149.f0, "g_149.f0", print_hash_value);
    transparent_crc(g_149.f1, "g_149.f1", print_hash_value);
    transparent_crc(g_165, "g_165", print_hash_value);
    transparent_crc(g_181, "g_181", print_hash_value);
    transparent_crc(g_189.f0, "g_189.f0", print_hash_value);
    for (i = 0; i < 8; i++)
    {
        for (j = 0; j < 3; j++)
        {
            transparent_crc(g_226[i][j].f0, "g_226[i][j].f0", print_hash_value);
            if (print_hash_value) printf("index = [%d][%d]\n", i, j);

        }
    }
    for (i = 0; i < 9; i++)
    {
        for (j = 0; j < 5; j++)
        {
            transparent_crc(g_244[i][j], "g_244[i][j]", print_hash_value);
            if (print_hash_value) printf("index = [%d][%d]\n", i, j);

        }
    }
    transparent_crc(g_255, "g_255", print_hash_value);
    transparent_crc(g_256, "g_256", print_hash_value);
    transparent_crc(g_257, "g_257", print_hash_value);
    transparent_crc(g_258, "g_258", print_hash_value);
    transparent_crc(g_259, "g_259", print_hash_value);
    transparent_crc(g_260, "g_260", print_hash_value);
    transparent_crc(g_268, "g_268", print_hash_value);
    transparent_crc(g_270, "g_270", print_hash_value);
    platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
    return 0;
}

/************************ statistics *************************

XXX max struct depth: 1
breakdown:
   depth: 0, occurrence: 64
   depth: 1, occurrence: 6
XXX total union variables: 7

XXX non-zero bitfields defined in structs: 7
XXX zero bitfields defined in structs: 0
XXX const bitfields defined in structs: 2
XXX volatile bitfields defined in structs: 0
XXX structs with bitfields in the program: 7
breakdown:
   indirect level: 0, occurrence: 3
   indirect level: 1, occurrence: 3
   indirect level: 2, occurrence: 1
XXX full-bitfields structs in the program: 2
breakdown:
   indirect level: 0, occurrence: 2
XXX times a bitfields struct's address is taken: 72
XXX times a bitfields struct on LHS: 0
XXX times a bitfields struct on RHS: 6
XXX times a single bitfield on LHS: 0
XXX times a single bitfield on RHS: 10

XXX max expression depth: 34
breakdown:
   depth: 1, occurrence: 38
   depth: 2, occurrence: 9
   depth: 7, occurrence: 2
   depth: 8, occurrence: 1
   depth: 18, occurrence: 1
   depth: 23, occurrence: 1
   depth: 31, occurrence: 1
   depth: 34, occurrence: 1

XXX total number of pointers: 51

XXX times a variable address is taken: 141
XXX times a pointer is dereferenced on RHS: 14
breakdown:
   depth: 1, occurrence: 8
   depth: 2, occurrence: 6
XXX times a pointer is dereferenced on LHS: 22
breakdown:
   depth: 1, occurrence: 22
XXX times a pointer is compared with null: 5
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: 417

XXX max dereference level: 2
breakdown:
   level: 0, occurrence: 0
   level: 1, occurrence: 59
   level: 2, occurrence: 10
XXX number of pointers point to pointers: 17
XXX number of pointers point to scalars: 28
XXX number of pointers point to structs: 1
XXX percent of pointers has null in alias set: 35.3
XXX average alias set size: 1.29

XXX times a non-volatile is read: 160
XXX times a non-volatile is write: 86
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: 35
XXX max block depth: 3
breakdown:
   depth: 0, occurrence: 13
   depth: 1, occurrence: 9
   depth: 2, occurrence: 5
   depth: 3, occurrence: 8

XXX percentage a fresh-made variable is used: 26.5
XXX percentage an existing variable is used: 73.5
FYI: the random generator makes assumptions about the integer size. See platform.info for more details.
XXX total OOB instances added: 0
********************* end of statistics **********************/

I am sorry I cannot provide a minimal UB-free reproducer.

Commands:

bin/clang -O1 test.c --target=riscv64-linux-gnu -I/usr/include/csmith -w
qemu-riscv64 -L /usr/riscv64-linux-gnu/ ./a.out

The result should be checksum = A559693C, but qemu returns checksum = FC86B582.

Bisect to Machine Instruction Scheduler:

bin/clang -O1 test.c --target=riscv64-linux-gnu -I/usr/include/csmith -w -mllvm -opt-bisect-limit=1340 -mllvm -debug-only=machine-scheduler -mllvm --misched-only-block=7 2>log

Before MISched:

1024B	bb.7.crc32_gentab.exit:
	; predecessors: %bb.6
	  successors: %bb.9(0x30000000), %bb.8(0x50000000); %bb.9(37.50%), %bb.8(62.50%)

1040B	  %218:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_29, pre-instr-symbol <mcsymbol .Lpcrel_hi2>
1056B	  %70:gpr = ADDI %218:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi2>
1072B	  %71:gpr = LH %70:gpr, 0 :: (dereferenceable load (s16) from @g_29, align 4, !tbaa !19)
1088B	  %219:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_73, pre-instr-symbol <mcsymbol .Lpcrel_hi3>
1104B	  SH %71:gpr, %219:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi3> :: (store (s16) into @g_73, !tbaa !20)
1120B	  %220:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_4, pre-instr-symbol <mcsymbol .Lpcrel_hi4>
1136B	  %73:gpr = ADDI %220:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi4>
1152B	  %74:gpr = LUI 3
1168B	  %75:gpr = ADDI %74:gpr, 2006
1184B	  SH %75:gpr, %73:gpr, 112 :: (store (s16) into `ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @g_4, i64 0, i64 7)`, align 4, !tbaa !20)
1200B	  %76:gpr = ADDI $x0, 37
1216B	  SW %76:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1232B	  %77:gpr = ADDI $x0, 2
1248B	  SW %77:gpr, %stack.0.l_200.i.i, 0 :: (store (s32) into %ir.l_200.i.i, !tbaa !16)
1264B	  %78:gpr = ADDI $x0, 5
1280B	  SW %78:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1296B	  %221:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_144, pre-instr-symbol <mcsymbol .Lpcrel_hi5>
1312B	  %80:gpr = LH %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (dereferenceable load (s16) from @g_144, !tbaa !20)
1328B	  %11:gpr = ADDI %80:gpr, -1
1344B	  SH %11:gpr, %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (store (s16) into @g_144, !tbaa !20)
1376B	  SH $x0, %73:gpr, 112 :: (store (s16) into `ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @g_4, i64 0, i64 7)`, align 4, !tbaa !20)
1392B	  %222:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_17, pre-instr-symbol <mcsymbol .Lpcrel_hi6>
1408B	  %83:gpr = LD %222:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi6> :: (dereferenceable load (s64) from @g_17, !tbaa !9)
1424B	  %84:gpr = LHU %83:gpr, 0 :: (load (s16) from %ir.4, align 4, !tbaa !16)
1440B	  %85:gpr = ANDI %84:gpr, 253
1456B	  %86:gpr = SUBW %11:gpr, %85:gpr
1472B	  %223:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_181, pre-instr-symbol <mcsymbol .Lpcrel_hi7>
1488B	  SB %86:gpr, %223:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi7> :: (store (s8) into @g_181, !tbaa !19)
1504B	  %88:gpr = SLLI %11:gpr, 48
1520B	  BEQ %88:gpr, $x0, %bb.9
1536B	  PseudoBR %bb.8

After:

1024B	bb.7.crc32_gentab.exit:
	; predecessors: %bb.6
	  successors: %bb.9(0x30000000), %bb.8(0x50000000); %bb.9(37.50%), %bb.8(62.50%)

1040B	  %218:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_29, pre-instr-symbol <mcsymbol .Lpcrel_hi2>
1056B	  %70:gpr = ADDI %218:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi2>
1072B	  %71:gpr = LH %70:gpr, 0 :: (dereferenceable load (s16) from @g_29, align 4, !tbaa !19)
1088B	  %219:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_73, pre-instr-symbol <mcsymbol .Lpcrel_hi3>
1104B	  SH %71:gpr, %219:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi3> :: (store (s16) into @g_73, !tbaa !20)
1120B	  %220:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_4, pre-instr-symbol <mcsymbol .Lpcrel_hi4>
1136B	  %73:gpr = ADDI %220:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi4>
1152B	  %74:gpr = LUI 3
1168B	  %75:gpr = ADDI %74:gpr, 2006
1184B	  SH %75:gpr, %73:gpr, 112 :: (store (s16) into `ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @g_4, i64 0, i64 7)`, align 4, !tbaa !20)
1200B	  %76:gpr = ADDI $x0, 37
1216B	  SW %76:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1232B	  %77:gpr = ADDI $x0, 2
1248B	  SW %77:gpr, %stack.0.l_200.i.i, 0 :: (store (s32) into %ir.l_200.i.i, !tbaa !16)
1296B	  %221:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_144, pre-instr-symbol <mcsymbol .Lpcrel_hi5>
1392B	  %222:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_17, pre-instr-symbol <mcsymbol .Lpcrel_hi6>
1408B	  %83:gpr = LD %222:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi6> :: (dereferenceable load (s64) from @g_17, !tbaa !9)
1416B	  %80:gpr = LH %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (dereferenceable load (s16) from @g_144, !tbaa !20)
1424B	  %78:gpr = ADDI $x0, 5
1432B	  SW %78:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1440B	  %84:gpr = LHU %83:gpr, 0 :: (load (s16) from %ir.4, align 4, !tbaa !16)
1448B	  %11:gpr = ADDI %80:gpr, -1
1456B	  SH %11:gpr, %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (store (s16) into @g_144, !tbaa !20)
1464B	  SH $x0, %73:gpr, 112 :: (store (s16) into `ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @g_4, i64 0, i64 7)`, align 4, !tbaa !20)
1472B	  %85:gpr = ANDI %84:gpr, 253
1480B	  %86:gpr = SUBW %11:gpr, %85:gpr
1488B	  %223:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_181, pre-instr-symbol <mcsymbol .Lpcrel_hi7>
1504B	  %88:gpr = SLLI %11:gpr, 48
1512B	  SB %86:gpr, %223:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi7> :: (store (s8) into @g_181, !tbaa !19)
1520B	  BEQ %88:gpr, $x0, %bb.9
1536B	  PseudoBR %bb.8

I guess there is a TBAA bug, but it is not caused by #81313, which causes another miscompilation #82586.

LLVM version: 0e8d187

cc @topperc @RKSimon

@dtcxzyw dtcxzyw added backend:RISC-V llvm:codegen miscompilation needs-reduction Large reproducer that should be reduced into a simpler form labels Feb 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Feb 22, 2024

@llvm/issue-subscribers-backend-risc-v

Author: Yingwei Zheng (dtcxzyw)

Reproducer (it is a RISC-V-only bug): ``` /* * This is a RANDOMLY GENERATED PROGRAM. * * Generator: csmith 2.4.0 * Git version: 0ec6f1b * Options: --max-funcs 3 --max-block-depth 3 --quiet --no-volatiles --no-volatile-pointers --output ./csmith2024-02-22@05:14/test71188.c * Seed: 2561487490 */

#include "csmith.h"

static long __undefined;

#pragma pack(push)
#pragma pack(1)
struct S0 {
unsigned f0 : 15;
unsigned f1 : 8;
const signed f2 : 10;
unsigned f3 : 14;
signed f4 : 5;
signed f5 : 8;
};
#pragma pack(pop)

#pragma pack(push)
#pragma pack(1)
struct S1 {
uint16_t f0;
int8_t f1;
};
#pragma pack(pop)

union U2 {
int32_t f0;
struct S1 f1;
struct S1 f2;
const signed f3 : 7;
};

union U3 {
uint16_t f0;
struct S1 f1;
uint32_t f2;
int32_t f3;
int32_t f4;
};

union U4 {
int64_t f0;
};

union U5 {
uint64_t f0;
};

static union U2 g_4[8][4] = {{{0x8B78ACC4L},{0xC58BDFADL},{-9L},{-9L}},{{0xEA964A90L},{0xEA964A90L},{0x6D21CD43L},{-8L}},{{0x7C7008B1L},{4L},{0x9642E40CL},{9L}},{{0x9642E40CL},{9L},{0x8B78ACC4L},{0x9642E40CL}},{{0xEA964A90L},{9L},{-1L},{9L}},{{9L},{4L},{-9L},{-8L}},{{0x79A20B28L},{0xEA964A90L},{0x8B78ACC4L},{-9L}},{{0x7C7008B1L},{0xC58BDFADL},{-4L},{9L}}};
static union U4 g_13 = {0x3E270BB1DCEDE6A6LL};
static int32_t *g_17 = &g_4[7][0].f0;
static union U2 g_29 = {1L};
static union U2 *g_28 = &g_29;
static uint16_t g_45 = 0x6D00L;
static uint32_t g_71[5] = {3UL,3UL,3UL,3UL,3UL};
static int16_t g_73 = 2L;
static uint64_t g_116 = 8UL;
static uint64_t *g_115 = &g_116;
static uint16_t g_144 = 0x7DB8L;
static struct S1 g_149 = {0x80BAL,1L};
static uint64_t g_165 = 0xD4FCCDB890218128LL;
static uint16_t *g_175 = &g_144;
static uint16_t **g_174 = &g_175;
static uint8_t g_181 = 0xE9L;
static union U5 g_189 = {18446744073709551615UL};
static union U3 g_226[8][3] = {{{0xA0C0L},{0UL},{0UL}},{{1UL},{4UL},{0x96E7L}},{{0xA0C0L},{0x4B21L},{0xA0C0L}},{{1UL},{0x4671L},{4UL}},{{0UL},{0UL},{0xA0C0L}},{{0x96E7L},{0x4671L},{0x4671L}},{{0xA0C0L},{0xFD01L},{0x4B21L}},{{0x96E7L},{0xC28FL},{0x96E7L}}};
static uint8_t g_244[9][5] = {{246UL,246UL,0x41L,246UL,246UL},{0x4EL,0x61L,0x4EL,0x4EL,0x61L},{246UL,2UL,2UL,246UL,2UL},{0x61L,0x61L,0xC3L,0x61L,0x61L},{2UL,246UL,2UL,2UL,246UL},{0x61L,0x4EL,0x4EL,0x61L,0x4EL},{246UL,246UL,0x41L,246UL,246UL},{0x4EL,0x61L,0x4EL,0x4EL,0x61L},{246UL,2UL,2UL,246UL,2UL}};
static int64_t g_255 = 1L;
static int32_t g_256 = 6L;
static int64_t g_257 = 0L;
static int32_t g_258 = (-1L);
static int16_t g_259 = 0xF022L;
static uint16_t g_260 = 0x509BL;
static int32_t g_268 = 0xBA2C1D85L;
static uint8_t g_270 = 0x7DL;

static struct S1 func_1(void);
static struct S1 func_5(union U5 p_6, union U4 p_7, uint64_t p_8);
static union U5 func_9(struct S0 p_10, struct S1 p_11);

static struct S1 func_1(void)
{
union U2 l_2 = (void)0;
union U2 l_3[8][9][3] = {{{&g_4[7][0],(void)0,&g_4[7][0]},{&g_4[5][0],&g_4[7][0],&g_4[0][2]},{&g_4[0][1],&g_4[6][0],&g_4[7][0]},{&g_4[7][1],&g_4[6][0],&g_4[7][0]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]},{&g_4[7][3],(void
)0,&g_4[7][0]},{(void*)0,&g_4[7][0],&g_4[0][2]},{(void*)0,&g_4[7][0],&g_4[4][0]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]}},{{&g_4[0][2],(void*)0,&g_4[5][3]},{&g_4[1][1],(void*)0,&g_4[7][0]},{&g_4[7][0],(void*)0,&g_4[3][0]},{&g_4[5][2],&g_4[7][0],&g_4[3][3]},{&g_4[7][2],&g_4[7][2],&g_4[7][0]},{&g_4[0][1],&g_4[5][3],&g_4[7][0]},{&g_4[0][2],&g_4[6][0],&g_4[6][2]},{&g_4[7][0],&g_4[3][3],&g_4[6][0]},{&g_4[2][1],&g_4[0][2],&g_4[6][2]}},{{&g_4[7][0],(void*)0,&g_4[7][0]},{(void*)0,&g_4[3][0],&g_4[7][0]},{&g_4[4][3],(void*)0,&g_4[3][3]},{&g_4[5][1],&g_4[5][0],&g_4[3][0]},{(void*)0,&g_4[1][0],&g_4[7][0]},{&g_4[4][0],&g_4[4][0],&g_4[5][3]},{&g_4[7][0],(void*)0,&g_4[7][0]},{&g_4[6][0],&g_4[7][0],&g_4[4][0]},{&g_4[6][0],&g_4[7][0],&g_4[0][2]}},{{&g_4[7][0],(void*)0,&g_4[7][0]},{&g_4[0][2],&g_4[2][1],&g_4[7][0]},{&g_4[6][0],&g_4[7][0],&g_4[7][0]},{(void*)0,&g_4[7][0],&g_4[7][0]},{(void*)0,&g_4[7][0],&g_4[0][2]},{&g_4[6][0],&g_4[7][0],&g_4[7][0]},{&g_4[0][2],&g_4[0][2],&g_4[7][0]},{&g_4[7][0],&g_4[0][0],&g_4[0][2]},{&g_4[6][0],&g_4[5][1],&g_4[7][1]}},{{&g_4[6][0],&g_4[7][0],&g_4[4][1]},{&g_4[7][0],(void*)0,&g_4[4][0]},{&g_4[4][0],&g_4[0][0],&g_4[2][1]},{(void*)0,&g_4[7][0],&g_4[7][0]},{&g_4[5][1],&g_4[3][2],&g_4[3][2]},{&g_4[4][3],&g_4[7][0],&g_4[0][2]},{(void*)0,&g_4[7][3],&g_4[7][0]},{&g_4[7][0],&g_4[5][2],&g_4[7][0]},{(void*)0,&g_4[0][1],&g_4[5][0]}},{{&g_4[7][0],&g_4[7][0],&g_4[5][1]},{&g_4[0][2],&g_4[7][3],&g_4[7][0]},{&g_4[5][3],&g_4[0][2],&g_4[7][0]},{&g_4[6][0],&g_4[6][2],&g_4[6][2]},{&g_4[7][0],&g_4[5][1],&g_4[7][3]},{(void*)0,&g_4[7][0],(void*)0},{&g_4[7][0],&g_4[6][2],&g_4[7][0]},{&g_4[6][0],&g_4[3][3],(void*)0},{&g_4[4][0],&g_4[3][1],&g_4[7][0]}},{{&g_4[4][3],(void*)0,(void*)0},{&g_4[0][1],&g_4[6][0],&g_4[6][0]},{&g_4[7][0],(void*)0,&g_4[0][0]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]},{&g_4[0][1],&g_4[7][0],&g_4[7][0]},{&g_4[7][0],&g_4[7][0],&g_4[0][0]},{&g_4[7][3],(void*)0,&g_4[6][0]},{&g_4[7][0],&g_4[0][2],(void*)0},{&g_4[7][0],&g_4[7][2],&g_4[7][0]}},{{&g_4[7][0],&g_4[7][0],(void*)0},{&g_4[2][1],&g_4[7][0],&g_4[7][0]},{&g_4[7][0],&g_4[7][0],(void*)0},{&g_4[1][0],&g_4[7][0],&g_4[7][3]},{&g_4[7][0],&g_4[7][3],&g_4[6][2]},{&g_4[7][0],&g_4[7][0],&g_4[7][0]},{&g_4[7][0],&g_4[0][0],&g_4[7][0]},{&g_4[7][0],(void*)0,&g_4[5][1]},{(void*)0,&g_4[0][2],&g_4[5][0]}}};
struct S0 l_12 = {12,6,31,30,2,7};
struct S1 l_14 = {0xDB1AL,0x3BL};
int32_t l_266 = 0xC236062CL;
int32_t l_267 = 0xB78067A0L;
int32_t l_269[3];
int i, j, k;
for (i = 0; i < 3; i++)
l_269[i] = 4L;
l_3[2][7][2] = (void*)0;
l_14 = func_5(func_9(l_12, (g_13 , l_14)), g_13, l_12.f4);
for (g_29.f1.f1 = 0; (g_29.f1.f1 == (-26)); --g_29.f1.f1)
{
int32_t l_265[6][2] = {{(void)0,(void*)0},{&g_256,(void*)0},{(void*)0,&g_256},{(void*)0,(void*)0},{&g_256,(void*)0},{(void*)0,&g_256}};
int i, j;
g_270--;
}
return l_14;
}

static struct S1 func_5(union U5 p_6, union U4 p_7, uint64_t p_8)
{
int64_t l_79 = 0x5013F2C8C67737D6LL;
int16_t *l_99 = &g_73;
uint16_t *l_107 = &g_4[7][0].f1.f0;
int32_t *l_117[2][5] = {{&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0},{&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0,&g_29.f0}};
int32_t l_143[9][6] = {{(-2L),0x645DA593L,0x16BB261DL,(-2L),7L,7L},{0x7B4A3B70L,0x645DA593L,0x645DA593L,0x7B4A3B70L,7L,0x16BB261DL},{8L,0x645DA593L,7L,8L,7L,0x645DA593L},{(-2L),0x645DA593L,0x16BB261DL,(-2L),7L,7L},{0x7B4A3B70L,0x645DA593L,0x645DA593L,0x7B4A3B70L,7L,0x16BB261DL},{8L,0x645DA593L,7L,8L,7L,0x645DA593L},{(-2L),0x645DA593L,0x16BB261DL,(-2L),7L,7L},{0x7B4A3B70L,0x645DA593L,0x645DA593L,0x7B4A3B70L,7L,0x16BB261DL},{8L,0x645DA593L,7L,8L,7L,0x645DA593L}};
struct S1 l_204[2][4] = {{{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L}},{{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L},{0x977AL,0x77L}}};
union U2 **l_209 = &g_28;
int32_t **l_254 = &l_117[0][1];
int i, j;
if ((safe_sub_func_uint16_t_u_u((safe_sub_func_int16_t_s_s(9L, l_79)), (safe_rshift_func_int32_t_s_s((g_29.f0 = (safe_add_func_int8_t_s_s((((safe_lshift_func_uint16_t_u_s((((safe_sub_func_uint8_t_u_u(((safe_div_func_uint8_t_u_u(((safe_unary_minus_func_uint64_t_u((safe_div_func_int32_t_s_s((safe_add_func_uint8_t_u_u((safe_div_func_uint64_t_u_u(((safe_add_func_int16_t_s_s(((l_99) = g_29.f0), ((safe_sub_func_int64_t_s_s((safe_lshift_func_int8_t_s_s(0x22L, 1)), (safe_div_func_uint16_t_u_u(((l_107) = l_79), ((safe_mul_func_uint16_t_u_u((safe_div_func_uint8_t_u_u((l_79 & (0xC4L ^ (!(safe_div_func_uint8_t_u_u(((((void)0 != g_115) ^ g_29.f0) <= g_71[1]), 1L))))), 255UL)), 0x4290L)) & g_29.f0)))))))) && g_71[1]), (g_115))), 1L)), g_29.f0)))) < p_6.f0), 8UL)) <= 0x5C710B0AL), g_116)) < 0x47AC3CA6ABCE8417LL) && l_79), g_45)) , (g_115)) || p_6.f0), 0x24L))), 2)))))
{
const int8_t l_135 = 0xF0L;
int32_t l_142[9][10] = {{(-6L),0x6F6008F0L,(-1L),1L,9L,0L,0x56E8D107L,0L,9L,1L},{0x2AEDA2CAL,0xD69FAF8FL,0x2AEDA2CAL,0x30D721F5L,0xA0BFB30CL,0x7B95470CL,0L,0x77A9A3A1L,0x6F6008F0L,0x3BCE19DEL},{(-1L),0xB7F3AE84L,(-1L),0x7B95470CL,(-2L),1L,0xDCF32642L,4L,0xD69FAF8FL,0L},{0x23CDDDF8L,0xB442378EL,0x7B95470CL,1L,0x3BCE19DEL,7L,0xA0BFB30CL,(-1L),0x77A9A3A1L,9L},{0xB442378EL,0x56E8D107L,0L,4L,0x6F6008F0L,0x6F6008F0L,4L,0L,0x56E8D107L,0xB442378EL},{(-1L),(-1L),0xA0BFB30CL,(-1L),(-6L),1L,(-9L),(-10L),0x2AEDA2CAL,(-1L)},{0xD69FAF8FL,0x6F6008F0L,1L,(-1L),(-6L),(-3L),9L,(-1L),0x30D721F5L,0xB442378EL},{(-6L),(-9L),0xB442378EL,0L,0x6F6008F0L,(-1L),0xD69FAF8FL,9L,1L,9L},{0xD6BF538CL,0xDCF32642L,0x3BCE19DEL,1L,0x3BCE19DEL,0xDCF32642L,0xD6BF538CL,(-1L),4L,0L}};
union U3 l_199 = {8UL};
int32_t l_200 = 2L;
int32_t l_251[1][7] = {{&g_17,&g_17,&l_117[0][1],&g_17,&g_17,&l_117[0][1],&g_17}};
int32_t * const l_252 = &l_200;
int32_t l_253 = &g_17;
int i, j;
for (p_6.f0 = 0; (p_6.f0 > 16); p_6.f0 = safe_add_func_int16_t_s_s(p_6.f0, 6))
{
uint32_t l_126 = 0xA4EB99B8L;
int32_t l_136 = (-1L);
int32_t l_169 = 1L;
int32_t l_170 = 0x87D1255FL;
uint8_t l_180[5][5] = {{&g_181,&g_181,&g_181,&g_181,&g_181},{(void)0,(void
)0,(void
)0,(void
)0,(void
)0},{&g_181,&g_181,&g_181,&g_181,&g_181},{(void
)0,&g_181,&g_181,(void
)0,&g_181},{&g_181,&g_181,&g_181,&g_181,&g_181}};
struct S0 l_185 = {53,0,31,75,3,6};
uint16_t **l_186 = &g_175;
union U5 *l_190 = &g_189;
uint32_t *l_191 = &l_126;
int i, j;
}
for (p_7.f0 = (-12); (p_7.f0 <= (-12)); p_7.f0++)
{
uint16_t *l_227 = &l_204[0][0].f0;
int32_t l_228 = (-3L);
uint8_t *l_229 = &g_181;
int32_t l_237 = 8L;
int16_t l_238 = 1L;
int32_t l_239[1][1][4] = {{{8L,8L,8L,8L}}};
uint32_t l_247 = 4294967295UL;
int32_t *l_250 = (void)0;
int i, j, k;
for (g_29.f0 = 1; (g_29.f0 <= 4); g_29.f0 += 1)
{
int32_t **l_207 = &l_117[0][1];
(*l_207) = g_17;
}
if ((
((l_209 == (void
)0) < ((*l_229) = (safe_sub_func_uint16_t_u_u((--(*g_175)), (((((-6L) && (safe_mod_func_uint16_t_u_u(l_142[4][3], (safe_rshift_func_uint64_t_u_s((safe_mul_func_uint16_t_u_u((((*l_107) = ((safe_mul_func_uint8_t_u_u(g_116, (l_199.f4 = (g_165 || (safe_add_func_uint16_t_u_u(l_142[6][9], 1L)))))) <= (safe_div_func_uint16_t_u_u(((*l_227) ^= (g_226[3][2] , 0UL)), 0x501EL)))) ^ l_142[4][3]), p_8)), l_142[4][3]))))) , p_8) , (*g_17)) & l_228)))))))
{
union U2 l_234 = {-8L};
int32_t l_240 = 1L;
int32_t l_241 = 0xB8815D8FL;
int32_t l_242 = 0xFF450A72L;
int32_t l_243 = 0x8C6111A7L;
l_200 |= ((safe_mul_func_int64_t_s_s((safe_div_func_int16_t_s_s(0xA634L, (**g_174))), (0L | (l_234 , (-1L))))) || (l_228 , (safe_lshift_func_uint32_t_u_u(0UL, 24))));
g_244[5][3]++;
l_247++;
}
else
{
if ((*g_17))
break;
}
l_117[0][1] = l_117[0][1];
}
g_17 = g_17;
(*l_253) = l_252;
}
else
{
(*g_17) |= p_7.f0;
return g_149;
}
(*l_254) = l_117[1][1];
g_260--;
return l_204[0][2];
}

static union U5 func_9(struct S0 p_10, struct S1 p_11)
{
int8_t l_15 = (-1L);
union U5 l_16 = {0x9D7FCCEA59F7C1AELL};
int32_t l_18 = &g_17;
const int32_t l_24 = &g_4[7][0].f0;
union U4 l_25[10] = {{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL},{0x57240E60136B8055LL}};
struct S1 l_35[1][9] = {{{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL},{0x6938L,0x8DL}}};
uint16_t l_52 = 1UL;
int16_t l_72 = 0xCDD4L;
union U5 l_74 = {18446744073709551613UL};
int i, j;
l_15 = (g_4[7][0].f0 >= (-4L));
(l_18) = (l_16 , g_17);
for (l_15 = 25; (l_15 == (-19)); l_15 = safe_sub_func_int16_t_s_s(l_15, 6))
{
const int32_t l_21 = &g_4[7][0].f0;
const int32_t l_22 = (void)0;
const int32_t l_23[8] = {&l_21,&l_21,&l_21,&l_21,&l_21,&l_21,&l_21,&l_21};
int i;
l_24 = l_21;
}
for (p_11.f1 = 9; (p_11.f1 >= 0); p_11.f1 -= 1)
{
int8_t l_31[3][1][10] = {{{0xCBL,0xCBL,(-1L),4L,(-1L),0xCBL,0xCBL,(-1L),4L,(-1L)}},{{0xCBL,0xCBL,(-1L),4L,(-1L),0xCBL,0xCBL,(-1L),4L,(-1L)}},{{0xCBL,0xCBL,(-1L),4L,(-1L),0xCBL,0xCBL,(-1L),4L,(-1L)}}};
int32_t l_41[10][8][3] = {{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}},{{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0},{&g_29.f0,&g_29.f0,&g_29.f0},{&g_4[7][0].f0,&g_4[7][0].f0,&g_4[7][0].f0}}};
union U2 l_51 = &g_4[6][1];
int8_t l_70 = (-1L);
int i, j, k;
for (l_15 = 9; (l_15 >= 0); l_15 -= 1)
{
union U2 l_27[8];
union U2 l_26 = &l_27[4];
uint64_t l_30[6][10][4] = {{{(void)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void
)0,(void
)0,(void
)0,(void
)0},{(void
)0,(void
)0,(void
)0,&l_16.f0},{&l_16.f0,(void
)0,(void
)0,&l_16.f0},{(void
)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void
)0,(void
)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void
)0,(void*)0,(void*)0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0}},{{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0}},{{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,(void*)0},{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0}},{{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,(void*)0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0}},{{(void*)0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,(void*)0}},{{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,&l_16.f0},{(void*)0,&l_16.f0,(void*)0,(void*)0},{&l_16.f0,&l_16.f0,(void*)0,&l_16.f0},{&l_16.f0,(void*)0,&l_16.f0,(void*)0},{(void*)0,&l_16.f0,(void*)0,&l_16.f0},{(void*)0,&l_16.f0,&l_16.f0,(void*)0},{&l_16.f0,(void*)0,(void*)0,&l_16.f0},{&l_16.f0,&l_16.f0,&l_16.f0,(void*)0}}};
int32_t l_32[10] = {3L,3L,0x0C4F586FL,(-1L),0x0C4F586FL,3L,3L,0x0C4F586FL,(-1L),0x0C4F586FL};
uint64_t l_46 = 0xE796224A103C2894LL;
int i, j, k;
for (i = 0; i < 8; i++)
l_27[i] = &g_4[7][0];
if (((p_10.f3 == (l_31[2][0][6] |= ((g_28 = ((l_26) = (void)0)) == &g_29))) >= p_10.f5))
{
uint16_t l_42 = (void)0;
uint16_t l_43 = (void)0;
uint16_t *l_44 = &g_4[7][0].f1.f0;
g_45 |= ((-5L) <= ((g_29.f0 != ((0xEDB0L > g_13.f0) != (l_32[5] & (((safe_sub_func_uint32_t_u_u((l_35[0][0] , (safe_div_func_uint16_t_u_u(((l_44) = (((safe_rshift_func_uint8_t_u_s(g_29.f0, p_10.f3)) & (!((l_41[4][6][1] = g_17) != (void)0))) < (l_18))), g_29.f0))), p_10.f2)) , 0x92L) < 0xFCL)))) < p_11.f1));
}
else
{
++l_46;
if (p_10.f4)
break;
}
g_73 ^= ((l_52 = (p_10 , (((void
)0 == l_51) == ((void
)0 == &g_17)))) != ((g_13.f0 && (l_32[5] = ((-1L) || (safe_mul_func_uint8_t_u_u((safe_add_func_int32_t_s_s(((*g_17) = (((((((8L || (safe_mul_func_int64_t_s_s((~((safe_mul_func_uint64_t_u_u((g_71[1] = ((safe_div_func_int16_t_s_s(((safe_mul_func_uint64_t_u_u((safe_add_func_uint8_t_u_u((safe_add_func_uint64_t_u_u(0UL, (-10L))), g_4[7][0].f0)), 0L)) && g_29.f0), l_70)) != (**l_18))), p_10.f5)) && g_71[2])), (**l_18)))) && l_72) < p_10.f3) && 0x4046E41CA980D529LL) == (*g_17)) , (**l_18)) < (*g_17))), p_10.f1)), (-1L)))))) < p_10.f3));
}
}
return l_74;
}

int main (int argc, char* argv[])
{
int i, j;
int print_hash_value = 0;
if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
platform_main_begin();
crc32_gentab();
func_1();
for (i = 0; i < 8; i++)
{
for (j = 0; j < 4; j++)
{
transparent_crc(g_4[i][j].f0, "g_4[i][j].f0", print_hash_value);
if (print_hash_value) printf("index = [%d][%d]\n", i, j);

    }
}
transparent_crc(g_13.f0, "g_13.f0", print_hash_value);
transparent_crc(g_29.f0, "g_29.f0", print_hash_value);
transparent_crc(g_45, "g_45", print_hash_value);
for (i = 0; i &lt; 5; i++)
{
    transparent_crc(g_71[i], "g_71[i]", print_hash_value);
    if (print_hash_value) printf("index = [%d]\n", i);

}
transparent_crc(g_73, "g_73", print_hash_value);
transparent_crc(g_116, "g_116", print_hash_value);
transparent_crc(g_144, "g_144", print_hash_value);
transparent_crc(g_149.f0, "g_149.f0", print_hash_value);
transparent_crc(g_149.f1, "g_149.f1", print_hash_value);
transparent_crc(g_165, "g_165", print_hash_value);
transparent_crc(g_181, "g_181", print_hash_value);
transparent_crc(g_189.f0, "g_189.f0", print_hash_value);
for (i = 0; i &lt; 8; i++)
{
    for (j = 0; j &lt; 3; j++)
    {
        transparent_crc(g_226[i][j].f0, "g_226[i][j].f0", print_hash_value);
        if (print_hash_value) printf("index = [%d][%d]\n", i, j);

    }
}
for (i = 0; i &lt; 9; i++)
{
    for (j = 0; j &lt; 5; j++)
    {
        transparent_crc(g_244[i][j], "g_244[i][j]", print_hash_value);
        if (print_hash_value) printf("index = [%d][%d]\n", i, j);

    }
}
transparent_crc(g_255, "g_255", print_hash_value);
transparent_crc(g_256, "g_256", print_hash_value);
transparent_crc(g_257, "g_257", print_hash_value);
transparent_crc(g_258, "g_258", print_hash_value);
transparent_crc(g_259, "g_259", print_hash_value);
transparent_crc(g_260, "g_260", print_hash_value);
transparent_crc(g_268, "g_268", print_hash_value);
transparent_crc(g_270, "g_270", print_hash_value);
platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
return 0;

}

/************************ statistics *************************
XXX max struct depth: 1
breakdown:
depth: 0, occurrence: 64
depth: 1, occurrence: 6
XXX total union variables: 7

XXX non-zero bitfields defined in structs: 7
XXX zero bitfields defined in structs: 0
XXX const bitfields defined in structs: 2
XXX volatile bitfields defined in structs: 0
XXX structs with bitfields in the program: 7
breakdown:
indirect level: 0, occurrence: 3
indirect level: 1, occurrence: 3
indirect level: 2, occurrence: 1
XXX full-bitfields structs in the program: 2
breakdown:
indirect level: 0, occurrence: 2
XXX times a bitfields struct's address is taken: 72
XXX times a bitfields struct on LHS: 0
XXX times a bitfields struct on RHS: 6
XXX times a single bitfield on LHS: 0
XXX times a single bitfield on RHS: 10

XXX max expression depth: 34
breakdown:
depth: 1, occurrence: 38
depth: 2, occurrence: 9
depth: 7, occurrence: 2
depth: 8, occurrence: 1
depth: 18, occurrence: 1
depth: 23, occurrence: 1
depth: 31, occurrence: 1
depth: 34, occurrence: 1

XXX total number of pointers: 51

XXX times a variable address is taken: 141
XXX times a pointer is dereferenced on RHS: 14
breakdown:
depth: 1, occurrence: 8
depth: 2, occurrence: 6
XXX times a pointer is dereferenced on LHS: 22
breakdown:
depth: 1, occurrence: 22
XXX times a pointer is compared with null: 5
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: 417

XXX max dereference level: 2
breakdown:
level: 0, occurrence: 0
level: 1, occurrence: 59
level: 2, occurrence: 10
XXX number of pointers point to pointers: 17
XXX number of pointers point to scalars: 28
XXX number of pointers point to structs: 1
XXX percent of pointers has null in alias set: 35.3
XXX average alias set size: 1.29

XXX times a non-volatile is read: 160
XXX times a non-volatile is write: 86
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: 35
XXX max block depth: 3
breakdown:
depth: 0, occurrence: 13
depth: 1, occurrence: 9
depth: 2, occurrence: 5
depth: 3, occurrence: 8

XXX percentage a fresh-made variable is used: 26.5
XXX percentage an existing variable is used: 73.5
FYI: the random generator makes assumptions about the integer size. See platform.info for more details.
XXX total OOB instances added: 0
********************* end of statistics **********************/

I am sorry I cannot provide a minimal reproducer.

Commands:

bin/clang -O1 test.c --target=riscv64-linux-gnu -I/usr/include/csmith -w
qemu-riscv64 -L /usr/riscv64-linux-gnu/ ./a.out

The result should be `checksum = A559693C`, but qemu returns `checksum = FC86B582`.

Bisect to `Machine Instruction Scheduler`:

bin/clang -O1 test.c --target=riscv64-linux-gnu -I/usr/include/csmith -w -mllvm -opt-bisect-limit=1340 -mllvm -debug-only=machine-scheduler -mllvm --misched-only-block=7 2>log


Before MISched:

1024B bb.7.crc32_gentab.exit:
; predecessors: %bb.6
successors: %bb.9(0x30000000), %bb.8(0x50000000); %bb.9(37.50%), %bb.8(62.50%)

1040B %218:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_29, pre-instr-symbol <mcsymbol .Lpcrel_hi2>
1056B %70:gpr = ADDI %218:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi2>
1072B %71:gpr = LH %70:gpr, 0 :: (dereferenceable load (s16) from @g_29, align 4, !tbaa !19)
1088B %219:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_73, pre-instr-symbol <mcsymbol .Lpcrel_hi3>
1104B SH %71:gpr, %219:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi3> :: (store (s16) into @g_73, !tbaa !20)
1120B %220:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_4, pre-instr-symbol <mcsymbol .Lpcrel_hi4>
1136B %73:gpr = ADDI %220:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi4>
1152B %74:gpr = LUI 3
1168B %75:gpr = ADDI %74:gpr, 2006
1184B SH %75:gpr, %73:gpr, 112 :: (store (s16) into ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @<!-- -->g_4, i64 0, i64 7), align 4, !tbaa !20)
1200B %76:gpr = ADDI $x0, 37
1216B SW %76:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1232B %77:gpr = ADDI $x0, 2
1248B SW %77:gpr, %stack.0.l_200.i.i, 0 :: (store (s32) into %ir.l_200.i.i, !tbaa !16)
1264B %78:gpr = ADDI $x0, 5
1280B SW %78:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1296B %221:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_144, pre-instr-symbol <mcsymbol .Lpcrel_hi5>
1312B %80:gpr = LH %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (dereferenceable load (s16) from @g_144, !tbaa !20)
1328B %11:gpr = ADDI %80:gpr, -1
1344B SH %11:gpr, %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (store (s16) into @g_144, !tbaa !20)
1376B SH $x0, %73:gpr, 112 :: (store (s16) into ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @<!-- -->g_4, i64 0, i64 7), align 4, !tbaa !20)
1392B %222:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_17, pre-instr-symbol <mcsymbol .Lpcrel_hi6>
1408B %83:gpr = LD %222:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi6> :: (dereferenceable load (s64) from @g_17, !tbaa !9)
1424B %84:gpr = LHU %83:gpr, 0 :: (load (s16) from %ir.4, align 4, !tbaa !16)
1440B %85:gpr = ANDI %84:gpr, 253
1456B %86:gpr = SUBW %11:gpr, %85:gpr
1472B %223:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_181, pre-instr-symbol <mcsymbol .Lpcrel_hi7>
1488B SB %86:gpr, %223:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi7> :: (store (s8) into @g_181, !tbaa !19)
1504B %88:gpr = SLLI %11:gpr, 48
1520B BEQ %88:gpr, $x0, %bb.9
1536B PseudoBR %bb.8

After:

1024B bb.7.crc32_gentab.exit:
; predecessors: %bb.6
successors: %bb.9(0x30000000), %bb.8(0x50000000); %bb.9(37.50%), %bb.8(62.50%)

1040B %218:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_29, pre-instr-symbol <mcsymbol .Lpcrel_hi2>
1056B %70:gpr = ADDI %218:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi2>
1072B %71:gpr = LH %70:gpr, 0 :: (dereferenceable load (s16) from @g_29, align 4, !tbaa !19)
1088B %219:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_73, pre-instr-symbol <mcsymbol .Lpcrel_hi3>
1104B SH %71:gpr, %219:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi3> :: (store (s16) into @g_73, !tbaa !20)
1120B %220:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_4, pre-instr-symbol <mcsymbol .Lpcrel_hi4>
1136B %73:gpr = ADDI %220:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi4>
1152B %74:gpr = LUI 3
1168B %75:gpr = ADDI %74:gpr, 2006
1184B SH %75:gpr, %73:gpr, 112 :: (store (s16) into ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @<!-- -->g_4, i64 0, i64 7), align 4, !tbaa !20)
1200B %76:gpr = ADDI $x0, 37
1216B SW %76:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1232B %77:gpr = ADDI $x0, 2
1248B SW %77:gpr, %stack.0.l_200.i.i, 0 :: (store (s32) into %ir.l_200.i.i, !tbaa !16)
1296B %221:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_144, pre-instr-symbol <mcsymbol .Lpcrel_hi5>
1392B %222:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_17, pre-instr-symbol <mcsymbol .Lpcrel_hi6>
1408B %83:gpr = LD %222:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi6> :: (dereferenceable load (s64) from @g_17, !tbaa !9)
1416B %80:gpr = LH %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (dereferenceable load (s16) from @g_144, !tbaa !20)
1424B %78:gpr = ADDI $x0, 5
1432B SW %78:gpr, %70:gpr, 0 :: (store (s32) into @g_29, !tbaa !19)
1440B %84:gpr = LHU %83:gpr, 0 :: (load (s16) from %ir.4, align 4, !tbaa !16)
1448B %11:gpr = ADDI %80:gpr, -1
1456B SH %11:gpr, %221:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi5> :: (store (s16) into @g_144, !tbaa !20)
1464B SH $x0, %73:gpr, 112 :: (store (s16) into ptr getelementptr inbounds ([8 x [4 x %union.U2]], ptr @<!-- -->g_4, i64 0, i64 7), align 4, !tbaa !20)
1472B %85:gpr = ANDI %84:gpr, 253
1480B %86:gpr = SUBW %11:gpr, %85:gpr
1488B %223:gpr = AUIPC target-flags(riscv-pcrel-hi) @g_181, pre-instr-symbol <mcsymbol .Lpcrel_hi7>
1504B %88:gpr = SLLI %11:gpr, 48
1512B SB %86:gpr, %223:gpr, target-flags(riscv-pcrel-lo) <mcsymbol .Lpcrel_hi7> :: (store (s8) into @g_181, !tbaa !19)
1520B BEQ %88:gpr, $x0, %bb.9
1536B PseudoBR %bb.8


I guess there is a TBAA bug, but it is not caused by https://github.com/llvm/llvm-project/pull/81313, which causes another miscompilation https://github.com/llvm/llvm-project/issues/82586.

LLVM version: 0e8d1877cd145719b7acb707539287b7b877a555

cc @<!-- -->topperc @<!-- -->RKSimon 
</details>

@dtcxzyw
Copy link
Member Author

dtcxzyw commented Feb 23, 2024

Another TBAA-related reproducer (bisected to DAGCombine):

bin/clang -O1 test.c -w --target=riscv64-linux-gnu -I/usr/include/csmith -mllvm -opt-bisect-limit=1546 -mllvm -debug-only=isel -mllvm -debug-counter=dagcombine-count=761
checksum = 304A8211

bin/clang -O1 test.c -w --target=riscv64-linux-gnu -I/usr/include/csmith -mllvm -combiner-use-tbaa=false
checksum = C68D3D0D
/*
 * This is a RANDOMLY GENERATED PROGRAM.
 *
 * Generator: csmith 2.4.0
 * Git version: 0ec6f1b
 * Options:   --max-funcs 3 --max-block-depth 3 --quiet --no-volatiles --no-volatile-pointers --output ./csmith2024-02-22@22:43/test69782.c
 * Seed:      2164501822
 */

#include "csmith.h"


static long __undefined;


struct S0 {
   uint8_t  f0;
   uint32_t  f1;
   const unsigned f2 : 22;
   const uint16_t  f3;
   const uint32_t  f4;
   uint64_t  f5;
   int32_t  f6;
   int64_t  f7;
   uint32_t  f8;
   uint64_t  f9;
};

#pragma pack(push)
#pragma pack(1)
struct S1 {
   int16_t  f0;
};
#pragma pack(pop)

union U2 {
   unsigned f0 : 21;
   const struct S1  f1;
   uint64_t  f2;
   unsigned f3 : 8;
   uint8_t  f4;
};

union U3 {
   int32_t  f0;
   int64_t  f1;
};


static int32_t g_2 = 0xE4562513L;
static uint16_t g_33 = 0x8E60L;
static union U3 g_35 = {-1L};
static struct S0 g_39 = {0UL,0UL,2020,0UL,0x52F0C8C5L,0UL,0xB8B0E313L,0x5901A7003B9FE29FLL,0x9B52D9B6L,0UL};
static int64_t g_66[3] = {4L,4L,4L};
static const uint8_t * const g_90 = (void*)0;
static int16_t g_92 = 0L;
static int32_t *g_95 = &g_35.f0;
static uint16_t g_98 = 65530UL;
static struct S1 g_113 = {0x58A0L};
static union U2 g_122[3] = {{4294967290UL},{4294967290UL},{4294967290UL}};
static union U2 *g_121 = &g_122[0];
static int16_t g_154[9] = {0L,0L,0L,0L,0L,0L,0L,0L,0L};
static uint32_t g_161 = 0x83A5F4DCL;
static struct S0 g_167 = {4UL,18446744073709551615UL,1646,0x5D84L,4294967295UL,0x5546736D523453A6LL,-4L,0xD5E1E2EF9C45FBFBLL,0x40514D0CL,0xBB409F4FCCDD416DLL};
static int32_t g_176 = 0x15DD58F1L;
static int32_t g_178 = 0xC24B0653L;
static uint16_t g_179 = 65534UL;
static struct S0 g_183 = {4UL,1UL,1501,4UL,4294967295UL,0xD3234534E8C1A8F9LL,3L,-7L,0x8B330E33L,0xDEEBD24BBF92495ELL};
static struct S0 *g_182[3] = {&g_183,&g_183,&g_183};
static const int32_t g_189 = 0x848F50E0L;
static const int32_t g_191 = 0x8C45096FL;
static uint16_t g_204 = 65535UL;
static int8_t g_233 = 0xAFL;
static const int16_t g_246 = 0x0EE4L;
static union U2 **g_259 = (void*)0;
static uint16_t *g_281[8] = {&g_204,&g_204,&g_204,&g_204,&g_204,&g_204,&g_204,&g_204};
static uint16_t **g_280 = &g_281[4];
static int16_t g_302 = 0L;
static int16_t g_304 = 1L;
static int32_t g_305 = 0x2EDEBC26L;
static int16_t g_306[7][10][3] = {{{0xD6F9L,0x2540L,(-6L)},{0x5294L,0x7BB8L,(-1L)},{(-1L),0x4724L,0x94B7L},{0x6360L,(-1L),(-1L)},{0x076FL,0xA5CBL,(-6L)},{0x39DFL,0x900CL,0x62C9L},{0x076FL,0x94B7L,0xA3DEL},{(-1L),0x2AA4L,(-5L)},{0x2540L,0L,0x617CL},{1L,(-9L),0x7640L}},{{0xA5CBL,0x617CL,0x617CL},{1L,0L,(-5L)},{(-6L),0x46F1L,0xA3DEL},{1L,0x7640L,0x7729L},{0xA5CBL,(-1L),0x9100L},{1L,0x7640L,0L},{0x2540L,0x46F1L,0L},{(-1L),0L,0L},{(-1L),0x617CL,0x9100L},{(-4L),(-9L),0x7729L}},{{(-1L),0L,0xA3DEL},{(-1L),0x2AA4L,(-5L)},{0x2540L,0L,0x617CL},{1L,(-9L),0x7640L},{0xA5CBL,0x617CL,0x617CL},{1L,0L,(-5L)},{(-6L),0x46F1L,0xA3DEL},{1L,0x7640L,0x7729L},{0xA5CBL,(-1L),0x9100L},{1L,0x7640L,0L}},{{0x2540L,0x46F1L,0L},{(-1L),0L,0L},{(-1L),0x617CL,0x9100L},{(-4L),(-9L),0x7729L},{(-1L),0L,0xA3DEL},{(-1L),0x2AA4L,(-5L)},{0x2540L,0L,0x617CL},{1L,(-9L),0x7640L},{0xA5CBL,0x617CL,0x617CL},{1L,0L,(-5L)}},{{(-6L),0x46F1L,0xA3DEL},{1L,0x7640L,0x7729L},{0xA5CBL,(-1L),0x9100L},{1L,0x7640L,0L},{0x2540L,0x46F1L,0L},{(-1L),0L,0L},{(-1L),0x617CL,0x9100L},{(-4L),(-9L),0x7729L},{(-1L),0L,0xA3DEL},{(-1L),0x2AA4L,(-5L)}},{{0x2540L,0L,0x617CL},{1L,(-9L),0x7640L},{0xA5CBL,0x617CL,0x617CL},{1L,0L,(-5L)},{(-6L),0x46F1L,0xA3DEL},{1L,0x7640L,0x7729L},{0xA5CBL,(-1L),0x9100L},{1L,0x7640L,0L},{0x2540L,0x46F1L,0L},{(-1L),0L,0L}},{{(-1L),0x617CL,0x9100L},{(-4L),(-9L),0x7729L},{(-1L),0L,0xA3DEL},{(-1L),0x2AA4L,(-5L)},{0x2540L,0L,0x617CL},{1L,(-9L),0x7640L},{0xA5CBL,0x617CL,0x617CL},{1L,0L,(-5L)},{(-6L),0x46F1L,0xA3DEL},{1L,0x7640L,0x7729L}}};
static int8_t g_307 = 0x8BL;
static uint32_t g_308 = 4294967294UL;
static int32_t g_328 = (-5L);
static int16_t ** const g_351 = (void*)0;



static int64_t  func_1(void);
static struct S1  func_15(union U2  p_16, struct S0  p_17, int32_t  p_18, uint16_t  p_19);
static struct S0  func_21(const uint32_t  p_22, uint32_t  p_23, union U2  p_24, uint32_t  p_25, union U3  p_26);





static int64_t  func_1(void)
{ 
    union U2 l_27 = {0UL};
    uint16_t *l_34 = &g_33;
    const union U3 l_266[2] = {{1L},{1L}};
    struct S0 l_292[7] = {{0xB2L,0x85EE6CBCL,965,0x4B87L,0x9AF88B44L,18446744073709551615UL,3L,7L,0x48865426L,0x4264617ACAAF1FE2LL},{0xB2L,0x85EE6CBCL,965,0x4B87L,0x9AF88B44L,18446744073709551615UL,3L,7L,0x48865426L,0x4264617ACAAF1FE2LL},{0xA6L,0x2E6C3BA4L,913,0UL,0xAFA0B42BL,0x93B70FBF4B7DB339LL,0xE590C066L,0xD9598FA45CCDEC9CLL,0x4ECB6273L,18446744073709551610UL},{0xB2L,0x85EE6CBCL,965,0x4B87L,0x9AF88B44L,18446744073709551615UL,3L,7L,0x48865426L,0x4264617ACAAF1FE2LL},{0xB2L,0x85EE6CBCL,965,0x4B87L,0x9AF88B44L,18446744073709551615UL,3L,7L,0x48865426L,0x4264617ACAAF1FE2LL},{0xA6L,0x2E6C3BA4L,913,0UL,0xAFA0B42BL,0x93B70FBF4B7DB339LL,0xE590C066L,0xD9598FA45CCDEC9CLL,0x4ECB6273L,18446744073709551610UL},{0xB2L,0x85EE6CBCL,965,0x4B87L,0x9AF88B44L,18446744073709551615UL,3L,7L,0x48865426L,0x4264617ACAAF1FE2LL}};
    int32_t *l_293[10] = {&g_2,&g_167.f6,&g_2,&g_167.f6,&g_2,&g_167.f6,&g_2,&g_167.f6,&g_2,&g_167.f6};
    uint16_t l_331 = 1UL;
    int32_t l_332 = (-3L);
    int8_t l_333 = 6L;
    int32_t **l_334[6][5] = {{&l_293[5],&l_293[4],&l_293[5],&l_293[5],&l_293[4]},{&l_293[3],&l_293[3],&l_293[3],&l_293[3],&l_293[3]},{&l_293[4],&l_293[4],&g_95,&l_293[4],&l_293[4]},{&l_293[3],&l_293[3],&l_293[3],&l_293[3],&l_293[3]},{&l_293[4],&l_293[5],&l_293[5],&l_293[4],&l_293[5]},{&l_293[3],&l_293[3],&g_95,&l_293[3],&l_293[3]}};
    int32_t *l_335 = &g_305;
    int16_t *l_350 = &g_306[3][8][2];
    int16_t **l_349 = &l_350;
    int16_t ***l_348 = &l_349;
    uint64_t l_355 = 1UL;
    int i, j;
lbl_291:
    for (g_2 = (-26); (g_2 <= (-10)); g_2 = safe_add_func_uint16_t_u_u(g_2, 5))
    { 
        union U2 l_20 = {0UL};
        uint16_t *l_32 = &g_33;
        uint64_t *l_241 = &g_167.f9;
        int32_t l_242 = (-7L);
        int32_t *l_243[2];
        const int16_t *l_245[4][8] = {{(void*)0,&g_246,(void*)0,(void*)0,(void*)0,&g_246,(void*)0,(void*)0},{(void*)0,&g_246,(void*)0,(void*)0,(void*)0,&g_246,(void*)0,(void*)0},{(void*)0,&g_246,(void*)0,(void*)0,(void*)0,&g_246,(void*)0,(void*)0},{(void*)0,&g_246,(void*)0,(void*)0,(void*)0,&g_246,(void*)0,(void*)0}};
        const int16_t **l_244 = &l_245[2][7];
        struct S0 l_260 = {0xE1L,0x48822510L,139,1UL,4294967295UL,18446744073709551615UL,3L,0L,18446744073709551608UL,18446744073709551607UL};
        int32_t **l_261 = &l_243[1];
        int i, j;
        for (i = 0; i < 2; i++)
            l_243[i] = &g_178;
        g_183.f6 &= (safe_add_func_uint64_t_u_u((safe_div_func_uint8_t_u_u((safe_div_func_int64_t_s_s((safe_add_func_uint16_t_u_u((l_242 ^= (((((safe_add_func_int32_t_s_s(((((*l_241) = (func_15(l_20, func_21(g_2, l_20.f0, l_27, (((safe_mul_func_int16_t_s_s((((safe_rshift_func_uint16_t_u_u(((*l_32) ^= l_27.f0), l_27.f0)) & 0xD8B3D385L) && ((l_34 != l_34) , 0L)), l_20.f0)) != 0xC3L) | l_27.f0), g_35), g_204, g_183.f9) , 0xD57654CDD8667499LL)) | l_27.f0) >= 5UL), l_27.f0)) && 65535UL) || 0x9CC728F5A6B9E024LL) , g_167.f7) > l_27.f0)), g_39.f5)), g_183.f1)), 0xD4L)), g_204));
        (*g_95) &= (((*l_244) = l_32) != (void*)0);
        (*g_95) = ((safe_div_func_uint32_t_u_u((((g_98 | ((safe_lshift_func_uint16_t_u_s(g_179, 12)) < ((safe_mul_func_int64_t_s_s(((g_167.f0 < g_161) , ((((g_35.f0 != (g_183.f6 = (*g_95))) | (safe_div_func_uint64_t_u_u((safe_sub_func_uint32_t_u_u((safe_mul_func_uint64_t_u_u((((g_259 = &g_121) != ((1UL & ((l_260 , g_176) <= g_167.f2)) , (void*)0)) == 18446744073709551615UL), l_27.f0)), 9UL)), g_167.f8))) > 9UL) , g_39.f7)), g_113.f0)) & (-1L)))) , 247UL) , 1UL), g_167.f0)) > g_167.f4);
        (*l_261) = (void*)0;
    }
    for (g_39.f0 = 0; (g_39.f0 == 49); ++g_39.f0)
    { 
        uint32_t l_273 = 0x37FAAF37L;
        int8_t *l_274 = (void*)0;
        int8_t *l_275 = &g_233;
        int32_t l_276 = (-5L);
        int64_t *l_279 = &g_35.f1;
        struct S1 l_295[3][2][6] = {{{{0L},{0L},{-3L},{1L},{0x76AAL},{1L}},{{0L},{0L},{0L},{0x827CL},{-3L},{-3L}}},{{{0x86F4L},{0L},{0L},{0x86F4L},{0L},{1L}},{{1L},{0x86F4L},{-3L},{0x86F4L},{1L},{0x827CL}}},{{{0x86F4L},{1L},{0x827CL},{0x827CL},{1L},{0x86F4L}},{{0L},{0x86F4L},{0L},{1L},{0L},{0x86F4L}}}};
        int32_t l_297 = 0x24AEB1D1L;
        int32_t l_299[10] = {0x9485683FL,0x5337C066L,0x5337C066L,0x9485683FL,0x5337C066L,0x5337C066L,0x9485683FL,0x5337C066L,0x5337C066L,0x9485683FL};
        union U3 **l_311 = (void*)0;
        union U3 *l_313 = &g_35;
        union U3 **l_312 = &l_313;
        int i, j, k;
        if ((((((0x5E25L & (safe_mul_func_int64_t_s_s((((l_266[0] , (~(safe_sub_func_int16_t_s_s((safe_mul_func_int64_t_s_s(g_154[1], (&g_121 != &g_121))), ((+(g_161 | (l_273 >= (((l_276 = ((*l_275) |= (-2L))) >= (safe_mul_func_int64_t_s_s(((*l_279) = g_167.f3), l_27.f0))) , g_167.f0)))) | l_273))))) , g_280) != &l_34), l_27.f0))) < 0xB4F23B0FC7D02341LL) | l_273) > l_273) || g_39.f5))
        { 
            if (((safe_lshift_func_uint16_t_u_s(l_276, 13)) , ((*g_95) = 0x77C6C285L)))
            { 
                return g_39.f1;
            }
            else
            { 
                return g_35.f0;
            }
        }
        else
        { 
            int16_t l_288 = 2L;
            union U2 l_289 = {1UL};
            int32_t l_290 = 0xEEF8C891L;
            int32_t l_298[7] = {0x3028F6ADL,0x3028F6ADL,0x3028F6ADL,0x3028F6ADL,0x3028F6ADL,0x3028F6ADL,0x3028F6ADL};
            int i;
            if (((g_167.f9 , (((-9L) >= ((safe_div_func_int16_t_s_s(((safe_sub_func_uint16_t_u_u(((1L | 1UL) & ((l_288 , (l_289 , (l_290 ^ l_276))) , g_39.f6)), 0xE79CL)) | l_266[0].f0), l_288)) , l_276)) == 0UL)) > l_273))
            { 
                int32_t **l_294 = &l_293[3];
                struct S1 *l_296 = &l_295[0][1][1];
                if (g_179)
                    goto lbl_291;
                (*l_294) = (l_292[6] , l_293[3]);
                (*l_296) = l_295[0][1][1];
            }
            else
            { 
                int16_t l_300 = 0xA611L;
                int32_t l_301 = 0x4172076BL;
                int32_t l_303[3][8][3] = {{{0x6D2EE6C1L,0x9052B1F5L,(-2L)},{0xE5AD4D92L,0x9052B1F5L,2L},{(-1L),0x6D2EE6C1L,(-2L)},{(-1L),(-1L),6L},{0xE5AD4D92L,0x6D2EE6C1L,6L},{0x6D2EE6C1L,0x9052B1F5L,(-2L)},{0xE5AD4D92L,0x9052B1F5L,2L},{(-1L),0x6D2EE6C1L,(-2L)}},{{(-1L),(-1L),6L},{0xE5AD4D92L,0x6D2EE6C1L,6L},{0x6D2EE6C1L,0x9052B1F5L,(-2L)},{0xE5AD4D92L,0x9052B1F5L,2L},{(-1L),0x6D2EE6C1L,(-2L)},{(-1L),(-1L),6L},{0xE5AD4D92L,0x6D2EE6C1L,6L},{0x6D2EE6C1L,0x9052B1F5L,(-2L)}},{{0xE5AD4D92L,0x9052B1F5L,2L},{(-1L),0x6D2EE6C1L,(-2L)},{(-1L),(-1L),6L},{0L,0L,0xE5AD4D92L},{0L,0x007F9287L,0x9052B1F5L},{0L,0x007F9287L,0L},{1L,0L,0x9052B1F5L},{1L,1L,0xE5AD4D92L}}};
                int i, j, k;
                ++g_308;
            }
        }
        (*l_312) = &g_35;
        if (l_299[1])
            continue;
    }
    l_335 = ((((g_98 , ((*g_95) = (g_35 , ((void*)0 != &g_35)))) , ((safe_mul_func_uint16_t_u_u(((-1L) <= ((safe_sub_func_uint8_t_u_u(g_98, (safe_mod_func_uint32_t_u_u((safe_sub_func_int8_t_s_s(g_39.f4, (safe_sub_func_int32_t_s_s(((safe_sub_func_uint8_t_u_u((safe_add_func_uint64_t_u_u((g_328 && (safe_div_func_int16_t_s_s(g_154[7], 0x9830L))), l_331)), 255UL)) || 1L), g_306[3][8][2])))), l_332)))) && g_39.f5)), g_113.f0)) <= l_333)) > 0xC8AFDABBL) , (void*)0);
    g_2 = (((safe_div_func_int32_t_s_s((g_167.f6 |= ((g_95 = &g_176) == ((safe_lshift_func_uint16_t_u_s(65529UL, ((*l_350) = (safe_lshift_func_uint64_t_u_u(((((safe_div_func_int32_t_s_s((g_183.f6 = (g_35.f0 |= (1UL >= g_92))), g_233)) || (safe_add_func_uint64_t_u_u(((((*l_348) = (void*)0) != (l_27 , g_351)) || (!(safe_mul_func_int64_t_s_s(0x7D6C6ADAB0593DF1LL, 2L)))), g_328))) >= g_2) == g_183.f1), 3))))) , &g_176))), l_355)) || g_189) <= g_328);
    return g_204;
}




static struct S1  func_15(union U2  p_16, struct S0  p_17, int32_t  p_18, uint16_t  p_19)
{ 
    union U3 l_231 = {0x92BCF94DL};
    int8_t *l_232 = &g_233;
    uint8_t *l_235[7][5] = {{&g_39.f0,&g_39.f0,&g_183.f0,&g_183.f0,&g_39.f0},{(void*)0,&g_39.f0,(void*)0,&g_39.f0,(void*)0},{&g_39.f0,&g_183.f0,&g_183.f0,&g_39.f0,&g_39.f0},{&g_167.f0,&g_39.f0,&g_167.f0,&g_39.f0,&g_167.f0},{&g_39.f0,&g_39.f0,&g_183.f0,&g_183.f0,&g_39.f0},{(void*)0,&g_39.f0,(void*)0,&g_39.f0,(void*)0},{&g_39.f0,&g_183.f0,&g_183.f0,&g_39.f0,&g_39.f0}};
    uint8_t **l_234[7] = {&l_235[5][0],(void*)0,&l_235[5][0],&l_235[5][0],(void*)0,&l_235[5][0],&l_235[5][0]};
    int64_t *l_236 = &g_167.f7;
    uint16_t *l_237[7];
    int32_t l_238 = 0x68A9C157L;
    int32_t l_239 = 0x4BADE560L;
    struct S1 l_240 = {-9L};
    int i, j;
    for (i = 0; i < 7; i++)
        l_237[i] = (void*)0;
    (*g_95) = (g_167.f6 &= (((((safe_add_func_int8_t_s_s(g_39.f9, ((0xD75E75CD83069D14LL <= (((l_238 &= (p_17.f6 | (safe_rshift_func_int32_t_s_s((safe_lshift_func_uint64_t_u_s(g_183.f4, 23)), (0x5EL <= (safe_rshift_func_uint32_t_u_u((l_231.f0 = ((l_231 , ((((8L == (((*l_232) = p_17.f7) <= (l_234[3] != (void*)0))) , (void*)0) != l_236) && 0x281A0A5BA7D9BFF0LL)) < 0UL)), 18))))))) & p_18) >= l_239)) < 0x22L))) != l_239) , (-1L)) > 5L) >= 3L));
    return l_240;
}




static struct S0  func_21(const uint32_t  p_22, uint32_t  p_23, union U2  p_24, uint32_t  p_25, union U3  p_26)
{ 
    struct S0 l_38 = {0xE2L,0xC7BC5013L,867,1UL,0x07CB0BE9L,0x5D4475678D5680A2LL,0x60131B3BL,0x333DB9622CFB6473LL,0UL,0xF9E84EBF8C32619CLL};
    uint8_t *l_42 = (void*)0;
    uint8_t *l_43 = (void*)0;
    uint8_t *l_44[6][2][6] = {{{&g_39.f0,(void*)0,&l_38.f0,(void*)0,&g_39.f0,&l_38.f0},{(void*)0,&g_39.f0,&l_38.f0,&g_39.f0,&g_39.f0,&l_38.f0}},{{&g_39.f0,&g_39.f0,&l_38.f0,&g_39.f0,(void*)0,&l_38.f0},{&g_39.f0,(void*)0,&l_38.f0,(void*)0,&g_39.f0,&l_38.f0}},{{(void*)0,&g_39.f0,&l_38.f0,&g_39.f0,&g_39.f0,&l_38.f0},{&g_39.f0,&g_39.f0,&l_38.f0,&g_39.f0,(void*)0,&l_38.f0}},{{&g_39.f0,(void*)0,&l_38.f0,(void*)0,&g_39.f0,&l_38.f0},{(void*)0,&g_39.f0,&l_38.f0,&g_39.f0,&g_39.f0,&l_38.f0}},{{&g_39.f0,&g_39.f0,&l_38.f0,&g_39.f0,(void*)0,&l_38.f0},{&g_39.f0,(void*)0,&l_38.f0,(void*)0,&g_39.f0,&l_38.f0}},{{(void*)0,&g_39.f0,&l_38.f0,&g_39.f0,&g_39.f0,&l_38.f0},{&g_39.f0,&g_39.f0,&l_38.f0,&g_39.f0,(void*)0,&l_38.f0}}};
    int32_t l_45[9][3] = {{(-1L),0L,(-10L)},{0xD3EE7732L,(-1L),0xA1C18A1CL},{(-1L),0xD3EE7732L,0xD3EE7732L},{0xD3EE7732L,6L,(-1L)},{(-1L),(-8L),(-1L)},{0xB2841C2FL,(-1L),0xD3EE7732L},{(-5L),(-10L),0xA1C18A1CL},{(-1L),(-1L),(-10L)},{(-1L),(-8L),7L}};
    int64_t *l_52 = &g_35.f1;
    struct S0 l_145 = {0UL,0xA47188FCL,47,0x59CCL,0x3FA737C2L,0xDAE8D4C1FEDC4901LL,0x99F48E8CL,2L,18446744073709551607UL,18446744073709551609UL};
    const int32_t *l_192 = &g_167.f6;
    uint16_t *l_222 = (void*)0;
    uint16_t **l_221 = &l_222;
    int i, j, k;
    if ((p_22 < (safe_sub_func_uint8_t_u_u((l_38 , (g_39 , ((safe_sub_func_uint8_t_u_u((g_39.f0--), (safe_rshift_func_int16_t_s_s(l_45[0][2], (safe_div_func_int64_t_s_s(0x2BF2DCFCB68B63C9LL, ((*l_52) = l_45[7][1]))))))) && (safe_lshift_func_int8_t_s_u(((0xDC18L & p_22) && (~g_39.f9)), l_38.f3))))), 1L))))
    { 
        int32_t *l_56 = &g_39.f6;
        int32_t *l_57 = &l_45[4][0];
        int32_t *l_58 = &l_38.f6;
        int32_t *l_59 = &l_38.f6;
        int32_t *l_60 = &l_45[1][1];
        int32_t *l_61 = &g_39.f6;
        int32_t *l_62 = (void*)0;
        int32_t l_63 = 4L;
        int32_t *l_64 = &l_45[3][2];
        int32_t *l_65[6][8] = {{&l_45[4][0],&l_38.f6,&l_45[4][0],&l_38.f6,&l_45[4][0],(void*)0,&l_45[4][0],&l_38.f6},{&g_39.f6,&l_38.f6,&g_39.f6,&l_38.f6,&l_45[4][0],&l_38.f6,&g_39.f6,&l_38.f6},{&l_45[4][0],&l_38.f6,&g_39.f6,&l_38.f6,&g_39.f6,&l_38.f6,&l_45[4][0],&l_38.f6},{&l_45[4][0],&l_38.f6,&l_45[4][0],&l_38.f6,&l_45[4][0],(void*)0,&l_45[4][0],&l_38.f6},{&g_39.f6,&l_38.f6,&g_39.f6,(void*)0,&g_39.f6,(void*)0,&l_45[4][0],&l_38.f6},{&g_39.f6,(void*)0,&l_45[4][0],&l_38.f6,&l_45[4][0],(void*)0,&g_39.f6,(void*)0}};
        uint32_t l_67 = 1UL;
        int i, j;
        (*l_56) &= l_38.f5;
        l_67++;
        (*l_58) = (g_35.f0 = g_39.f5);
        (*l_58) |= (p_26.f0 = (safe_rshift_func_int32_t_s_s((safe_lshift_func_uint32_t_u_s(p_24.f0, 11)), 11)));
    }
    else
    { 
        uint8_t ** const l_74 = &l_43;
        uint8_t ***l_75 = (void*)0;
        uint8_t **l_77 = &l_44[5][0][3];
        uint8_t ***l_76 = &l_77;
        int32_t l_80 = 0L;
        int32_t l_87[9][8][2] = {{{0xDCCCE59DL,(-2L)},{8L,0x1DBC6B2EL},{0xE29191A0L,0x8D452736L},{7L,1L},{1L,1L},{0xEF898209L,0x5EE8129AL},{0xAD39915AL,(-5L)},{0x0C0D0CCFL,0xE29191A0L}},{{0x1E403169L,0x0C0D0CCFL},{0xDF83262CL,0x59B50370L},{0xDF83262CL,0x0C0D0CCFL},{0x1E403169L,0xE29191A0L},{0x0C0D0CCFL,(-5L)},{0xAD39915AL,0x5EE8129AL},{0xEF898209L,1L},{1L,1L}},{{7L,0x8D452736L},{0xE29191A0L,0x1DBC6B2EL},{8L,(-2L)},{0xDCCCE59DL,0x92A3EDA0L},{0L,(-3L)},{0x9D8AEAC5L,0xA465FDEBL},{0x8F66BB0FL,0L},{1L,0x0E0461AFL}},{{0x1DBC6B2EL,7L},{0x59B50370L,0x25BC7067L},{(-1L),0xAD39915AL},{4L,0xDF83262CL},{0x0E0461AFL,(-1L)},{0L,0xE87F6124L},{0x752A806AL,0xDEFB7DDEL},{(-2L),(-1L)}},{{1L,0x31553368L},{0x782A09A2L,0x31553368L},{1L,(-1L)},{(-2L),0xDEFB7DDEL},{0x752A806AL,0xE87F6124L},{0L,(-1L)},{0x0E0461AFL,0xDF83262CL},{4L,0xAD39915AL}},{{(-1L),0x25BC7067L},{0x59B50370L,7L},{0x1DBC6B2EL,0x0E0461AFL},{1L,0L},{0x8F66BB0FL,0xA465FDEBL},{0x9D8AEAC5L,(-3L)},{0L,0x92A3EDA0L},{0xDCCCE59DL,(-2L)}},{{8L,0x1DBC6B2EL},{0xE29191A0L,0x8D452736L},{7L,1L},{1L,1L},{0xEF898209L,0x5EE8129AL},{0xAD39915AL,(-5L)},{0x0C0D0CCFL,0xE29191A0L},{0x1E403169L,0x0C0D0CCFL}},{{0xDF83262CL,0x59B50370L},{0xDF83262CL,0x0C0D0CCFL},{0x1E403169L,0xE29191A0L},{0x0C0D0CCFL,(-5L)},{0xAD39915AL,0x5EE8129AL},{0xEF898209L,1L},{1L,1L},{7L,0x8D452736L}},{{0xE29191A0L,0x1DBC6B2EL},{8L,(-2L)},{0xDCCCE59DL,0x92A3EDA0L},{0L,(-3L)},{0x9D8AEAC5L,0xA465FDEBL},{0x8F66BB0FL,0L},{1L,0x0E0461AFL},{0x1DBC6B2EL,7L}}};
        int16_t *l_91 = &g_92;
        int32_t *l_93 = &l_45[4][0];
        const struct S0 *l_107[8] = {&l_38,&l_38,&l_38,&l_38,&l_38,&l_38,&l_38,&l_38};
        struct S0 ** const *l_110 = (void*)0;
        struct S1 *l_112 = &g_113;
        uint64_t l_117[5] = {0UL,0UL,0UL,0UL,0UL};
        uint32_t l_151 = 4294967295UL;
        int32_t l_172 = 0x7DD89BB4L;
        int32_t l_175[1][9][3] = {{{0xEA33CA83L,8L,0x3DB778E5L},{0xD53C5758L,0L,0x3DB778E5L},{1L,0xD53C5758L,5L},{(-1L),(-1L),0xEA33CA83L},{1L,0xEA33CA83L,0xD53C5758L},{0xD53C5758L,0xEA33CA83L,1L},{0xEA33CA83L,(-1L),(-1L)},{8L,0xC8BBCD9DL,0x3DB778E5L},{5L,1L,0xC8BBCD9DL}}};
        uint8_t l_217 = 0xD2L;
        uint16_t *l_219 = &g_204;
        uint16_t **l_218 = &l_219;
        int i, j, k;
        (*l_76) = l_74;
    }
    return l_145;
}





int main (int argc, char* argv[])
{
    int i, j, k;
    int print_hash_value = 0;
    if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
    platform_main_begin();
    crc32_gentab();
    func_1();
    transparent_crc(g_2, "g_2", print_hash_value);
    transparent_crc(g_33, "g_33", print_hash_value);
    transparent_crc(g_35.f0, "g_35.f0", print_hash_value);
    transparent_crc(g_39.f0, "g_39.f0", print_hash_value);
    transparent_crc(g_39.f1, "g_39.f1", print_hash_value);
    transparent_crc(g_39.f2, "g_39.f2", print_hash_value);
    transparent_crc(g_39.f3, "g_39.f3", print_hash_value);
    transparent_crc(g_39.f4, "g_39.f4", print_hash_value);
    transparent_crc(g_39.f5, "g_39.f5", print_hash_value);
    transparent_crc(g_39.f6, "g_39.f6", print_hash_value);
    transparent_crc(g_39.f7, "g_39.f7", print_hash_value);
    transparent_crc(g_39.f8, "g_39.f8", print_hash_value);
    transparent_crc(g_39.f9, "g_39.f9", print_hash_value);
    for (i = 0; i < 3; i++)
    {
        transparent_crc(g_66[i], "g_66[i]", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    transparent_crc(g_92, "g_92", print_hash_value);
    transparent_crc(g_98, "g_98", print_hash_value);
    transparent_crc(g_113.f0, "g_113.f0", print_hash_value);
    for (i = 0; i < 3; i++)
    {
        transparent_crc(g_122[i].f0, "g_122[i].f0", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    for (i = 0; i < 9; i++)
    {
        transparent_crc(g_154[i], "g_154[i]", print_hash_value);
        if (print_hash_value) printf("index = [%d]\n", i);

    }
    transparent_crc(g_161, "g_161", print_hash_value);
    transparent_crc(g_167.f0, "g_167.f0", print_hash_value);
    transparent_crc(g_167.f1, "g_167.f1", print_hash_value);
    transparent_crc(g_167.f2, "g_167.f2", print_hash_value);
    transparent_crc(g_167.f3, "g_167.f3", print_hash_value);
    transparent_crc(g_167.f4, "g_167.f4", print_hash_value);
    transparent_crc(g_167.f5, "g_167.f5", print_hash_value);
    transparent_crc(g_167.f6, "g_167.f6", print_hash_value);
    transparent_crc(g_167.f7, "g_167.f7", print_hash_value);
    transparent_crc(g_167.f8, "g_167.f8", print_hash_value);
    transparent_crc(g_167.f9, "g_167.f9", print_hash_value);
    transparent_crc(g_176, "g_176", print_hash_value);
    transparent_crc(g_178, "g_178", print_hash_value);
    transparent_crc(g_179, "g_179", print_hash_value);
    transparent_crc(g_183.f0, "g_183.f0", print_hash_value);
    transparent_crc(g_183.f1, "g_183.f1", print_hash_value);
    transparent_crc(g_183.f2, "g_183.f2", print_hash_value);
    transparent_crc(g_183.f3, "g_183.f3", print_hash_value);
    transparent_crc(g_183.f4, "g_183.f4", print_hash_value);
    transparent_crc(g_183.f5, "g_183.f5", print_hash_value);
    transparent_crc(g_183.f6, "g_183.f6", print_hash_value);
    transparent_crc(g_183.f7, "g_183.f7", print_hash_value);
    transparent_crc(g_183.f8, "g_183.f8", print_hash_value);
    transparent_crc(g_183.f9, "g_183.f9", print_hash_value);
    transparent_crc(g_189, "g_189", print_hash_value);
    transparent_crc(g_191, "g_191", print_hash_value);
    transparent_crc(g_204, "g_204", print_hash_value);
    transparent_crc(g_233, "g_233", print_hash_value);
    transparent_crc(g_246, "g_246", print_hash_value);
    transparent_crc(g_302, "g_302", print_hash_value);
    transparent_crc(g_304, "g_304", print_hash_value);
    transparent_crc(g_305, "g_305", print_hash_value);
    for (i = 0; i < 7; i++)
    {
        for (j = 0; j < 10; j++)
        {
            for (k = 0; k < 3; k++)
            {
                transparent_crc(g_306[i][j][k], "g_306[i][j][k]", print_hash_value);
                if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);

            }
        }
    }
    transparent_crc(g_307, "g_307", print_hash_value);
    transparent_crc(g_308, "g_308", print_hash_value);
    transparent_crc(g_328, "g_328", print_hash_value);
    platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
    return 0;
}

/************************ statistics *************************

XXX max struct depth: 1
breakdown:
   depth: 0, occurrence: 77
   depth: 1, occurrence: 8
XXX total union variables: 6

XXX non-zero bitfields defined in structs: 3
XXX zero bitfields defined in structs: 0
XXX const bitfields defined in structs: 1
XXX volatile bitfields defined in structs: 0
XXX structs with bitfields in the program: 16
breakdown:
   indirect level: 0, occurrence: 9
   indirect level: 1, occurrence: 5
   indirect level: 2, occurrence: 1
   indirect level: 3, occurrence: 1
XXX full-bitfields structs in the program: 0
breakdown:
XXX times a bitfields struct's address is taken: 9
XXX times a bitfields struct on LHS: 0
XXX times a bitfields struct on RHS: 14
XXX times a single bitfield on LHS: 1
XXX times a single bitfield on RHS: 14

XXX max expression depth: 33
breakdown:
   depth: 1, occurrence: 30
   depth: 2, occurrence: 4
   depth: 3, occurrence: 1
   depth: 4, occurrence: 2
   depth: 14, occurrence: 1
   depth: 15, occurrence: 1
   depth: 21, occurrence: 1
   depth: 22, occurrence: 1
   depth: 24, occurrence: 1
   depth: 27, occurrence: 2
   depth: 33, occurrence: 1

XXX total number of pointers: 96

XXX times a variable address is taken: 250
XXX times a pointer is dereferenced on RHS: 12
breakdown:
   depth: 1, occurrence: 12
XXX times a pointer is dereferenced on LHS: 43
breakdown:
   depth: 1, occurrence: 42
   depth: 2, occurrence: 1
XXX times a pointer is compared with null: 7
XXX times a pointer is compared with address of another variable: 0
XXX times a pointer is compared with another pointer: 2
XXX times a pointer is qualified to be dereferenced: 638

XXX max dereference level: 3
breakdown:
   level: 0, occurrence: 0
   level: 1, occurrence: 130
   level: 2, occurrence: 4
   level: 3, occurrence: 1
XXX number of pointers point to pointers: 27
XXX number of pointers point to scalars: 61
XXX number of pointers point to structs: 6
XXX percent of pointers has null in alias set: 30.2
XXX average alias set size: 1.35

XXX times a non-volatile is read: 201
XXX times a non-volatile is write: 132
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: 2

XXX stmts: 29
XXX max block depth: 3
breakdown:
   depth: 0, occurrence: 9
   depth: 1, occurrence: 12
   depth: 2, occurrence: 2
   depth: 3, occurrence: 6

XXX percentage a fresh-made variable is used: 23
XXX percentage an existing variable is used: 77
FYI: the random generator makes assumptions about the integer size. See platform.info for more details.
XXX total OOB instances added: 0
********************* end of statistics **********************/

@dtcxzyw dtcxzyw added the TBAA Type-Based Alias Analysis / Strict Aliasing label Feb 23, 2024
@dtcxzyw
Copy link
Member Author

dtcxzyw commented Feb 24, 2024

Third reproducer:

/*
 * This is a RANDOMLY GENERATED PROGRAM.
 *
 * Generator: csmith 2.4.0
 * Git version: 0ec6f1b
 * Options:   --max-funcs 3 --max-block-depth 3 --quiet --no-bitfields --no-volatiles --no-volatile-pointers --output ./csmith2024-02-23@15:44/test78502.c
 * Seed:      2369246892
 */

#include "csmith.h"


static long __undefined;


union U0 {
   int16_t  f0;
   uint8_t  f1;
   uint32_t  f2;
   uint64_t  f3;
};

union U1 {
   int32_t  f0;
   uint32_t  f1;
};

union U2 {
   const uint16_t  f0;
};

union U3 {
   int32_t  f0;
   int64_t  f1;
   const int32_t  f2;
   int16_t  f3;
   uint16_t  f4;
};

union U4 {
   uint64_t  f0;
   const int8_t  f1;
};


static int32_t g_3 = 8L;
static union U3 g_26 = {0x592E7BAAL};
static uint8_t g_29 = 0x77L;
static uint8_t g_31[8][2][5] = {{{1UL,0x46L,0x46L,1UL,1UL},{0xDBL,0UL,0xDBL,0UL,0xDBL}},{{1UL,1UL,0x46L,0x46L,1UL},{0UL,0UL,0UL,0UL,0UL}},{{1UL,0x46L,0x46L,1UL,1UL},{0xDBL,0UL,0xDBL,0UL,0xDBL}},{{1UL,1UL,0x46L,0x46L,1UL},{0UL,0UL,0UL,0UL,0UL}},{{1UL,0x46L,0x46L,1UL,1UL},{0xDBL,0UL,0xDBL,0UL,0xDBL}},{{1UL,1UL,0x46L,0x46L,1UL},{0UL,0UL,0UL,0UL,0UL}},{{1UL,0x46L,0x46L,1UL,1UL},{0xDBL,0UL,0xDBL,0UL,0xDBL}},{{1UL,1UL,0x46L,0x46L,1UL},{0UL,0UL,0UL,0UL,0UL}}};
static uint64_t g_46 = 1UL;
static uint64_t g_48 = 1UL;
static union U1 g_70 = {0x12B152D5L};
static int64_t *g_78 = (void*)0;
static int64_t **g_77[1] = {&g_78};
static int64_t **g_82 = (void*)0;
static int64_t g_87 = 0x19DAAC0CAA660014LL;
static union U0 g_104 = {-7L};
static uint32_t g_110 = 0x9F0035E4L;
static int16_t g_112 = 0x003BL;
static int64_t * const **g_119 = (void*)0;
static int32_t *g_134 = &g_26.f0;
static int32_t **g_133 = &g_134;
static const union U4 g_147[5][8] = {{{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL}},{{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL}},{{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL}},{{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL}},{{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL},{0x0D1834DD5D329C14LL}}};
static uint16_t g_198 = 0xB8A8L;
static int16_t g_208 = 0xE61BL;
static int64_t ***g_215 = &g_82;
static int64_t ****g_214 = &g_215;
static int64_t **** const *g_213 = &g_214;
static uint64_t g_279 = 0x1EEE091D02A65602LL;



static int8_t  func_1(void);
static int32_t * func_4(union U0  p_5, const union U4  p_6, uint64_t  p_7, int32_t  p_8);
static int64_t  func_10(union U1  p_11, int32_t  p_12);





static int8_t  func_1(void)
{ 
    int32_t *l_2 = &g_3;
    int8_t l_9 = (-4L);
    union U1 l_13[5][1] = {{{-1L}},{{-1L}},{{-1L}},{{-1L}},{{-1L}}};
    int64_t ***l_142 = &g_82;
    int64_t ****l_141 = &l_142;
    uint8_t *l_145 = &g_31[2][0][4];
    int16_t *l_146 = &g_112;
    uint32_t l_148[10][1][5] = {{{4294967287UL,0x2CF28734L,4294967287UL,4294967287UL,0x2CF28734L}},{{4294967290UL,0x65899406L,0x65899406L,4294967290UL,0x65899406L}},{{0x2CF28734L,0x2CF28734L,0UL,0x2CF28734L,0x2CF28734L}},{{0x65899406L,4294967290UL,0x65899406L,0x65899406L,4294967290UL}},{{0x2CF28734L,4294967287UL,4294967287UL,0x2CF28734L,4294967287UL}},{{4294967290UL,4294967290UL,1UL,4294967290UL,4294967290UL}},{{4294967287UL,0x2CF28734L,4294967287UL,4294967287UL,0x2CF28734L}},{{4294967290UL,0x65899406L,0x65899406L,4294967290UL,0x65899406L}},{{0x2CF28734L,0x2CF28734L,0UL,0x2CF28734L,0x2CF28734L}},{{0x65899406L,4294967290UL,0x65899406L,0x65899406L,4294967290UL}}};
    int32_t **l_282 = &g_134;
    int i, j, k;
    (*l_2) &= (1L == 65533UL);
    (*l_282) = func_4((((l_9 != ((func_10(l_13[0][0], g_3) | 0L) , (((*l_141) = &g_82) != (void*)0))) , (+((*l_146) = (g_29 > ((!((l_145 == &g_31[6][1][2]) <= g_104.f0)) && 1UL))))) , g_104), g_147[0][5], l_148[3][0][0], l_9);
    (*l_2) = (**g_133);
    return (*l_2);
}




static int32_t * func_4(union U0  p_5, const union U4  p_6, uint64_t  p_7, int32_t  p_8)
{ 
    uint32_t l_149 = 0x0E199F5EL;
    int32_t l_193 = (-5L);
    int32_t l_206 = 0x664D11ADL;
    int32_t l_207 = 0x9F7B3F39L;
    int32_t **l_226 = &g_134;
    const uint8_t * const l_235 = &g_31[6][1][2];
    const uint8_t * const *l_234 = &l_235;
    union U3 l_239 = {1L};
    if ((l_149 = (*g_134)))
    { 
lbl_271:
        (**g_133) = l_149;
    }
    else
    { 
        int64_t ***l_158 = &g_77[0];
        union U4 l_159 = {1UL};
        uint8_t *l_167 = &g_31[0][0][4];
        union U1 l_186[10] = {{0L},{0L},{0L},{0L},{0L},{0L},{0L},{0L},{0L},{0L}};
        int8_t l_196 = (-5L);
        int32_t l_209[7] = {1L,0x4ACB368DL,1L,1L,0x4ACB368DL,1L,1L};
        uint64_t l_210 = 18446744073709551615UL;
        uint8_t **l_259[1][3];
        int i, j;
        for (i = 0; i < 1; i++)
        {
            for (j = 0; j < 3; j++)
                l_259[i][j] = &l_167;
        }
        if (((((safe_mod_func_int64_t_s_s((safe_mod_func_uint8_t_u_u(((*l_167) = (safe_mul_func_uint64_t_u_u((0x4536AC008CE353FELL >= (((*l_158) = &g_78) != (l_159 , &g_78))), ((safe_lshift_func_int64_t_s_s(((safe_unary_minus_func_int8_t_s((safe_mod_func_uint16_t_u_u((((safe_add_func_uint16_t_u_u(l_149, g_29)) | (p_5.f0 ^ 0L)) <= p_7), p_5.f0)))) < p_6.f0), 5)) >= g_31[6][1][2])))), 0xEBL)), (-1L))) > 1L) & p_7) || l_149))
        { 
            uint32_t *l_172 = &l_149;
            int64_t *l_191 = (void*)0;
            int64_t *l_192 = &g_87;
            uint16_t *l_197 = &g_198;
            int32_t l_199 = 0xF48D875FL;
            int32_t **l_221 = (void*)0;
            int32_t *l_246[1][8][3] = {{{&l_239.f0,(void*)0,&l_239.f0},{(void*)0,&g_3,&l_209[2]},{&g_3,&g_3,(void*)0},{&l_199,&g_3,&g_3},{(void*)0,(void*)0,&g_3},{&l_199,&l_207,&l_199},{&g_3,(void*)0,&g_3},{(void*)0,(void*)0,&g_3}}};
            uint64_t *l_247 = &g_48;
            int i, j, k;
            (*g_134) = 0x5A95E6A1L;
            if (((safe_rshift_func_uint32_t_u_u((safe_rshift_func_int32_t_s_u(6L, ((p_8 > ((++(*l_172)) & g_147[0][5].f0)) , (safe_mul_func_int32_t_s_s((**g_133), (safe_sub_func_int16_t_s_s((safe_sub_func_int64_t_s_s((safe_mod_func_uint32_t_u_u(((safe_mul_func_uint32_t_u_u(0xA10C0C62L, (((*l_197) = ((!(l_186[4] , (safe_mul_func_uint8_t_u_u((safe_rshift_func_int64_t_s_u(((l_149 & (l_193 = ((*l_192) = 1L))) | (safe_sub_func_uint8_t_u_u(l_149, l_196))), p_5.f0)), g_110)))) | 0x0B72L)) != 0UL))) ^ l_196), g_31[6][1][2])), l_199)), 0L))))))), 27)) | (**g_133)))
            { 
                int32_t *l_200 = (void*)0;
                int32_t *l_201 = &l_199;
                int32_t *l_202 = &g_26.f0;
                int32_t *l_203 = (void*)0;
                int32_t *l_204 = &l_193;
                int32_t *l_205[9] = {&l_199,&l_199,&l_199,&l_199,&l_199,&l_199,&l_199,&l_199,&l_199};
                int i;
                --l_210;
            }
            else
            { 
                uint32_t *l_222[4] = {&g_110,&g_110,&g_110,&g_110};
                int32_t **l_225 = &g_134;
                int32_t ***l_227 = &g_133;
                int i;
                g_213 = (g_26 , g_213);
                if (g_110)
                    goto lbl_236;
                if (l_210)
                    goto lbl_236;
lbl_236:
                (*g_134) = ((((safe_rshift_func_int16_t_s_u((safe_lshift_func_int8_t_s_s(((g_110 &= (!((*l_172) |= (g_87 != (l_221 != l_221))))) && (((((safe_mod_func_int16_t_s_s((l_225 == ((*l_227) = l_226)), (safe_lshift_func_int8_t_s_s((-1L), 1)))) == (safe_add_func_uint64_t_u_u((safe_sub_func_uint32_t_u_u(g_31[4][1][4], (-1L))), (-1L)))) , (void*)0) == l_234) != 0xE1A509527E5EAF47LL)), p_7)), p_5.f0)) , p_7) , g_31[6][0][2]) | g_104.f0);
                (**l_226) = p_8;
            }
            (*g_134) = (((((safe_div_func_int32_t_s_s((0x8777E27CL != p_6.f0), (0x882719CDBA808484LL & (l_239 , p_6.f0)))) ^ (((*l_247) |= (safe_div_func_int16_t_s_s((safe_add_func_uint64_t_u_u((**l_226), (**l_226))), (safe_lshift_func_int32_t_s_s((l_209[3] = (g_208 == (0xB0L & p_6.f0))), (**l_226)))))) < g_3)) | p_7) , &p_7) == &l_210);
        }
        else
        { 
            int32_t *l_248 = &g_3;
            union U2 l_260 = {0x0E81L};
lbl_249:
            (*l_226) = l_248;
            for (g_208 = 1; (g_208 >= 0); g_208 -= 1)
            { 
                if (g_208)
                    goto lbl_249;
                return (*l_226);
            }
            for (l_159.f0 = 2; (l_159.f0 <= 9); l_159.f0 += 1)
            { 
                uint8_t **l_256 = (void*)0;
                uint8_t ***l_257 = (void*)0;
                uint8_t ***l_258 = &l_256;
                uint64_t *l_265 = &l_210;
                uint16_t *l_266 = &g_26.f4;
                const int32_t l_267 = 0x92CFC969L;
                int32_t l_268 = 0x07024929L;
            }
        }
        for (g_87 = (-19); (g_87 < 29); g_87 = safe_add_func_int64_t_s_s(g_87, 1))
        { 
            int16_t l_275 = (-1L);
            int32_t l_276 = (-1L);
            int32_t l_278 = (-5L);
            for (p_5.f2 = 0; (p_5.f2 <= 1); p_5.f2 += 1)
            { 
                int32_t l_272[4];
                int32_t *l_273 = (void*)0;
                int32_t *l_274 = &l_209[6];
                int32_t *l_277[6] = {&l_206,&l_206,&l_206,&l_206,&l_206,&l_206};
                int i;
                for (i = 0; i < 4; i++)
                    l_272[i] = 0xCC38E0EBL;
                if (g_104.f0)
                    goto lbl_271;
                g_279++;
            }
        }
    }
    return (*l_226);
}




static int64_t  func_10(union U1  p_11, int32_t  p_12)
{ 
    int32_t *l_14[4][6][6] = {{{&g_3,(void*)0,&g_3,&g_3,&g_3,&g_3},{&g_3,&g_3,(void*)0,&g_3,&g_3,&g_3},{&g_3,&g_3,(void*)0,&g_3,&g_3,(void*)0},{&g_3,&g_3,(void*)0,&g_3,&g_3,&g_3},{(void*)0,&g_3,(void*)0,&g_3,(void*)0,&g_3},{&g_3,(void*)0,&g_3,&g_3,(void*)0,&g_3}},{{&g_3,&g_3,&g_3,&g_3,&g_3,&g_3},{&g_3,(void*)0,(void*)0,&g_3,&g_3,&g_3},{(void*)0,&g_3,&g_3,&g_3,&g_3,(void*)0},{&g_3,&g_3,&g_3,&g_3,&g_3,(void*)0},{&g_3,&g_3,&g_3,&g_3,&g_3,&g_3},{&g_3,(void*)0,&g_3,&g_3,&g_3,&g_3}},{{&g_3,&g_3,&g_3,(void*)0,(void*)0,&g_3},{&g_3,(void*)0,&g_3,&g_3,(void*)0,&g_3},{(void*)0,&g_3,&g_3,&g_3,&g_3,(void*)0},{&g_3,&g_3,&g_3,&g_3,&g_3,(void*)0},{&g_3,&g_3,&g_3,&g_3,&g_3,&g_3},{(void*)0,&g_3,(void*)0,&g_3,&g_3,&g_3}},{{&g_3,(void*)0,&g_3,(void*)0,&g_3,&g_3},{&g_3,(void*)0,&g_3,&g_3,&g_3,&g_3},{&g_3,&g_3,(void*)0,&g_3,&g_3,&g_3},{&g_3,&g_3,(void*)0,&g_3,&g_3,(void*)0},{&g_3,&g_3,(void*)0,&g_3,&g_3,&g_3},{(void*)0,&g_3,(void*)0,&g_3,(void*)0,&g_3}}};
    uint8_t *l_49 = &g_31[4][0][0];
    int32_t l_52 = (-1L);
    int64_t **l_80 = (void*)0;
    int64_t *l_83 = (void*)0;
    uint8_t * const *l_139[5] = {&l_49,&l_49,&l_49,&l_49,&l_49};
    uint8_t * const **l_138 = &l_139[3];
    int i, j, k;
    g_3 = g_3;
    for (p_11.f1 = 0; (p_11.f1 <= 3); p_11.f1 += 1)
    { 
        int32_t *l_22[4] = {&g_3,&g_3,&g_3,&g_3};
        uint8_t *l_27 = (void*)0;
        uint8_t *l_28 = &g_29;
        uint16_t l_30[7][7] = {{65531UL,0x53AAL,0UL,1UL,0UL,0x53AAL,65531UL},{65531UL,0x53AAL,0UL,1UL,0UL,0x53AAL,65531UL},{65531UL,0x53AAL,0UL,1UL,0UL,0x53AAL,65531UL},{65531UL,0x53AAL,0UL,1UL,0UL,0x53AAL,65531UL},{65531UL,0x53AAL,0UL,1UL,0UL,0x53AAL,65531UL},{65531UL,0x53AAL,0UL,65535UL,0xB223L,65531UL,1UL},{1UL,65531UL,0xB223L,65535UL,0xB223L,65531UL,1UL}};
        uint32_t l_32 = 9UL;
        uint32_t l_33[3];
        int64_t *l_34 = &g_26.f1;
        uint64_t *l_45 = &g_46;
        uint64_t *l_47 = &g_48;
        uint8_t **l_50 = (void*)0;
        uint8_t **l_51 = &l_28;
        int64_t **l_65 = &l_34;
        int64_t ***l_79 = &g_77[0];
        int64_t ***l_81[2];
        int i, j;
        for (i = 0; i < 3; i++)
            l_33[i] = 4294967292UL;
        for (i = 0; i < 2; i++)
            l_81[i] = &l_80;
        g_3 = (safe_div_func_uint16_t_u_u(((safe_mul_func_uint32_t_u_u(0UL, (((*l_34) = (p_12 >= (safe_add_func_uint64_t_u_u(p_11.f1, ((((~((void*)0 == l_22[1])) , ((safe_rshift_func_uint32_t_u_u((safe_unary_minus_func_uint64_t_u((g_26 , ((((*l_28) = (g_26.f0 & g_3)) , (((g_31[6][1][2] = (l_30[4][4] >= 0x3E19L)) ^ l_32) , 0x30L)) & l_33[2])))), 1)) != p_12)) || p_11.f1) | g_26.f0))))) == 1L))) > p_11.f1), g_3));
        g_26.f0 = (safe_mul_func_uint64_t_u_u(((!(safe_rshift_func_uint64_t_u_u(((*l_47) = (safe_mod_func_int16_t_s_s((!(l_22[3] == (p_12 , &g_3))), (safe_mul_func_uint64_t_u_u(((*l_45) |= p_11.f1), p_12))))), 11))) >= ((l_49 == ((*l_51) = &g_31[0][0][0])) <= (p_11.f1 , l_52))), p_11.f1));
        if (g_48)
            continue;
        if ((g_26.f0 ^= ((safe_add_func_uint64_t_u_u((safe_rshift_func_int16_t_s_s((safe_rshift_func_uint32_t_u_u((safe_div_func_int32_t_s_s((((safe_div_func_uint32_t_u_u(((&g_46 == ((safe_mod_func_int8_t_s_s((((*l_65) = (void*)0) == ((safe_lshift_func_int8_t_s_s((safe_add_func_uint32_t_u_u(((g_70 , g_31[3][0][2]) | (((safe_add_func_uint64_t_u_u(g_46, ((safe_rshift_func_int8_t_s_s((g_31[6][1][2] >= (0x0D08F1B1L ^ (safe_lshift_func_uint16_t_u_s((((*l_79) = g_77[0]) != (g_82 = l_80)), g_31[6][0][1])))), p_12)) > 1UL))) , (*l_51)) != &g_31[3][1][4])), g_48)), 1)) , l_83)), p_12)) , l_83)) == 0xBCL), p_11.f1)) , l_49) == (void*)0), (-1L))), 16)), 14)), g_29)) ^ 0x283BD055D51B5D7ELL)))
        { 
            uint32_t l_84 = 5UL;
            int32_t l_88 = 1L;
            if (l_84)
            { 
                int32_t **l_85 = &l_14[3][3][1];
                (*l_85) = &g_3;
            }
            else
            { 
                int64_t * const l_86 = &g_87;
                l_88 = ((p_12 , l_86) != ((*l_65) = (**l_79)));
                return p_11.f1;
            }
            g_26.f0 &= 5L;
            return p_11.f1;
        }
        else
        { 
            int16_t l_90 = 0L;
            int32_t l_91[1];
            int i;
            for (i = 0; i < 1; i++)
                l_91[i] = (-1L);
            l_91[0] = (l_90 = (~g_31[3][0][3]));
        }
        for (g_70.f1 = 0; (g_70.f1 <= 3); g_70.f1 += 1)
        { 
            int32_t l_92 = (-5L);
            int32_t l_93[7] = {3L,3L,3L,3L,3L,3L,3L};
            int64_t *l_109[7][3][3] = {{{&g_87,&g_87,&g_87},{&g_87,&g_87,&g_87},{&g_87,&g_87,&g_87}},{{&g_87,(void*)0,(void*)0},{&g_87,(void*)0,&g_87},{&g_87,&g_87,&g_87}},{{&g_87,&g_87,&g_87},{&g_87,(void*)0,&g_87},{(void*)0,(void*)0,(void*)0}},{{(void*)0,&g_87,&g_87},{&g_87,&g_87,&g_87},{(void*)0,&g_87,&g_87}},{{(void*)0,&g_87,&g_26.f1},{&g_87,(void*)0,&g_87},{&g_87,&g_87,&g_87}},{{&g_87,&g_87,&g_26.f1},{&g_87,&g_87,&g_87},{&g_87,(void*)0,&g_87}},{{&g_87,(void*)0,&g_87},{&g_87,(void*)0,(void*)0},{&g_87,&g_87,&g_87}}};
            uint32_t *l_111[6] = {&l_33[2],&l_33[2],&l_33[2],&l_33[2],&l_33[2],&l_33[2]};
            int64_t * const *l_118 = &g_78;
            int64_t * const **l_117 = &l_118;
            int i, j, k;
            l_93[2] = ((l_92 = p_11.f1) , p_12);
            for (g_48 = 0; (g_48 <= 3); g_48 += 1)
            { 
                int i, j, k;
                l_14[g_70.f1][(p_11.f1 + 2)][(g_70.f1 + 1)] = l_14[p_11.f1][(p_11.f1 + 2)][(g_48 + 1)];
            }
            if (((g_110 = (safe_mod_func_uint8_t_u_u((--(*l_49)), (g_29 = (safe_rshift_func_int64_t_s_u((safe_mod_func_int32_t_s_s((safe_mod_func_int16_t_s_s(((g_104 , (g_112 |= (((g_70.f1 > 0x43A15A7CL) > (&g_29 == ((*l_51) = &g_29))) , (safe_div_func_int64_t_s_s((safe_sub_func_uint64_t_u_u((0x179A93412C06D41FLL & (((l_93[5] = (l_83 != (l_109[3][2][2] = (*l_65)))) , ((**l_79) = (void*)0)) != (void*)0)), g_110)), l_92))))) != g_70.f1), l_92)), 0x9104C899L)), 32)))))) , p_11.f1))
            { 
                int64_t * const **l_120 = &l_118;
                int32_t l_123 = (-1L);
                g_26.f0 &= ((((((void*)0 != &g_78) & (((safe_mod_func_int32_t_s_s(((g_119 = l_117) != (l_120 = &l_118)), ((safe_mul_func_int64_t_s_s((l_123 && (l_93[3] &= (safe_rshift_func_int32_t_s_s((~g_31[3][1][0]), g_46)))), ((safe_lshift_func_uint32_t_u_u(l_123, ((safe_div_func_uint8_t_u_u((((((!(((((*l_79) = (((safe_unary_minus_func_int8_t_s(((0x39L < g_31[3][0][2]) || l_92))) || p_12) , &g_78)) != &g_78) & g_104.f0) != g_31[5][1][2])) && g_87) == 0x11L) != 0x5BBDL) | p_12), l_123)) == g_110))) && 0L))) || p_11.f1))) , 0x31D0L) > g_29)) && l_93[5]) <= g_3) && g_70.f1);
            }
            else
            { 
                (*g_134) = ((void*)0 != g_133);
                return p_12;
            }
            for (l_92 = 3; (l_92 >= 0); l_92 -= 1)
            { 
                uint32_t l_135 = 18446744073709551614UL;
                return l_135;
            }
        }
    }
    for (g_3 = 0; (g_3 < (-8)); g_3 = safe_sub_func_int8_t_s_s(g_3, 7))
    { 
        uint8_t * const **l_140 = &l_139[3];
        l_140 = l_138;
    }
    g_3 ^= (&l_52 == ((*g_133) = (*g_133)));
    return p_11.f1;
}





int main (int argc, char* argv[])
{
    int i, j, k;
    int print_hash_value = 0;
    if (argc == 2 && strcmp(argv[1], "1") == 0) print_hash_value = 1;
    platform_main_begin();
    crc32_gentab();
    func_1();
    transparent_crc(g_3, "g_3", print_hash_value);
    transparent_crc(g_26.f0, "g_26.f0", print_hash_value);
    transparent_crc(g_29, "g_29", print_hash_value);
    for (i = 0; i < 8; i++)
    {
        for (j = 0; j < 2; j++)
        {
            for (k = 0; k < 5; k++)
            {
                transparent_crc(g_31[i][j][k], "g_31[i][j][k]", print_hash_value);
                if (print_hash_value) printf("index = [%d][%d][%d]\n", i, j, k);

            }
        }
    }
    transparent_crc(g_46, "g_46", print_hash_value);
    transparent_crc(g_48, "g_48", print_hash_value);
    transparent_crc(g_87, "g_87", print_hash_value);
    transparent_crc(g_104.f0, "g_104.f0", print_hash_value);
    transparent_crc(g_110, "g_110", print_hash_value);
    transparent_crc(g_112, "g_112", print_hash_value);
    for (i = 0; i < 5; i++)
    {
        for (j = 0; j < 8; j++)
        {
            transparent_crc(g_147[i][j].f0, "g_147[i][j].f0", print_hash_value);
            if (print_hash_value) printf("index = [%d][%d]\n", i, j);

        }
    }
    transparent_crc(g_198, "g_198", print_hash_value);
    transparent_crc(g_208, "g_208", print_hash_value);
    transparent_crc(g_279, "g_279", print_hash_value);
    platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
    return 0;
}

/************************ statistics *************************
XXX max struct depth: 0
breakdown:
   depth: 0, occurrence: 65
XXX total union variables: 9

XXX max expression depth: 33
breakdown:
   depth: 1, occurrence: 51
   depth: 2, occurrence: 14
   depth: 3, occurrence: 2
   depth: 4, occurrence: 1
   depth: 14, occurrence: 1
   depth: 17, occurrence: 1
   depth: 19, occurrence: 1
   depth: 20, occurrence: 1
   depth: 21, occurrence: 1
   depth: 23, occurrence: 1
   depth: 25, occurrence: 1
   depth: 26, occurrence: 1
   depth: 32, occurrence: 1
   depth: 33, occurrence: 1

XXX total number of pointers: 72

XXX times a variable address is taken: 131
XXX times a pointer is dereferenced on RHS: 15
breakdown:
   depth: 1, occurrence: 7
   depth: 2, occurrence: 8
XXX times a pointer is dereferenced on LHS: 39
breakdown:
   depth: 1, occurrence: 36
   depth: 2, occurrence: 3
XXX times a pointer is compared with null: 3
XXX times a pointer is compared with address of another variable: 1
XXX times a pointer is compared with another pointer: 1
XXX times a pointer is qualified to be dereferenced: 376

XXX max dereference level: 5
breakdown:
   level: 0, occurrence: 0
   level: 1, occurrence: 80
   level: 2, occurrence: 20
   level: 3, occurrence: 4
   level: 4, occurrence: 0
   level: 5, occurrence: 1
XXX number of pointers point to pointers: 33
XXX number of pointers point to scalars: 39
XXX number of pointers point to structs: 0
XXX percent of pointers has null in alias set: 27.8
XXX average alias set size: 1.24

XXX times a non-volatile is read: 199
XXX times a non-volatile is write: 122
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: 2
XXX backward jumps: 2

XXX stmts: 53
XXX max block depth: 3
breakdown:
   depth: 0, occurrence: 11
   depth: 1, occurrence: 9
   depth: 2, occurrence: 15
   depth: 3, occurrence: 18

XXX percentage a fresh-made variable is used: 21.7
XXX percentage an existing variable is used: 78.3
XXX total OOB instances added: 0
********************* end of statistics **********************/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:RISC-V generated by fuzzer llvm:codegen miscompilation needs-reduction Large reproducer that should be reduced into a simpler form TBAA Type-Based Alias Analysis / Strict Aliasing
Projects
None yet
Development

No branches or pull requests

2 participants