Skip to content

Commit

Permalink
Fix wrong reinitialization of target_builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez authored and antoyo committed Apr 26, 2024
1 parent 426316e commit 8620316
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 8620316

Please sign in to comment.