From patchwork Tue Jun 27 16:05:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Waters X-Patchwork-Id: 113490 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp8309082vqr; Tue, 27 Jun 2023 09:07:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Tcb9MCGyW2XtA7oDVzWDE2LxJ840xOb4C1qqO34/DEaOsPlkb96kSJpC2yh3zwIkUzwcX X-Received: by 2002:a17:906:1998:b0:98e:419b:4cc4 with SMTP id g24-20020a170906199800b0098e419b4cc4mr5342806ejd.69.1687882022081; Tue, 27 Jun 2023 09:07:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687882022; cv=none; d=google.com; s=arc-20160816; b=niOuHPC5UQ/QKBFbbYbErpqgjwa5/WJmtPLoImHLbDyO4yauCMeh9tsM8wJrfvRqbY 8+36P5mBLeiERXYIrsopklmSxMVhRuDX82BtrvogK9OTO4IMLC0w7x268ZZHCNgqmU8K XMP2k3Ur0Ib43etwsj9hxHZAg8Jp9rSNXgnOsXb+fxdzHZOWZNjN/YjGa/+DSfgloye1 FUeYfzfwnrDZjxgB29lF1PXc4xVHn/rGSaVnbbXV5/QnyRYIrUl2JMFp/Qu+BJ0v33Lx G+5pN3YzbvDkVFk6vc0A8s9MSCTUld1Q2/qSAtRKUP09+kPURIBSxFESp5I3/stDwEfn PLYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:to:subject :message-id:date:mime-version:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=oPodGZ+UqrGzdEuyD/S/SJF1lAx/jL+nSTxJrLhp0LE=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=OGaWBL2UNdLJE7vY+UlzX3dMSvCjHAIAyrtJoc3U4d+XCAQOxvtND7NbcnZR3X17N7 KZDuGkbB31lzdrrsf6cEV0olZGco2pGMCiwFlq0YtnITPIxKk0adefv05HB7ACoWj3S8 kwLXAkBjB+aV+1mmGULLjOct95JBfTNxoH2eiICaQ5kZEDnQJkGWqVPaj55+DX7pRysD lK7qyLhSfsf4VuXJNpDLMxk6cPc0X8/R2qunwdRIrrPlunj5XMNl8qPEfGxWHuQz0yVF ayS1s5GfiBnxA8HIBGoBXlFNgGUf6ed0lwvExUh3+GxKQsJSr+JqKO9m3yE2o0dA12It /w8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ZCzrSJoy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id gu15-20020a170906f28f00b00991d54db2afsi2316866ejb.702.2023.06.27.09.07.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jun 2023 09:07:02 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=ZCzrSJoy; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C312A3858C2D for ; Tue, 27 Jun 2023 16:07:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C312A3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687882020; bh=oPodGZ+UqrGzdEuyD/S/SJF1lAx/jL+nSTxJrLhp0LE=; h=Date:Subject:To:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=ZCzrSJoyAtxtIaD4awWML/QOuETiJLeR3BrTjppdPdu5J5JOLzcUYTCb7QPbQwuO8 HNc4RCfeXAS/y6lTXer07AO1ofKQCN2kv2Bx0dJspR1JPhm/okH5sTdL5x+kJYt0Vy C00DcD9mV53BaDOY1Djdu/H4sHuZuWBzUGOLeFGU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by sourceware.org (Postfix) with ESMTPS id D77513858D28 for ; Tue, 27 Jun 2023 16:06:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D77513858D28 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-40152377912so14740041cf.1 for ; Tue, 27 Jun 2023 09:06:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687881977; x=1690473977; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZrrarJwRIPSZKo6QdmLeJazG7k8HQkdCnf3EqdP1S1Q=; b=bCljBaEgbfQ/pWXbgFVnAxrdBiF5BEUNRXdUWHJ2aVn6m+tMcB0e0EYcN7EW8ueiEz 2xzVaOai4jp0GZjh6M2CiCuxsv30N5Hynw2TRuZqf90pjUBMcu74Lb6XwJR63eBoZUZu RK6rihrTZWkFXW5QhdMrmqWxNuZ+S51SLwL1hISOLslCzvb1IQW6bdhbu4YDZQsXsmlo I+L1oHMj9YzcGKOuUCOyJs5Po/Q90Ixrv9qy3VJeMGO+SAFSukDkXi8dOj84MUl8TNai roKEsI7ZtWR/Ha9ZVMUoAc5+J7pv7cMv1ICvAPM9ioQWQTuUSEK5FK2H5dsvvOig0LEv sR8A== X-Gm-Message-State: AC+VfDzmXgRW46tNKxq/WRjDG7gly2kFkXserI4CEQnELjDMIBMvUDSB LWPcyJCa8rKJVulsXndZWE/DgW8c3WzKZsL39xkLPVBjdVY= X-Received: by 2002:a05:622a:1214:b0:401:e2b1:d28d with SMTP id y20-20020a05622a121400b00401e2b1d28dmr4166171qtx.20.1687881976851; Tue, 27 Jun 2023 09:06:16 -0700 (PDT) MIME-Version: 1.0 Date: Wed, 28 Jun 2023 00:05:40 +0800 Message-ID: Subject: [PATCH] Basic asm blocks should always be volatile To: gcc-patches@gcc.gnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, HTML_OBFUSCATE_05_10, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Julian Waters via Gcc-patches From: Julian Waters Reply-To: Julian Waters Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769872579218223874?= X-GMAIL-MSGID: =?utf-8?q?1769872579218223874?= 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 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. */