https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98950

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-02-09

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

$ cat jsonapi.i
typedef enum {
  JSON_TOKEN_STRINGJSON_TOKEN_ARRAY_ENDJSON_TOKEN_NULL} JsonTokenType;
typedef enum {
  JSON_SUCCESS} JsonParseErrorType;
typedef int json_scalar_action;
typedef struct {
  json_scalar_action scalar;
  } JsonSemAction;

static JsonParseErrorType parse_array_element();
void json_count_array_elements() {
  JsonParseErrorType result;
  while (1) {
    result = parse_array_element();
    if (result )
      return ;
  }
}

int lex_peek(void);
int json_lex(void);

JsonSemAction parse_scalar_sem;
JsonParseErrorType parse_scalar() {
  JsonTokenType tok = lex_peek();
  if (tok &&
      tok != parse_scalar_sem.scalar )
    return json_lex();
  return JSON_SUCCESS;
}
JsonParseErrorType parse_array_element() {
  JsonParseErrorType result;
  result = parse_scalar();
  if (result )
    return result;
}

$ gcc jsonapi.i -O3 -c -wrapper valgrind,--leak-check=yes
...
==3008== 16 bytes in 1 blocks are definitely lost in loss record 10 of 863
==3008==    at 0x4839DEF: operator new(unsigned long) (in
/usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==3008==    by 0x1091A50:
thread_jumps::convert_and_register_current_path(edge_def*)
(tree-ssa-threadbackward.c:472)
==3008==    by 0x1091D92: register_jump_thread_path_if_profitable
(tree-ssa-threadbackward.c:561)
==3008==    by 0x1091D92:
thread_jumps::register_jump_thread_path_if_profitable(tree_node*, tree_node*,
basic_block_def*) (tree-ssa-threadbackward.c:550)
==3008==    by 0x1092A1E: thread_jumps::handle_phi(gphi*, tree_node*,
basic_block_def*) (tree-ssa-threadbackward.c:600)
==3008==    by 0x1092915:
thread_jumps::fsm_find_control_statement_thread_paths(tree_node*)
(tree-ssa-threadbackward.c:730)
==3008==    by 0x10931CE: (anonymous
namespace)::pass_thread_jumps::execute(function*)
(tree-ssa-threadbackward.c:828)
==3008==    by 0xD99A37: execute_one_pass(opt_pass*) (passes.c:2567)
==3008==    by 0xD9A412: execute_pass_list_1(opt_pass*) (passes.c:2656)
==3008==    by 0xD9A424: execute_pass_list_1(opt_pass*) (passes.c:2657)
==3008==    by 0xD9A455: execute_pass_list(function*, opt_pass*)
(passes.c:2667)
==3008==    by 0xA0A1F4: cgraph_node::expand() (cgraphunit.c:1827)
==3008==    by 0xA0B85E: expand_all_functions (cgraphunit.c:1995)
==3008==    by 0xA0B85E: compile (cgraphunit.c:2359)
==3008==    by 0xA0B85E: symbol_table::compile() (cgraphunit.c:2270)

Reply via email to