Skip to content

Instantly share code, notes, and snippets.

@SchrodingerZhu
Last active November 15, 2024 16:10
Show Gist options
  • Select an option

  • Save SchrodingerZhu/84a334f8666b567800624446d354b568 to your computer and use it in GitHub Desktop.

Select an option

Save SchrodingerZhu/84a334f8666b567800624446d354b568 to your computer and use it in GitHub Desktop.
GCCJIT Bug?
struct Lancern;
struct QuaticCat;
struct Float;
union Union;
struct Lancern
{
float professional;
unsigned long genius;
};
struct QuaticCat
{
float excellent;
long magnificent;
};
struct Float
{
__uint32_t mant:23;
__uint32_t exp:8;
__uint32_t sign:1;
};
union Union
{
struct Lancern professional;
struct QuaticCat genius;
struct Float _float;
};
static union Union union_data = (union Union) {.genius=(struct QuaticCat) {.excellent=(float)0.156250, .magnificent=(long)-1}};
extern int
main ()
{
unsigned long %3;
unsigned long %4;
bool %5;
struct Float %7;
__uint32_t %8;
__uint32_t %9;
__uint32_t %10;
__uint32_t %11;
__uint32_t %12;
__uint32_t %13;
bool %14;
bool %15;
bool %16;
bool %17;
bool %18;
int %20;
bb0:
%3 = union_data.professional.genius;
%4 = (unsigned long)-1;
%5 = %3 == %4;
if (%5) goto bb1; else goto bb2;
bb1:
%7 = union_data._float;
%8 = %7.sign:1;
%9 = %7.exp:8;
%10 = %7.mant:23;
%11 = (__uint32_t)0;
%12 = (__uint32_t)124;
%13 = (__uint32_t)2097152;
%14 = %8 == %11;
%15 = %9 == %12;
%16 = %10 == %13;
%17 = %14 && %15;
%18 = %17 && %16;
if (%18) goto bb3; else goto bb2;
bb2:
(void)__builtin_trap ();
goto bb2;
bb3:
%20 = (int)0;
return %20;
}
@SchrodingerZhu
Copy link
Author

/* This code was autogenerated by gcc_jit_context_dump_reproducer_to_file.

   libgccjit (Ubuntu 14-20240412-0ubuntu1) version 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f] (x86_64-linux-gnu)
  	compiled by GNU C version 14.0.1 20240412 (experimental) [master r14-9935-g67e1433a94f], GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version isl-0.25-193-g8621c60c-IMath-32

*/
#include <libgccjit.h>

#pragma GCC diagnostic ignored "-Wunused-variable"

static void
set_options (gcc_jit_context *ctxt_0x5c33e4d82920);

static void
create_code (gcc_jit_context *ctxt_0x5c33e4d82920);

int
main (int argc, const char **argv)
{
  gcc_jit_context *ctxt_0x5c33e4d82920;
  gcc_jit_result *result;

  ctxt_0x5c33e4d82920 = gcc_jit_context_acquire ();
  set_options (ctxt_0x5c33e4d82920);
  create_code (ctxt_0x5c33e4d82920);
  result = gcc_jit_context_compile (ctxt_0x5c33e4d82920);
  gcc_jit_context_release (ctxt_0x5c33e4d82920);
  gcc_jit_result_release (result);
  return 0;
}

static void
set_options (gcc_jit_context *ctxt_0x5c33e4d82920)
{
  /* Set options for ctxt_0x5c33e4d82920.  */
  /* String options.  */
  gcc_jit_context_set_str_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_STR_OPTION_PROGNAME,
                                  NULL);
  /* Int options.  */
  gcc_jit_context_set_int_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL,
                                  3);
  /* Boolean options.  */
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_DEBUGINFO,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_DUMP_INITIAL_TREE,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_DUMP_INITIAL_GIMPLE,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_DUMP_SUMMARY,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_SELFCHECK_GC,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x5c33e4d82920,
                                  GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES,
                                  0);
  gcc_jit_context_set_bool_allow_unreachable_blocks (ctxt_0x5c33e4d82920, 1);
  gcc_jit_context_set_bool_use_external_driver (ctxt_0x5c33e4d82920, 0);
  gcc_jit_context_set_bool_print_errors_to_stderr (ctxt_0x5c33e4d82920, 1);
}

static void
create_code (gcc_jit_context *ctxt_0x5c33e4d82920)
{
  /* Replay of API calls for ctxt_0x5c33e4d82920.  */
  gcc_jit_type *type_int = gcc_jit_context_get_type (ctxt_0x5c33e4d82920, GCC_JIT_TYPE_INT);
  gcc_jit_location *loc__stdin__9_3 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    9, /* int line */
    3);/* int column */
  gcc_jit_param *params_for_func_main[0] = {
  };
  gcc_jit_function *func_main =
    gcc_jit_context_new_function (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                  loc__stdin__9_3, /* gcc_jit_location *loc */
                                  GCC_JIT_FUNCTION_EXPORTED, /* enum gcc_jit_function_kind kind */
                                  type_int, /* gcc_jit_type *return_type */
                                  "main", /* const char *name */
                                  0, /* int num_params */
                                  params_for_func_main, /* gcc_jit_param **params */
                                  0); /* int is_variadic */
  gcc_jit_type *type_float = gcc_jit_context_get_type (ctxt_0x5c33e4d82920, GCC_JIT_TYPE_FLOAT);
  gcc_jit_field *field_professional =
    gcc_jit_context_new_field (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               type_float, /* gcc_jit_type *type, */
                               "professional"); /* const char *name */
  gcc_jit_type *type_unsigned_long = gcc_jit_context_get_type (ctxt_0x5c33e4d82920, GCC_JIT_TYPE_UNSIGNED_LONG);
  gcc_jit_field *field_genius =
    gcc_jit_context_new_field (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               type_unsigned_long, /* gcc_jit_type *type, */
                               "genius"); /* const char *name */
  gcc_jit_struct *struct_struct_Lancern =
    gcc_jit_context_new_opaque_struct (ctxt_0x5c33e4d82920,
                                       NULL, /* gcc_jit_location *loc */
                                       "Lancern"); /* const char *name */
  gcc_jit_field *fields_fields[2] = {
    field_professional,
    field_genius,
  };
  gcc_jit_struct_set_fields (struct_struct_Lancern, /* gcc_jit_struct *struct_type */
                             NULL, /* gcc_jit_location *loc */
                             2, /* int num_fields */
                             fields_fields); /* gcc_jit_field **fields */
  gcc_jit_field *field_professional_0x5c33e4d92440 =
    gcc_jit_context_new_field (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               gcc_jit_struct_as_type (struct_struct_Lancern), /* gcc_jit_type *type, */
                               "professional"); /* const char *name */
  gcc_jit_field *field_excellent =
    gcc_jit_context_new_field (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               type_float, /* gcc_jit_type *type, */
                               "excellent"); /* const char *name */
  gcc_jit_type *type_long = gcc_jit_context_get_type (ctxt_0x5c33e4d82920, GCC_JIT_TYPE_LONG);
  gcc_jit_field *field_magnificent =
    gcc_jit_context_new_field (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               type_long, /* gcc_jit_type *type, */
                               "magnificent"); /* const char *name */
  gcc_jit_struct *struct_struct_QuaticCat =
    gcc_jit_context_new_opaque_struct (ctxt_0x5c33e4d82920,
                                       NULL, /* gcc_jit_location *loc */
                                       "QuaticCat"); /* const char *name */
  gcc_jit_field *fields_fields_0x5c33e4d9b1e0[2] = {
    field_excellent,
    field_magnificent,
  };
  gcc_jit_struct_set_fields (struct_struct_QuaticCat, /* gcc_jit_struct *struct_type */
                             NULL, /* gcc_jit_location *loc */
                             2, /* int num_fields */
                             fields_fields_0x5c33e4d9b1e0); /* gcc_jit_field **fields */
  gcc_jit_field *field_genius_0x5c33e4d9b250 =
    gcc_jit_context_new_field (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               gcc_jit_struct_as_type (struct_struct_QuaticCat), /* gcc_jit_type *type, */
                               "genius"); /* const char *name */
  gcc_jit_type *type___uint32_t = gcc_jit_context_get_type (ctxt_0x5c33e4d82920, GCC_JIT_TYPE_UINT32_T);
  gcc_jit_field *bitfield_mant_23 =
    gcc_jit_context_new_bitfield (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               type___uint32_t, /* gcc_jit_type *type, */
                               23, /* int width, */
                               "mant"); /* const char *name */
  gcc_jit_field *bitfield_exp_8 =
    gcc_jit_context_new_bitfield (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               type___uint32_t, /* gcc_jit_type *type, */
                               8, /* int width, */
                               "exp"); /* const char *name */
  gcc_jit_field *bitfield_sign_1 =
    gcc_jit_context_new_bitfield (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               type___uint32_t, /* gcc_jit_type *type, */
                               1, /* int width, */
                               "sign"); /* const char *name */
  gcc_jit_struct *struct_struct_Float =
    gcc_jit_context_new_opaque_struct (ctxt_0x5c33e4d82920,
                                       NULL, /* gcc_jit_location *loc */
                                       "Float"); /* const char *name */
  gcc_jit_field *fields_fields_0x5c33e4d9b730[3] = {
    bitfield_mant_23,
    bitfield_exp_8,
    bitfield_sign_1,
  };
  gcc_jit_struct_set_fields (struct_struct_Float, /* gcc_jit_struct *struct_type */
                             NULL, /* gcc_jit_location *loc */
                             3, /* int num_fields */
                             fields_fields_0x5c33e4d9b730); /* gcc_jit_field **fields */
  gcc_jit_field *field__float =
    gcc_jit_context_new_field (ctxt_0x5c33e4d82920,
                               NULL, /* gcc_jit_location *loc */
                               gcc_jit_struct_as_type (struct_struct_Float), /* gcc_jit_type *type, */
                               "_float"); /* const char *name */
  gcc_jit_field *fields_for_union_union_Union[3] = {
    field_professional_0x5c33e4d92440,
    field_genius_0x5c33e4d9b250,
    field__float,
  };
  gcc_jit_type *union_union_Union =
    gcc_jit_context_new_union_type (ctxt_0x5c33e4d82920,
                                    NULL, /* gcc_jit_location *loc */
                                    "Union", /* const char *name */
                                    3, /* int num_fields */
                                    fields_for_union_union_Union); /* gcc_jit_field **fields */
  gcc_jit_location *loc__stdin__2_3 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    2, /* int line */
    3);/* int column */
  gcc_jit_lvalue *block_union_data =
    gcc_jit_context_new_global (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                loc__stdin__2_3, /* gcc_jit_location *loc */
                                GCC_JIT_GLOBAL_INTERNAL, /* enum gcc_jit_global_kind kind */
                                union_union_Union, /* gcc_jit_type *type */
                                "union_data"); /* const char *name */
  gcc_jit_location *loc__stdin__6_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    6, /* int line */
    10);/* int column */
  gcc_jit_rvalue *rvalue__float_0_156250 =
    gcc_jit_context_new_rvalue_from_double (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                            type_float, /* gcc_jit_type *numeric_type */
                                            0.156250); /* double value */
  gcc_jit_rvalue *rvalue__long__1 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                          type_long, /* gcc_jit_type *numeric_type */
                                          -1L); /* long value */
  gcc_jit_location *loc__stdin__5_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    5, /* int line */
    10);/* int column */
  gcc_jit_rvalue *rvalue__struct_QuaticCat____excellent__float_0_156250___magnificent__long__1_;
  {
    gcc_jit_rvalue *values[] = {
        rvalue__float_0_156250,
        rvalue__long__1,
      };
    gcc_jit_field *fields[] = {
        field_excellent,
        field_magnificent,
      };
    rvalue__struct_QuaticCat____excellent__float_0_156250___magnificent__long__1_ =
      gcc_jit_context_new_struct_constructor (ctxt_0x5c33e4d82920,
                                              loc__stdin__5_10, /* loc */
                                              gcc_jit_struct_as_type (struct_struct_QuaticCat), /* gcc_jit_type *type */
                                              2, /* int num_values */
                                              fields,
                                              values);
  }
  gcc_jit_rvalue *rvalue__union_Union____genius__struct_QuaticCat____excellent__float_0_156250___magnificent__long__1__;
  {
    gcc_jit_rvalue *value = rvalue__struct_QuaticCat____excellent__float_0_156250___magnificent__long__1_;
    gcc_jit_field *field = field_genius_0x5c33e4d9b250;
    rvalue__union_Union____genius__struct_QuaticCat____excellent__float_0_156250___magnificent__long__1__ =
      gcc_jit_context_new_union_constructor (ctxt_0x5c33e4d82920,
                                             loc__stdin__6_10, /* loc */
                                             union_union_Union, /* gcc_jit_type *type */
                                             field,
                                             value);
  }
  gcc_jit_global_set_initializer_rvalue (block_union_data, /* lvalue *global */
                                         rvalue__union_Union____genius__struct_QuaticCat____excellent__float_0_156250___magnificent__long__1__);/* rvalue *init */
  gcc_jit_location *loc__stdin__13_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    13, /* int line */
    10);/* int column */
  gcc_jit_lvalue *local__3 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__13_10, /* gcc_jit_location *loc */
                                type_unsigned_long, /* gcc_jit_type *type */
                                "%3"); /* const char *name */
  gcc_jit_location *loc__stdin__14_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    14, /* int line */
    10);/* int column */
  gcc_jit_lvalue *local__4 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__14_10, /* gcc_jit_location *loc */
                                type_unsigned_long, /* gcc_jit_type *type */
                                "%4"); /* const char *name */
  gcc_jit_type *type_bool = gcc_jit_context_get_type (ctxt_0x5c33e4d82920, GCC_JIT_TYPE_BOOL);
  gcc_jit_location *loc__stdin__15_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    15, /* int line */
    10);/* int column */
  gcc_jit_lvalue *local__5 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__15_10, /* gcc_jit_location *loc */
                                type_bool, /* gcc_jit_type *type */
                                "%5"); /* const char *name */
  gcc_jit_location *loc__stdin__19_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    19, /* int line */
    10);/* int column */
  gcc_jit_lvalue *local__7 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__19_10, /* gcc_jit_location *loc */
                                gcc_jit_struct_as_type (struct_struct_Float), /* gcc_jit_type *type */
                                "%7"); /* const char *name */
  gcc_jit_location *loc__stdin__20_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    20, /* int line */
    10);/* int column */
  gcc_jit_lvalue *local__8 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__20_10, /* gcc_jit_location *loc */
                                type___uint32_t, /* gcc_jit_type *type */
                                "%8"); /* const char *name */
  gcc_jit_location *loc__stdin__21_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    21, /* int line */
    10);/* int column */
  gcc_jit_lvalue *local__9 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__21_10, /* gcc_jit_location *loc */
                                type___uint32_t, /* gcc_jit_type *type */
                                "%9"); /* const char *name */
  gcc_jit_location *loc__stdin__22_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    22, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__10 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__22_11, /* gcc_jit_location *loc */
                                type___uint32_t, /* gcc_jit_type *type */
                                "%10"); /* const char *name */
  gcc_jit_location *loc__stdin__23_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    23, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__11 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__23_11, /* gcc_jit_location *loc */
                                type___uint32_t, /* gcc_jit_type *type */
                                "%11"); /* const char *name */
  gcc_jit_location *loc__stdin__24_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    24, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__12 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__24_11, /* gcc_jit_location *loc */
                                type___uint32_t, /* gcc_jit_type *type */
                                "%12"); /* const char *name */
  gcc_jit_location *loc__stdin__25_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    25, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__13 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__25_11, /* gcc_jit_location *loc */
                                type___uint32_t, /* gcc_jit_type *type */
                                "%13"); /* const char *name */
  gcc_jit_location *loc__stdin__26_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    26, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__14 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__26_11, /* gcc_jit_location *loc */
                                type_bool, /* gcc_jit_type *type */
                                "%14"); /* const char *name */
  gcc_jit_location *loc__stdin__27_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    27, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__15 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__27_11, /* gcc_jit_location *loc */
                                type_bool, /* gcc_jit_type *type */
                                "%15"); /* const char *name */
  gcc_jit_location *loc__stdin__28_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    28, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__16 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__28_11, /* gcc_jit_location *loc */
                                type_bool, /* gcc_jit_type *type */
                                "%16"); /* const char *name */
  gcc_jit_location *loc__stdin__29_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    29, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__17 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__29_11, /* gcc_jit_location *loc */
                                type_bool, /* gcc_jit_type *type */
                                "%17"); /* const char *name */
  gcc_jit_location *loc__stdin__30_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    30, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__18 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__30_11, /* gcc_jit_location *loc */
                                type_bool, /* gcc_jit_type *type */
                                "%18"); /* const char *name */
  gcc_jit_location *loc__stdin__36_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    36, /* int line */
    11);/* int column */
  gcc_jit_lvalue *local__20 =
    gcc_jit_function_new_local (func_main, /* gcc_jit_function *func */
                                loc__stdin__36_11, /* gcc_jit_location *loc */
                                type_int, /* gcc_jit_type *type */
                                "%20"); /* const char *name */
  gcc_jit_block *block_bb0 =
    gcc_jit_function_new_block (func_main, "bb0");
  gcc_jit_block *block_bb1 =
    gcc_jit_function_new_block (func_main, "bb1");
  gcc_jit_block *block_bb2 =
    gcc_jit_function_new_block (func_main, "bb2");
  gcc_jit_block *block_bb3 =
    gcc_jit_function_new_block (func_main, "bb3");
  gcc_jit_location *loc__stdin__36_11_0x5c33e4d9e200 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    36, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue__int_0 =
    gcc_jit_context_new_rvalue_from_int (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                         type_int, /* gcc_jit_type *numeric_type */
                                         0); /* int value */
  gcc_jit_block_add_assignment (block_bb3, /*gcc_jit_block *block */
                                loc__stdin__36_11_0x5c33e4d9e200, /* gcc_jit_location *loc */
                                local__20, /* gcc_jit_lvalue *lvalue */
                                rvalue__int_0); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__37_5 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    37, /* int line */
    5);/* int column */
  gcc_jit_block_end_with_return (block_bb3, /*gcc_jit_block *block */
                                 loc__stdin__37_5, /* gcc_jit_location *loc */
                                 gcc_jit_lvalue_as_rvalue (local__20)); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__10_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    10, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__11_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    11, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__12_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    12, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__13_10_0x5c33e4d9e610 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    13, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__11_10_0x5c33e4d9e6b0 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    11, /* int line */
    10);/* int column */
  gcc_jit_lvalue *lvalue_union_data_professional = 
    gcc_jit_lvalue_access_field (block_union_data, /*gcc_jit_lvalue *struct_or_union */
                                 loc__stdin__11_10_0x5c33e4d9e6b0, /*gcc_jit_location *loc */
                                 field_professional_0x5c33e4d92440);
  gcc_jit_location *loc__stdin__12_10_0x5c33e4d9e7e0 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    12, /* int line */
    10);/* int column */
  gcc_jit_lvalue *lvalue_union_data_professional_genius = 
    gcc_jit_lvalue_access_field (lvalue_union_data_professional, /*gcc_jit_lvalue *struct_or_union */
                                 loc__stdin__12_10_0x5c33e4d9e7e0, /*gcc_jit_location *loc */
                                 field_genius);
  gcc_jit_block_add_assignment (block_bb0, /*gcc_jit_block *block */
                                loc__stdin__13_10_0x5c33e4d9e610, /* gcc_jit_location *loc */
                                local__3, /* gcc_jit_lvalue *lvalue */
                                gcc_jit_lvalue_as_rvalue (lvalue_union_data_professional_genius)); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__14_10_0x5c33e4d9e990 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    14, /* int line */
    10);/* int column */
  gcc_jit_rvalue *rvalue__unsigned_long__1 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                          type_unsigned_long, /* gcc_jit_type *numeric_type */
                                          -1L); /* long value */
  gcc_jit_block_add_assignment (block_bb0, /*gcc_jit_block *block */
                                loc__stdin__14_10_0x5c33e4d9e990, /* gcc_jit_location *loc */
                                local__4, /* gcc_jit_lvalue *lvalue */
                                rvalue__unsigned_long__1); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__15_10_0x5c33e4da0340 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    15, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__15_10_0x5c33e4da03e0 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    15, /* int line */
    10);/* int column */
  gcc_jit_rvalue *rvalue__3_____4 =
    gcc_jit_context_new_comparison (ctxt_0x5c33e4d82920,
                                    loc__stdin__15_10_0x5c33e4da03e0, /* gcc_jit_location *loc */
                                    GCC_JIT_COMPARISON_EQ, /* enum gcc_jit_comparison op */
                                    gcc_jit_lvalue_as_rvalue (local__3), /* gcc_jit_rvalue *a */
                                    gcc_jit_lvalue_as_rvalue (local__4)); /* gcc_jit_rvalue *b */
  gcc_jit_block_add_assignment (block_bb0, /*gcc_jit_block *block */
                                loc__stdin__15_10_0x5c33e4da0340, /* gcc_jit_location *loc */
                                local__5, /* gcc_jit_lvalue *lvalue */
                                rvalue__3_____4); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__16_5 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    16, /* int line */
    5);/* int column */
  gcc_jit_block_end_with_conditional (block_bb0, /*gcc_jit_block *block */
                                      loc__stdin__16_5, /* gcc_jit_location *loc */
                                      gcc_jit_lvalue_as_rvalue (local__5), /* gcc_jit_rvalue *boolval */
                                      block_bb1, /* gcc_jit_block *on_true */
                                      block_bb2); /* gcc_jit_block *on_false */
  gcc_jit_location *loc__stdin__33_11 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    33, /* int line */
    11);/* int column */
  gcc_jit_type *type_void = gcc_jit_context_get_type (ctxt_0x5c33e4d82920, GCC_JIT_TYPE_VOID);
  gcc_jit_function *func___builtin_trap =
    gcc_jit_context_get_builtin_function (ctxt_0x5c33e4d82920,
                                          "__builtin_trap");
  gcc_jit_location *loc__stdin__33_11_0x5c33e4da0830 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    33, /* int line */
    11);/* int column */
  gcc_jit_rvalue *args_for__call___builtin_trap___[0] = {
  };
  gcc_jit_rvalue *call___builtin_trap___ =
    gcc_jit_context_new_call (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                              loc__stdin__33_11_0x5c33e4da0830, /* gcc_jit_location *loc */
                              func___builtin_trap, /* gcc_jit_function *func */
                              0, /* int numargs  */ 
                              args_for__call___builtin_trap___); /* gcc_jit_rvalue **args*/
  gcc_jit_block_add_eval (block_bb2, /*gcc_jit_block *block */
                          loc__stdin__33_11, /* gcc_jit_location *loc */
                          call___builtin_trap___); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__34_5 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    34, /* int line */
    5);/* int column */
  gcc_jit_block_end_with_jump (block_bb2, /*gcc_jit_block *block */
                               loc__stdin__34_5, /* gcc_jit_location *loc */
                               block_bb2); /* gcc_jit_block *target */
  gcc_jit_location *loc__stdin__18_10 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    18, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__19_10_0x5c33e4da0aa0 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    19, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__18_10_0x5c33e4da0b40 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    18, /* int line */
    10);/* int column */
  gcc_jit_lvalue *lvalue_union_data__float = 
    gcc_jit_lvalue_access_field (block_union_data, /*gcc_jit_lvalue *struct_or_union */
                                 loc__stdin__18_10_0x5c33e4da0b40, /*gcc_jit_location *loc */
                                 field__float);
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__19_10_0x5c33e4da0aa0, /* gcc_jit_location *loc */
                                local__7, /* gcc_jit_lvalue *lvalue */
                                gcc_jit_lvalue_as_rvalue (lvalue_union_data__float)); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__20_10_0x5c33e4da2570 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    20, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__20_10_0x5c33e4da2610 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    20, /* int line */
    10);/* int column */
  gcc_jit_rvalue *rvalue__7_sign_1 = 
    gcc_jit_rvalue_access_field (gcc_jit_lvalue_as_rvalue (local__7), /*gcc_jit_rvalue *struct_or_union */
                                 loc__stdin__20_10_0x5c33e4da2610, /*gcc_jit_location *loc */
                                 bitfield_sign_1);
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__20_10_0x5c33e4da2570, /* gcc_jit_location *loc */
                                local__8, /* gcc_jit_lvalue *lvalue */
                                rvalue__7_sign_1); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__21_10_0x5c33e4da2700 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    21, /* int line */
    10);/* int column */
  gcc_jit_location *loc__stdin__21_10_0x5c33e4da27a0 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    21, /* int line */
    10);/* int column */
  gcc_jit_rvalue *rvalue__7_exp_8 = 
    gcc_jit_rvalue_access_field (gcc_jit_lvalue_as_rvalue (local__7), /*gcc_jit_rvalue *struct_or_union */
                                 loc__stdin__21_10_0x5c33e4da27a0, /*gcc_jit_location *loc */
                                 bitfield_exp_8);
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__21_10_0x5c33e4da2700, /* gcc_jit_location *loc */
                                local__9, /* gcc_jit_lvalue *lvalue */
                                rvalue__7_exp_8); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__22_11_0x5c33e4da2890 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    22, /* int line */
    11);/* int column */
  gcc_jit_location *loc__stdin__22_11_0x5c33e4da2930 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    22, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue__7_mant_23 = 
    gcc_jit_rvalue_access_field (gcc_jit_lvalue_as_rvalue (local__7), /*gcc_jit_rvalue *struct_or_union */
                                 loc__stdin__22_11_0x5c33e4da2930, /*gcc_jit_location *loc */
                                 bitfield_mant_23);
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__22_11_0x5c33e4da2890, /* gcc_jit_location *loc */
                                local__10, /* gcc_jit_lvalue *lvalue */
                                rvalue__7_mant_23); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__23_11_0x5c33e4da0c70 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    23, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue____uint32_t_0 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                          type___uint32_t, /* gcc_jit_type *numeric_type */
                                          0L); /* long value */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__23_11_0x5c33e4da0c70, /* gcc_jit_location *loc */
                                local__11, /* gcc_jit_lvalue *lvalue */
                                rvalue____uint32_t_0); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__24_11_0x5c33e4da0e00 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    24, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue____uint32_t_124 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                          type___uint32_t, /* gcc_jit_type *numeric_type */
                                          124L); /* long value */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__24_11_0x5c33e4da0e00, /* gcc_jit_location *loc */
                                local__12, /* gcc_jit_lvalue *lvalue */
                                rvalue____uint32_t_124); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__25_11_0x5c33e4da0f40 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    25, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue____uint32_t_2097152 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
                                          type___uint32_t, /* gcc_jit_type *numeric_type */
                                          2097152L); /* long value */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__25_11_0x5c33e4da0f40, /* gcc_jit_location *loc */
                                local__13, /* gcc_jit_lvalue *lvalue */
                                rvalue____uint32_t_2097152); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__26_11_0x5c33e4da1080 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    26, /* int line */
    11);/* int column */
  gcc_jit_location *loc__stdin__26_11_0x5c33e4da1120 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    26, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue__8_____11 =
    gcc_jit_context_new_comparison (ctxt_0x5c33e4d82920,
                                    loc__stdin__26_11_0x5c33e4da1120, /* gcc_jit_location *loc */
                                    GCC_JIT_COMPARISON_EQ, /* enum gcc_jit_comparison op */
                                    gcc_jit_lvalue_as_rvalue (local__8), /* gcc_jit_rvalue *a */
                                    gcc_jit_lvalue_as_rvalue (local__11)); /* gcc_jit_rvalue *b */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__26_11_0x5c33e4da1080, /* gcc_jit_location *loc */
                                local__14, /* gcc_jit_lvalue *lvalue */
                                rvalue__8_____11); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__27_11_0x5c33e4da8880 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    27, /* int line */
    11);/* int column */
  gcc_jit_location *loc__stdin__27_11_0x5c33e4da8900 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    27, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue__9_____12 =
    gcc_jit_context_new_comparison (ctxt_0x5c33e4d82920,
                                    loc__stdin__27_11_0x5c33e4da8900, /* gcc_jit_location *loc */
                                    GCC_JIT_COMPARISON_EQ, /* enum gcc_jit_comparison op */
                                    gcc_jit_lvalue_as_rvalue (local__9), /* gcc_jit_rvalue *a */
                                    gcc_jit_lvalue_as_rvalue (local__12)); /* gcc_jit_rvalue *b */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__27_11_0x5c33e4da8880, /* gcc_jit_location *loc */
                                local__15, /* gcc_jit_lvalue *lvalue */
                                rvalue__9_____12); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__28_11_0x5c33e4da8ac0 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    28, /* int line */
    11);/* int column */
  gcc_jit_location *loc__stdin__28_11_0x5c33e4da8b60 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    28, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue__10_____13 =
    gcc_jit_context_new_comparison (ctxt_0x5c33e4d82920,
                                    loc__stdin__28_11_0x5c33e4da8b60, /* gcc_jit_location *loc */
                                    GCC_JIT_COMPARISON_EQ, /* enum gcc_jit_comparison op */
                                    gcc_jit_lvalue_as_rvalue (local__10), /* gcc_jit_rvalue *a */
                                    gcc_jit_lvalue_as_rvalue (local__13)); /* gcc_jit_rvalue *b */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__28_11_0x5c33e4da8ac0, /* gcc_jit_location *loc */
                                local__16, /* gcc_jit_lvalue *lvalue */
                                rvalue__10_____13); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__29_11_0x5c33e4da8c60 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    29, /* int line */
    11);/* int column */
  gcc_jit_location *loc__stdin__29_11_0x5c33e4da8d00 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    29, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue__14_____15 =
    gcc_jit_context_new_binary_op (ctxt_0x5c33e4d82920,
                                   loc__stdin__29_11_0x5c33e4da8d00, /* gcc_jit_location *loc */
                                   GCC_JIT_BINARY_OP_LOGICAL_AND, /* enum gcc_jit_binary_op op */
                                   type_bool, /* gcc_jit_type *result_type */
                                   gcc_jit_lvalue_as_rvalue (local__14), /* gcc_jit_rvalue *a */
                                   gcc_jit_lvalue_as_rvalue (local__15)); /* gcc_jit_rvalue *b */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__29_11_0x5c33e4da8c60, /* gcc_jit_location *loc */
                                local__17, /* gcc_jit_lvalue *lvalue */
                                rvalue__14_____15); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__30_11_0x5c33e4da8e50 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    30, /* int line */
    11);/* int column */
  gcc_jit_location *loc__stdin__30_11_0x5c33e4da8ef0 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    30, /* int line */
    11);/* int column */
  gcc_jit_rvalue *rvalue__17_____16 =
    gcc_jit_context_new_binary_op (ctxt_0x5c33e4d82920,
                                   loc__stdin__30_11_0x5c33e4da8ef0, /* gcc_jit_location *loc */
                                   GCC_JIT_BINARY_OP_LOGICAL_AND, /* enum gcc_jit_binary_op op */
                                   type_bool, /* gcc_jit_type *result_type */
                                   gcc_jit_lvalue_as_rvalue (local__17), /* gcc_jit_rvalue *a */
                                   gcc_jit_lvalue_as_rvalue (local__16)); /* gcc_jit_rvalue *b */
  gcc_jit_block_add_assignment (block_bb1, /*gcc_jit_block *block */
                                loc__stdin__30_11_0x5c33e4da8e50, /* gcc_jit_location *loc */
                                local__18, /* gcc_jit_lvalue *lvalue */
                                rvalue__17_____16); /* gcc_jit_rvalue *rvalue */
  gcc_jit_location *loc__stdin__31_5 =
    gcc_jit_context_new_location (ctxt_0x5c33e4d82920, /* gcc_jit_context *ctxt */
    "<stdin>", /* const char *filename */
    31, /* int line */
    5);/* int column */
  gcc_jit_block_end_with_conditional (block_bb1, /*gcc_jit_block *block */
                                      loc__stdin__31_5, /* gcc_jit_location *loc */
                                      gcc_jit_lvalue_as_rvalue (local__18), /* gcc_jit_rvalue *boolval */
                                      block_bb3, /* gcc_jit_block *on_true */
                                      block_bb2); /* gcc_jit_block *on_false */
}

@pinskia
Copy link

pinskia commented Nov 14, 2024

  %8 = %7.sign:1;
  %9 = %7.exp:8;

I am not 100% sure if this is correct or not.
It is also the reason why converting to it to C/C++ does not fully work.

Both the C and C++ front-ends access the bitfields using a smaller precision type first and then casts.
I wonder if that is the issue here.

@pinskia
Copy link

pinskia commented Nov 14, 2024

Note you can dump the gimple with the extra -gimple option which will output something which could be more useful to use as a gimple fe testcase. So -fdump-tree-gimple-gimple and you might need some extra changes but with that you can plug it back into the C front-end with the extra -fgimple option.

@SchrodingerZhu
Copy link
Author

I do see

  # DEBUG BEGIN_STMT
  _1 = $7.sign;
  $8 = (unsigned int) _1;
  # DEBUG BEGIN_STMT
  _2 = $7.exp;
  $9 = (unsigned int) _2;
  # DEBUG BEGIN_STMT
  _3 = $7.mant;
  $10 = (unsigned int) _3;

from the C frontend. I am not sure whether libgccjit should have done the same thing.

@SchrodingerZhu
Copy link
Author

SchrodingerZhu commented Nov 15, 2024

It maybe the case that the way GCCJIT frontend generates the code will allow backend to think this as an "access to the inactive union field", which is undefined. Although I am uncertain about the semantic difference between GCCJIT and C.

P.S. The code on godbolt was in C++, which indeed regards this as an undefined behavior. One should switch to a C compiler instead. However, I believe there is no difference for clang/gcc in this particular case.

Pointed out by @Lancern

@pinskia
Copy link

pinskia commented Nov 15, 2024

GNU C and C++ has this as defined code though (it is undefined in standard C/C++ due to the activeness of an union field). https://gcc.gnu.org/onlinedocs/gcc-14.2.0/gcc/Optimize-Options.html#index-fstrict-aliasing

The GIMPLE smeantics are the same with respect to an union access is the same as the GNU C too.

@SchrodingerZhu
Copy link
Author

SchrodingerZhu commented Nov 15, 2024

Even after I making Float the same size as others by padding long to its tail and utilizing bitcast to to convert union to target struct, the problem still exists.

@SchrodingerZhu
Copy link
Author

Even a simple program like:

struct Int;

struct Int
{
  int A:17;
  int B:5;
  int C:10;
};

static void
from_int_to_bitfield (int %arg0, int %arg1)
{
  int %0;
  int %1;
  struct Int %2;
  int %3;
  bool %4;

bb0:
  %0 = %arg0;
  %1 = %arg1;
  %2 = bitcast(%0, struct Int);
  %3 = %2.A:17;
  %4 = %3 == %1;
  if (%4) goto bb1; else goto bb2;

bb1:
  return;

bb2:
  (void)__builtin_trap ();
  goto bb2;
}

extern int
main ()
{
  int %0;
  int %1;
  int %2;

bb0:
  %0 = (int)-559038737;
  %1 = (int)-16657;
  (void)from_int_to_bitfield (%0, %1);
  %2 = (int)0;
  return %2;
}

will be folded into ud2, which exits normally when the function is not internal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment