public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* Memory leaks (detected by Valgrind)
@ 2021-12-16 17:17 Marc Nieper-Wißkirchen
  2021-12-16 22:00 ` Marc Nieper-Wißkirchen
  0 siblings, 1 reply; 16+ messages in thread
From: Marc Nieper-Wißkirchen @ 2021-12-16 17:17 UTC (permalink / raw)
  To: jit

When I compile a gccjit context, Valgrind complains about a lot of memory
leaks.  Below I have attached a reproducing file extracted from my
project.  To reproduce the errors, I run:

$ gcc dummy.c reproducer.c -lgccjit -rdynamic
$ valgrind ./a.out

Thanks,

Marc

++++

reproducer.c:

/* This code was autogenerated by gcc_jit_context_dump_reproducer_to_file.

   libgccjit (Ubuntu 11.2.0-7ubuntu2) version 11.2.0 (x86_64-linux-gnu)
  compiled by GNU C version 11.2.0, GMP version 6.2.1, MPFR version 4.1.0,
MPC version 1.2.0, isl version isl-0.24-GMP

*/
#include <libgccjit.h>

#pragma GCC diagnostic ignored "-Wunused-variable"

static void
set_options (gcc_jit_context *ctxt_0x6db8b10,
             gcc_jit_context *ctxt_0x6dbd370);

static void
create_code (gcc_jit_context *ctxt_0x6db8b10,
             gcc_jit_context *ctxt_0x6dbd370);

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

  ctxt_0x6db8b10 = gcc_jit_context_acquire ();
  ctxt_0x6dbd370 = gcc_jit_context_new_child_context (ctxt_0x6db8b10);
  set_options (ctxt_0x6db8b10,
               ctxt_0x6dbd370);
  create_code (ctxt_0x6db8b10,
               ctxt_0x6dbd370);
  result = gcc_jit_context_compile (ctxt_0x6dbd370);
  gcc_jit_context_release (ctxt_0x6dbd370);
  gcc_jit_context_release (ctxt_0x6db8b10);
  gcc_jit_result_release (result);
  return 0;
}

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

  /* Set options for ctxt_0x6dbd370.  */
  /* String options.  */
  gcc_jit_context_set_str_option (ctxt_0x6dbd370,
                                  GCC_JIT_STR_OPTION_PROGNAME,
                                  NULL);
  /* Int options.  */
  gcc_jit_context_set_int_option (ctxt_0x6dbd370,
                                  GCC_JIT_INT_OPTION_OPTIMIZATION_LEVEL,
                                  0);
  /* Boolean options.  */
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_DEBUGINFO,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_DUMP_INITIAL_TREE,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_DUMP_INITIAL_GIMPLE,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_DUMP_GENERATED_CODE,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_DUMP_SUMMARY,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_DUMP_EVERYTHING,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_SELFCHECK_GC,
                                  0);
  gcc_jit_context_set_bool_option (ctxt_0x6dbd370,
                                  GCC_JIT_BOOL_OPTION_KEEP_INTERMEDIATES,
                                  0);
  gcc_jit_context_set_bool_allow_unreachable_blocks (ctxt_0x6dbd370, 0);
  gcc_jit_context_set_bool_use_external_driver (ctxt_0x6dbd370, 0);
}

static void
create_code (gcc_jit_context *ctxt_0x6db8b10,
             gcc_jit_context *ctxt_0x6dbd370)
{
  /* Replay of API calls for ctxt_0x6db8b10.  */
  gcc_jit_type *type_size_t = gcc_jit_context_get_type (ctxt_0x6db8b10,
GCC_JIT_TYPE_SIZE_T);
  gcc_jit_type *type_void = gcc_jit_context_get_type (ctxt_0x6db8b10,
GCC_JIT_TYPE_VOID);
  gcc_jit_type *type_unsigned_long_long = gcc_jit_context_get_type
(ctxt_0x6db8b10, GCC_JIT_TYPE_UNSIGNED_LONG_LONG);
  gcc_jit_type *type_void__ = gcc_jit_context_get_type (ctxt_0x6db8b10,
GCC_JIT_TYPE_VOID_PTR);
  gcc_jit_field *field_val =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_unsigned_long_long, /* gcc_jit_type
*type, */
                               "val"); /* const char *name */
  gcc_jit_field *field_ptr =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_void__, /* gcc_jit_type *type, */
                               "ptr"); /* const char *name */
  gcc_jit_field *fields_for_union_union_yyy_object[2] = {
    field_val,
    field_ptr,
  };
  gcc_jit_type *union_union_yyy_object =
    gcc_jit_context_new_union_type (ctxt_0x6db8b10,
                                    NULL, /* gcc_jit_location *loc */
                                    "yyy_object", /* const char *name */
                                    2, /* int num_fields */
                                    fields_for_union_union_yyy_object); /*
gcc_jit_field **fields */
  gcc_jit_field *field_val_0x6db9660 =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_unsigned_long_long, /* gcc_jit_type
*type, */
                               "val"); /* const char *name */
  gcc_jit_field *field_ptr_0x6db97b0 =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_void__, /* gcc_jit_type *type, */
                               "ptr"); /* const char *name */
  gcc_jit_field *fields_for_union_union_yyy_header[2] = {
    field_val_0x6db9660,
    field_ptr_0x6db97b0,
  };
  gcc_jit_type *union_union_yyy_header =
    gcc_jit_context_new_union_type (ctxt_0x6db8b10,
                                    NULL, /* gcc_jit_location *loc */
                                    "yyy_header", /* const char *name */
                                    2, /* int num_fields */
                                    fields_for_union_union_yyy_header); /*
gcc_jit_field **fields */
  gcc_jit_struct *struct_struct_yyy_label =
    gcc_jit_context_new_opaque_struct (ctxt_0x6db8b10,
                                       NULL, /* gcc_jit_location *loc */
                                       "yyy_label"); /* const char *name */
  gcc_jit_type *type_struct_yyy_label__ =
    gcc_jit_type_get_pointer (gcc_jit_struct_as_type
(struct_struct_yyy_label));
  gcc_jit_field *field_header =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               union_union_yyy_header, /* gcc_jit_type
*type, */
                               "header"); /* const char *name */
  gcc_jit_field *field_ip =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_label__, /* gcc_jit_type
*type, */
                               "ip"); /* const char *name */
  gcc_jit_struct *struct_struct_yyy_thread =
    gcc_jit_context_new_opaque_struct (ctxt_0x6db8b10,
                                       NULL, /* gcc_jit_location *loc */
                                       "yyy_thread"); /* const char *name */
  gcc_jit_field *fields_fields[2] = {
    field_header,
    field_ip,
  };
  gcc_jit_struct_set_fields (struct_struct_yyy_thread, /* gcc_jit_struct
*struct_type */
                             NULL, /* gcc_jit_location *loc */
                             2, /* int num_fields */
                             fields_fields); /* gcc_jit_field **fields */
  gcc_jit_type *type_struct_yyy_thread__ =
    gcc_jit_type_get_pointer (gcc_jit_struct_as_type
(struct_struct_yyy_thread));
  gcc_jit_type *params_for_function_type_void__struct_yyy_thread___[1] = {
    type_struct_yyy_thread__,
  };
  gcc_jit_type *ptr_to_void______struct_yyy_thread___ =
    gcc_jit_context_new_function_ptr_type (ctxt_0x6db8b10, /*
gcc_jit_context *ctxt */
                                           NULL, /* gcc_jit_location *loc */
                                           type_void, /* gcc_jit_type
*return_type */
                                           1, /* int num_params */

 params_for_function_type_void__struct_yyy_thread___, /* gcc_jit_type
**param_types */
                                           0); /* int is_variadic */
  gcc_jit_struct *struct_struct_yyy_module =
    gcc_jit_context_new_opaque_struct (ctxt_0x6db8b10,
                                       NULL, /* gcc_jit_location *loc */
                                       "yyy_module"); /* const char *name */
  gcc_jit_field *fields_fields_0x6dba720[0] = {
  };
  gcc_jit_struct_set_fields (struct_struct_yyy_module, /* gcc_jit_struct
*struct_type */
                             NULL, /* gcc_jit_location *loc */
                             0, /* int num_fields */
                             fields_fields_0x6dba720); /* gcc_jit_field
**fields */
  gcc_jit_type *type_struct_yyy_module__ =
    gcc_jit_type_get_pointer (gcc_jit_struct_as_type
(struct_struct_yyy_module));
  gcc_jit_field *field_proc_count =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_size_t, /* gcc_jit_type *type, */
                               "proc_count"); /* const char *name */
  gcc_jit_field *field_fv_count =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_size_t, /* gcc_jit_type *type, */
                               "fv_count"); /* const char *name */
  gcc_jit_struct *struct_struct_yyy_closure_descriptor =
    gcc_jit_context_new_opaque_struct (ctxt_0x6db8b10,
                                       NULL, /* gcc_jit_location *loc */
                                       "yyy_closure_descriptor"); /* const
char *name */
  gcc_jit_field *fields_fields_0x6dbae00[2] = {
    field_proc_count,
    field_fv_count,
  };
  gcc_jit_struct_set_fields (struct_struct_yyy_closure_descriptor, /*
gcc_jit_struct *struct_type */
                             NULL, /* gcc_jit_location *loc */
                             2, /* int num_fields */
                             fields_fields_0x6dbae00); /* gcc_jit_field
**fields */
  gcc_jit_type *type_struct_yyy_closure_descriptor__ =
    gcc_jit_type_get_pointer (gcc_jit_struct_as_type
(struct_struct_yyy_closure_descriptor));
  gcc_jit_field *field_cd =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_closure_descriptor__, /*
gcc_jit_type *type, */
                               "cd"); /* const char *name */
  gcc_jit_field *field_clo_off =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_size_t, /* gcc_jit_type *type, */
                               "clo_off"); /* const char *name */
  gcc_jit_struct *struct_struct_yyy_procedure_descriptor =
    gcc_jit_context_new_opaque_struct (ctxt_0x6db8b10,
                                       NULL, /* gcc_jit_location *loc */
                                       "yyy_procedure_descriptor"); /*
const char *name */
  gcc_jit_field *fields_fields_0x6dbb350[2] = {
    field_cd,
    field_clo_off,
  };
  gcc_jit_struct_set_fields (struct_struct_yyy_procedure_descriptor, /*
gcc_jit_struct *struct_type */
                             NULL, /* gcc_jit_location *loc */
                             2, /* int num_fields */
                             fields_fields_0x6dbb350); /* gcc_jit_field
**fields */
  gcc_jit_type *type_struct_yyy_procedure_descriptor__ =
    gcc_jit_type_get_pointer (gcc_jit_struct_as_type
(struct_struct_yyy_procedure_descriptor));
  gcc_jit_field *field_header_0x6dbb570 =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               union_union_yyy_header, /* gcc_jit_type
*type, */
                               "header"); /* const char *name */
  gcc_jit_field *field_pd =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_procedure_descriptor__, /*
gcc_jit_type *type, */
                               "pd"); /* const char *name */
  gcc_jit_struct *struct_struct_x =
    gcc_jit_context_new_opaque_struct (ctxt_0x6db8b10,
                                       NULL, /* gcc_jit_location *loc */
                                       "x"); /* const char *name */
  gcc_jit_field *fields_fields_0x6dbbb60[2] = {
    field_header_0x6dbb570,
    field_pd,
  };
  gcc_jit_struct_set_fields (struct_struct_x, /* gcc_jit_struct
*struct_type */
                             NULL, /* gcc_jit_location *loc */
                             2, /* int num_fields */
                             fields_fields_0x6dbbb60); /* gcc_jit_field
**fields */
  gcc_jit_field *field_x =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               gcc_jit_struct_as_type (struct_struct_x), /*
gcc_jit_type *type, */
                               "x"); /* const char *name */
  gcc_jit_field *field_mod =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_module__, /* gcc_jit_type
*type, */
                               "mod"); /* const char *name */
  gcc_jit_field *field_prog =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               ptr_to_void______struct_yyy_thread___, /*
gcc_jit_type *type, */
                               "prog"); /* const char *name */
  gcc_jit_struct *struct_struct_y =
    gcc_jit_context_new_opaque_struct (ctxt_0x6db8b10,
                                       NULL, /* gcc_jit_location *loc */
                                       "y"); /* const char *name */
  gcc_jit_field *fields_fields_0x6dbc250[2] = {
    field_mod,
    field_prog,
  };
  gcc_jit_struct_set_fields (struct_struct_y, /* gcc_jit_struct
*struct_type */
                             NULL, /* gcc_jit_location *loc */
                             2, /* int num_fields */
                             fields_fields_0x6dbc250); /* gcc_jit_field
**fields */
  gcc_jit_field *field_y =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               gcc_jit_struct_as_type (struct_struct_y), /*
gcc_jit_type *type, */
                               "y"); /* const char *name */
  gcc_jit_field *fields_for_union_union_a[2] = {
    field_x,
    field_y,
  };
  gcc_jit_type *union_union_a =
    gcc_jit_context_new_union_type (ctxt_0x6db8b10,
                                    NULL, /* gcc_jit_location *loc */
                                    "a", /* const char *name */
                                    2, /* int num_fields */
                                    fields_for_union_union_a); /*
gcc_jit_field **fields */
  gcc_jit_field *field_a =
    gcc_jit_context_new_field (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               union_union_a, /* gcc_jit_type *type, */
                               "a"); /* const char *name */
  gcc_jit_field *fields_fields_0x6dbc800[1] = {
    field_a,
  };
  gcc_jit_struct_set_fields (struct_struct_yyy_label, /* gcc_jit_struct
*struct_type */
                             NULL, /* gcc_jit_location *loc */
                             1, /* int num_fields */
                             fields_fields_0x6dbc800); /* gcc_jit_field
**fields */
  gcc_jit_param *param_thd =
    gcc_jit_context_new_param (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_thread__, /*gcc_jit_type
*type */
                               "thd"); /* const char *name */
  gcc_jit_param *param_labels =
    gcc_jit_context_new_param (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_label__, /*gcc_jit_type
*type */
                               "labels"); /* const char *name */
  gcc_jit_param *param_glob_count =
    gcc_jit_context_new_param (ctxt_0x6db8b10,
                               NULL, /* gcc_jit_location *loc */
                               type_size_t, /*gcc_jit_type *type */
                               "glob_count"); /* const char *name */
  gcc_jit_param *params_for_func_yyy_make_module[3] = {
    param_thd,
    param_labels,
    param_glob_count,
  };
  gcc_jit_function *func_yyy_make_module =
    gcc_jit_context_new_function (ctxt_0x6db8b10, /* gcc_jit_context *ctxt
*/
                                  NULL, /* gcc_jit_location *loc */
                                  GCC_JIT_FUNCTION_IMPORTED, /* enum
gcc_jit_function_kind kind */
                                  type_struct_yyy_module__, /* gcc_jit_type
*return_type */
                                  "yyy_make_module", /* const char *name */
                                  3, /* int num_params */
                                  params_for_func_yyy_make_module, /*
gcc_jit_param **params */
                                  0); /* int is_variadic */
  gcc_jit_type *type_int = gcc_jit_context_get_type (ctxt_0x6db8b10,
GCC_JIT_TYPE_INT);
  gcc_jit_function *func___builtin_trap =
    gcc_jit_context_get_builtin_function (ctxt_0x6db8b10,
                                          "__builtin_trap");


  /* Replay of API calls for ctxt_0x6dbd370.  */
  gcc_jit_type *array_type_struct_yyy_label_1_ =
    gcc_jit_context_new_array_type (ctxt_0x6dbd370,
                                    NULL, /* gcc_jit_location *loc */
                                    gcc_jit_struct_as_type
(struct_struct_yyy_label), /* gcc_jit_type *element_type */
                                    1); /* int num_elements */
  gcc_jit_lvalue *block_labels =
    gcc_jit_context_new_global (ctxt_0x6dbd370, /* gcc_jit_context *ctxt */
                                NULL, /* gcc_jit_location *loc */
                                GCC_JIT_GLOBAL_INTERNAL, /* enum
gcc_jit_global_kind kind */
                                array_type_struct_yyy_label_1_, /*
gcc_jit_type *type */
                                "labels"); /* const char *name */
  gcc_jit_rvalue *rvalue__size_t_0 =
    gcc_jit_context_new_rvalue_from_int (ctxt_0x6dbd370, /* gcc_jit_context
*ctxt */
                                         type_size_t, /* gcc_jit_type
*numeric_type */
                                         0); /* int value */
  gcc_jit_lvalue *lvalue_labels__size_t_0_ =
    gcc_jit_context_new_array_access (ctxt_0x6dbd370, /* gcc_jit_context
*ctxt */
                                      NULL, /*gcc_jit_location *loc */
                                      gcc_jit_lvalue_as_rvalue
(block_labels), /* gcc_jit_rvalue *ptr */
                                      rvalue__size_t_0); /* gcc_jit_rvalue
*index */
  gcc_jit_rvalue *address_of__labels__size_t_0_ =
    gcc_jit_lvalue_get_address (lvalue_labels__size_t_0_, /* gcc_jit_lvalue
*lvalue */
                                NULL); /* gcc_jit_location *loc */
  gcc_jit_param *param_thd_0x6dbec70 =
    gcc_jit_context_new_param (ctxt_0x6dbd370,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_thread__, /*gcc_jit_type
*type */
                               "thd"); /* const char *name */
  gcc_jit_param *params_for_func_yyy_get_entry[1] = {
    param_thd_0x6dbec70,
  };
  gcc_jit_function *func_yyy_get_entry =
    gcc_jit_context_new_function (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
                                  NULL, /* gcc_jit_location *loc */
                                  GCC_JIT_FUNCTION_EXPORTED, /* enum
gcc_jit_function_kind kind */
                                  type_struct_yyy_label__, /* gcc_jit_type
*return_type */
                                  "yyy_get_entry", /* const char *name */
                                  1, /* int num_params */
                                  params_for_func_yyy_get_entry, /*
gcc_jit_param **params */
                                  0); /* int is_variadic */
  gcc_jit_param *param_thd_0x6dbf100 =
    gcc_jit_context_new_param (ctxt_0x6dbd370,
                               NULL, /* gcc_jit_location *loc */
                               type_struct_yyy_thread__, /*gcc_jit_type
*type */
                               "thd"); /* const char *name */
  gcc_jit_param *params_for_func_prog[1] = {
    param_thd_0x6dbf100,
  };
  gcc_jit_function *func_prog =
    gcc_jit_context_new_function (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
                                  NULL, /* gcc_jit_location *loc */
                                  GCC_JIT_FUNCTION_INTERNAL, /* enum
gcc_jit_function_kind kind */
                                  type_void, /* gcc_jit_type *return_type */
                                  "prog", /* const char *name */
                                  1, /* int num_params */
                                  params_for_func_prog, /* gcc_jit_param
**params */
                                  0); /* int is_variadic */
  gcc_jit_block *block_initial =
    gcc_jit_function_new_block (func_prog, "initial");
  gcc_jit_lvalue *local_mod =
    gcc_jit_function_new_local (func_yyy_get_entry, /* gcc_jit_function
*func */
                                NULL, /* gcc_jit_location *loc */
                                type_struct_yyy_module__, /* gcc_jit_type
*type */
                                "mod"); /* const char *name */
  gcc_jit_block *block_initial_0x6dbf900 =
    gcc_jit_function_new_block (func_yyy_get_entry, "initial");
  gcc_jit_rvalue *rvalue__size_t_0_0x6dbfa00 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x6dbd370, /*
gcc_jit_context *ctxt */
                                          type_size_t, /* gcc_jit_type
*numeric_type */
                                          0L); /* long value */
  gcc_jit_rvalue
*args_for__call_yyy_make_module__thd____labels__size_t_0_____size_t_0_[3] =
{
    gcc_jit_param_as_rvalue (param_thd_0x6dbec70),
    address_of__labels__size_t_0_,
    rvalue__size_t_0_0x6dbfa00,
  };
  gcc_jit_rvalue
*call_yyy_make_module__thd____labels__size_t_0_____size_t_0_ =
    gcc_jit_context_new_call (ctxt_0x6dbd370, /* gcc_jit_context *ctxt */
                              NULL, /* gcc_jit_location *loc */
                              func_yyy_make_module, /* gcc_jit_function
*func */
                              3, /* int numargs  */

args_for__call_yyy_make_module__thd____labels__size_t_0_____size_t_0_); /*
gcc_jit_rvalue **args*/
  gcc_jit_block_add_assignment (block_initial_0x6dbf900, /*gcc_jit_block
*block */
                                NULL, /* gcc_jit_location *loc */
                                local_mod, /* gcc_jit_lvalue *lvalue */

call_yyy_make_module__thd____labels__size_t_0_____size_t_0_); /*
gcc_jit_rvalue *rvalue */
  gcc_jit_rvalue *rvalue__size_t_0_0x6dbfc90 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x6dbd370, /*
gcc_jit_context *ctxt */
                                          type_size_t, /* gcc_jit_type
*numeric_type */
                                          0L); /* long value */
  gcc_jit_lvalue *lvalue_labels__size_t_0__0x6dbfd20 =
    gcc_jit_context_new_array_access (ctxt_0x6dbd370, /* gcc_jit_context
*ctxt */
                                      NULL, /*gcc_jit_location *loc */
                                      gcc_jit_lvalue_as_rvalue
(block_labels), /* gcc_jit_rvalue *ptr */
                                      rvalue__size_t_0_0x6dbfc90); /*
gcc_jit_rvalue *index */
  gcc_jit_block *block__UNNAMED_BLOCK_0x6dbff20_ =
    gcc_jit_function_new_block (func_prog, NULL);
  gcc_jit_lvalue *lvalue_labels__size_t_0__a =
    gcc_jit_lvalue_access_field (lvalue_labels__size_t_0__0x6dbfd20,
/*gcc_jit_lvalue *struct_or_union */
                                 NULL, /*gcc_jit_location *loc */
                                 field_a);
  gcc_jit_lvalue *lvalue_labels__size_t_0__a_y =
    gcc_jit_lvalue_access_field (lvalue_labels__size_t_0__a,
/*gcc_jit_lvalue *struct_or_union */
                                 NULL, /*gcc_jit_location *loc */
                                 field_y);
  gcc_jit_lvalue *lvalue_labels__size_t_0__a_y_mod =
    gcc_jit_lvalue_access_field (lvalue_labels__size_t_0__a_y,
/*gcc_jit_lvalue *struct_or_union */
                                 NULL, /*gcc_jit_location *loc */
                                 field_mod);
  gcc_jit_block_add_assignment (block_initial_0x6dbf900, /*gcc_jit_block
*block */
                                NULL, /* gcc_jit_location *loc */
                                lvalue_labels__size_t_0__a_y_mod, /*
gcc_jit_lvalue *lvalue */
                                gcc_jit_lvalue_as_rvalue (local_mod)); /*
gcc_jit_rvalue *rvalue */
  gcc_jit_type
*params_for_function_type_void__struct_yyy_thread____0x6dc0230[1] = {
    type_struct_yyy_thread__,
  };
  gcc_jit_type *ptr_to_void______struct_yyy_thread____0x6dc0320 =
    gcc_jit_context_new_function_ptr_type (ctxt_0x6dbd370, /*
gcc_jit_context *ctxt */
                                           NULL, /* gcc_jit_location *loc */
                                           type_void, /* gcc_jit_type
*return_type */
                                           1, /* int num_params */

 params_for_function_type_void__struct_yyy_thread____0x6dc0230, /*
gcc_jit_type **param_types */
                                           0); /* int is_variadic */
  gcc_jit_rvalue *address_of_prog =
    gcc_jit_function_get_address (func_prog, /* gcc_jit_function *fn */
                                  NULL); /* gcc_jit_location *loc */
  gcc_jit_lvalue *lvalue_labels__size_t_0__a_0x6dc0420 =
    gcc_jit_lvalue_access_field (lvalue_labels__size_t_0__0x6dbfd20,
/*gcc_jit_lvalue *struct_or_union */
                                 NULL, /*gcc_jit_location *loc */
                                 field_a);
  gcc_jit_lvalue *lvalue_labels__size_t_0__a_y_0x6dc04b0 =
    gcc_jit_lvalue_access_field (lvalue_labels__size_t_0__a_0x6dc0420,
/*gcc_jit_lvalue *struct_or_union */
                                 NULL, /*gcc_jit_location *loc */
                                 field_y);
  gcc_jit_lvalue *lvalue_labels__size_t_0__a_y_prog =
    gcc_jit_lvalue_access_field (lvalue_labels__size_t_0__a_y_0x6dc04b0,
/*gcc_jit_lvalue *struct_or_union */
                                 NULL, /*gcc_jit_location *loc */
                                 field_prog);
  gcc_jit_block_add_assignment (block_initial_0x6dbf900, /*gcc_jit_block
*block */
                                NULL, /* gcc_jit_location *loc */
                                lvalue_labels__size_t_0__a_y_prog, /*
gcc_jit_lvalue *lvalue */
                                address_of_prog); /* gcc_jit_rvalue *rvalue
*/
  gcc_jit_rvalue *rvalue__size_t_0_0x6dc0850 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x6dbd370, /*
gcc_jit_context *ctxt */
                                          type_size_t, /* gcc_jit_type
*numeric_type */
                                          0L); /* long value */
  gcc_jit_lvalue *lvalue_labels__size_t_0__0x6dc08e0 =
    gcc_jit_context_new_array_access (ctxt_0x6dbd370, /* gcc_jit_context
*ctxt */
                                      NULL, /*gcc_jit_location *loc */
                                      gcc_jit_lvalue_as_rvalue
(block_labels), /* gcc_jit_rvalue *ptr */
                                      rvalue__size_t_0_0x6dc0850); /*
gcc_jit_rvalue *index */
  gcc_jit_rvalue *address_of__labels__size_t_0__0x6dc0970 =
    gcc_jit_lvalue_get_address (lvalue_labels__size_t_0__0x6dc08e0, /*
gcc_jit_lvalue *lvalue */
                                NULL); /* gcc_jit_location *loc */
  gcc_jit_block_end_with_return (block_initial_0x6dbf900, /*gcc_jit_block
*block */
                                 NULL, /* gcc_jit_location *loc */
                                 address_of__labels__size_t_0__0x6dc0970);
/* gcc_jit_rvalue *rvalue */
  gcc_jit_block *block_default =
    gcc_jit_function_new_block (func_prog, "default");
  gcc_jit_rvalue *rvalue__size_t_0_0x6dc0c30 =
    gcc_jit_context_new_rvalue_from_long (ctxt_0x6dbd370, /*
gcc_jit_context *ctxt */
                                          type_size_t, /* gcc_jit_type
*numeric_type */
                                          0L); /* long value */
  gcc_jit_case
*case_case__size_t_0______size_t_0__goto__UNNAMED_BLOCK_0x6dbff20__ =
    gcc_jit_context_new_case (ctxt_0x6dbd370, /*gcc_jit_context *ctxt */
                              rvalue__size_t_0_0x6dc0c30, /* gcc_jit_rvalue
*min_value */
                              rvalue__size_t_0_0x6dc0c30, /* gcc_jit_rvalue
*max_value */
                              block__UNNAMED_BLOCK_0x6dbff20_); /*
gcc_jit_block *dest_block */
  gcc_jit_lvalue *lvalue_thd__ip=
    gcc_jit_rvalue_dereference_field (gcc_jit_param_as_rvalue
(param_thd_0x6dbf100), /* gcc_jit_rvalue *ptr */
                                      NULL, /* gcc_jit_location *loc */
                                      field_ip); /* gcc_jit_field *field */
  gcc_jit_rvalue *rvalue_thd__ip____labels__size_t_0_ =
    gcc_jit_context_new_binary_op (ctxt_0x6dbd370,
                                   NULL, /* gcc_jit_location *loc */
                                   GCC_JIT_BINARY_OP_MINUS, /* enum
gcc_jit_binary_op op */
                                   type_size_t, /* gcc_jit_type
*result_type */
                                   gcc_jit_lvalue_as_rvalue
(lvalue_thd__ip), /* gcc_jit_rvalue *a */
                                   address_of__labels__size_t_0_); /*
gcc_jit_rvalue *b */
  gcc_jit_case *cases_for_switch_0x6dc0ee0[1] = {
    case_case__size_t_0______size_t_0__goto__UNNAMED_BLOCK_0x6dbff20__,
  };
  gcc_jit_block_end_with_switch (block_initial, /*gcc_jit_block *block */
                                 NULL, /* gcc_jit_location *loc */
                                 rvalue_thd__ip____labels__size_t_0_, /*
gcc_jit_rvalue *expr */
                                 block_default, /* gcc_jit_block
*default_block */
                                 1, /* int num_cases */
                                 cases_for_switch_0x6dc0ee0); /*
gcc_jit_case **cases */
  gcc_jit_block_end_with_void_return (block_default, /*gcc_jit_block *block
*/
                                      NULL); /* gcc_jit_location *loc */
  gcc_jit_param *param_code =
    gcc_jit_context_new_param (ctxt_0x6dbd370,
                               NULL, /* gcc_jit_location *loc */
                               type_int, /*gcc_jit_type *type */
                               "code"); /* const char *name */
  gcc_jit_param *params_for_func_exit[1] = {
    param_code,
  };
  gcc_jit_function *func_exit =
    gcc_jit_context_new_function (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
                                  NULL, /* gcc_jit_location *loc */
                                  GCC_JIT_FUNCTION_IMPORTED, /* enum
gcc_jit_function_kind kind */
                                  type_void, /* gcc_jit_type *return_type */
                                  "exit", /* const char *name */
                                  1, /* int num_params */
                                  params_for_func_exit, /* gcc_jit_param
**params */
                                  0); /* int is_variadic */
  gcc_jit_rvalue *rvalue__int_0 =
    gcc_jit_context_new_rvalue_from_int (ctxt_0x6dbd370, /* gcc_jit_context
*ctxt */
                                         type_int, /* gcc_jit_type
*numeric_type */
                                         0); /* int value */
  gcc_jit_rvalue *args_for__call_exit___int_0_[1] = {
    rvalue__int_0,
  };
  gcc_jit_rvalue *call_exit___int_0_ =
    gcc_jit_context_new_call (ctxt_0x6dbd370, /* gcc_jit_context *ctxt */
                              NULL, /* gcc_jit_location *loc */
                              func_exit, /* gcc_jit_function *func */
                              1, /* int numargs  */
                              args_for__call_exit___int_0_); /*
gcc_jit_rvalue **args*/
  gcc_jit_block_add_eval (block__UNNAMED_BLOCK_0x6dbff20_, /*gcc_jit_block
*block */
                          NULL, /* gcc_jit_location *loc */
                          call_exit___int_0_); /* gcc_jit_rvalue *rvalue */
  gcc_jit_block_end_with_void_return (block__UNNAMED_BLOCK_0x6dbff20_,
/*gcc_jit_block *block */
                                      NULL); /* gcc_jit_location *loc */
  gcc_jit_location *loc__tmp_dump_c_0_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    0, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_3_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    3, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_5_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    5, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_9_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    9, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_10_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    10, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_11_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    11, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_12_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    12, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_15_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    15, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_19_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    19, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_22_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    22, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_23_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    23, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_26_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    26, /* int line */
    0);/* int column */
  gcc_jit_location *loc__tmp_dump_c_29_0 =
    gcc_jit_context_new_location (ctxt_0x6dbd370, /* gcc_jit_context *ctxt
*/
    "/tmp/dump.c", /* const char *filename */
    29, /* int line */
    0);/* int column */
}

++++

dummy.c:

#include <stddef.h>

void *yyy_make_module (void *thd, void *labels, size_t glob_count)
{
  return NULL;
}

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-12-18 19:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-16 17:17 Memory leaks (detected by Valgrind) Marc Nieper-Wißkirchen
2021-12-16 22:00 ` Marc Nieper-Wißkirchen
2021-12-16 22:26   ` Mark Wielaard
2021-12-17 10:29     ` Marc Nieper-Wißkirchen
2021-12-17 10:52       ` Alex Coplan
2021-12-17 14:03         ` Marc Nieper-Wißkirchen
2021-12-17 14:54           ` Andrea Corallo
2021-12-17 15:11             ` Marc Nieper-Wißkirchen
2021-12-17 16:07               ` Andrea Corallo
2021-12-17 17:53                 ` Marc Nieper-Wißkirchen
2021-12-17 18:48                   ` Andrea Corallo
2021-12-17 23:22         ` David Malcolm
2021-12-18 13:57           ` Marc Nieper-Wißkirchen
2021-12-18 16:45             ` David Malcolm
2021-12-18 17:50               ` Marc Nieper-Wißkirchen
2021-12-18 19:36               ` Marc Nieper-Wißkirchen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).