From 5de134edfc6e65c4841bddcc5082050426299613 Mon Sep 17 00:00:00 2001 From: Martin Rodriguez Reboredo Date: Wed, 3 Jan 2024 22:09:19 +0000 Subject: [PATCH] jit: Fix volatile loads and stores Related to PR d/110516 but for libgccjit. 2024-01-03 Martin Rodriguez Reboredo gcc/jit/ * jit-playback.cc: Append TREE_THIS_VOLATILE and TREE_SIDE_EFFECTS to a dereference if underlying type is volatile. Signed-off-by: Martin Rodriguez Reboredo --- gcc/jit/jit-playback.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/jit/jit-playback.cc b/gcc/jit/jit-playback.cc index 0cacbf58d4b20..325be58616b38 100644 --- a/gcc/jit/jit-playback.cc +++ b/gcc/jit/jit-playback.cc @@ -1981,6 +1981,10 @@ new_dereference (tree ptr, tree datum = fold_build1 (INDIRECT_REF, type, ptr); if (loc) set_tree_location (datum, loc); + if (TYPE_VOLATILE (type)) { + TREE_THIS_VOLATILE (datum) = 1; + TREE_SIDE_EFFECTS (datum) = 1; + } return datum; }