public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [PATCH] Basic asm blocks should always be volatile
@ 2023-06-28 11:14 Julian Waters
  0 siblings, 0 replies; 2+ messages in thread
From: Julian Waters @ 2023-06-28 11:14 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 940 bytes --]

Hi all,

I've revised the change to be much neater

From 480954bc7d2b24e5d19a98260a2be0b49e112c42 Mon Sep 17 00:00:00 2001
From: TheShermanTanker <tanksherman27@gmail.com>
Date: Wed, 28 Jun 2023 19:11:34 +0800
Subject: [PATCH] asm not using extended syntax should always be volatile

---
 gcc/cp/parser.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index a6341b9..2d5d494 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -22355,7 +22355,7 @@ cp_parser_asm_definition (cp_parser* parser)
       /* Create the ASM_EXPR.  */
       if (parser->in_function_body)
  {
-   asm_stmt = finish_asm_stmt (asm_loc, volatile_p, string, outputs,
+   asm_stmt = finish_asm_stmt (asm_loc, !extended_p || volatile_p, string,
outputs,
        inputs, clobbers, labels, inline_p);
    /* If the extended syntax was not used, mark the ASM_EXPR.  */
    if (!extended_p)
-- 
2.35.1.windows.2

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

* [PATCH] Basic asm blocks should always be volatile
@ 2023-06-27 16:05 Julian Waters
  0 siblings, 0 replies; 2+ messages in thread
From: Julian Waters @ 2023-06-27 16:05 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]

gcc's documentatation mentions that all basic asm blocks are always volatile,
yet the parser fails to account for this by only ever setting
volatile_p to true
if the volatile qualifier is found. This patch fixes this by adding a
special case check for extended_p before finish_asm_stmt is called

From 3094be39e3e65a6a638f05fafd858b89fefde6b5 Mon Sep 17 00:00:00 2001
From: TheShermanTanker <tanksherman27@gmail.com>
Date: Tue, 27 Jun 2023 23:56:38 +0800
Subject: [PATCH] asm not using extended syntax should always be volatile

---
 gcc/cp/parser.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index a6341b9..ef3d06a 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -22355,6 +22355,9 @@ cp_parser_asm_definition (cp_parser* parser)
       /* Create the ASM_EXPR.  */
       if (parser->in_function_body)
  {
+          if (!extended_p) {
+            volatile_p = true;
+          }
    asm_stmt = finish_asm_stmt (asm_loc, volatile_p, string, outputs,
        inputs, clobbers, labels, inline_p);
    /* If the extended syntax was not used, mark the ASM_EXPR.  */
-- 
2.35.1.windows.2

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

end of thread, other threads:[~2023-06-28 11:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28 11:14 [PATCH] Basic asm blocks should always be volatile Julian Waters
  -- strict thread matches above, loose matches on Subject: below --
2023-06-27 16:05 Julian Waters

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