Skip to content

Commit

Permalink
Merge pull request #54 from GuillaumeGomez/target-builtins
Browse files Browse the repository at this point in the history
Fix wrong reinitialization of `target_builtins`
  • Loading branch information
antoyo authored Apr 25, 2024
2 parents 426316e + 872980a commit 0f52ada
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions gcc/jit/dummy-frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,6 @@ jit_end_diagnostic (diagnostic_context *context,
gcc::jit::active_playback_ctxt->add_diagnostic (context, *diagnostic);
}

static bool builtins_initialized = false;

/* Language hooks. */

static bool
Expand Down Expand Up @@ -1075,12 +1073,16 @@ jit_langhook_init (void)
eventually be controllable by a command line option. */
mpfr_set_default_prec (256);

// TODO: check if this is a good fix.
if (!builtins_initialized)
{
targetm.init_builtins ();
builtins_initialized = true;
}
// FIXME: This code doesn't work as it erases the `target_builtins` map
// without checking if it's already filled before. A better check would be
// `if target_builtins.len() == 0` (or whatever this `hash_map` type method
// name is).
// static bool builtins_initialized = false;
// if (!builtins_initialized)
// {
targetm.init_builtins ();
// builtins_initialized = true;
// }

return true;
}
Expand Down

0 comments on commit 0f52ada

Please sign in to comment.