public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] jit: Fix volatile loads and stores
@ 2024-01-03 22:09 Martin Rodriguez Reboredo
  2024-02-06 14:18 ` Martin Rodriguez Reboredo
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Rodriguez Reboredo @ 2024-01-03 22:09 UTC (permalink / raw)
  To: jit

Related to PR d/110516 but for libgccjit.

2024-01-03  Martin Rodriguez Reboredo  <yakoyoku@gmail.com>

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 <yakoyoku@gmail.com>
---
 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 ebe501e9012..ab1ffd3beac 100644
--- a/gcc/jit/jit-playback.cc
+++ b/gcc/jit/jit-playback.cc
@@ -1941,6 +1941,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;
 }
 
-- 
2.43.0


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

* Re: [PATCH] jit: Fix volatile loads and stores
  2024-01-03 22:09 [PATCH] jit: Fix volatile loads and stores Martin Rodriguez Reboredo
@ 2024-02-06 14:18 ` Martin Rodriguez Reboredo
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Rodriguez Reboredo @ 2024-02-06 14:18 UTC (permalink / raw)
  To: jit

Ping, although I don't know how to add a test for this, perhaps using a
DejaGNU check at the end of gcc/testsuite/jit.dg/test-volatile.c to see
if volatile is applied to the dereference of the pointer.

On 1/3/24 19:09, Martin Rodriguez Reboredo wrote:
> Related to PR d/110516 but for libgccjit.
> 
> [...]

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

end of thread, other threads:[~2024-02-06 14:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-03 22:09 [PATCH] jit: Fix volatile loads and stores Martin Rodriguez Reboredo
2024-02-06 14:18 ` Martin Rodriguez Reboredo

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).