From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2-g21.free.fr (smtp2-g21.free.fr [IPv6:2a01:e0c:1:1599::11]) by sourceware.org (Postfix) with ESMTPS id 901DC3858415 for ; Sat, 8 Jan 2022 17:34:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 901DC3858415 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=libertysurf.fr Authentication-Results: sourceware.org; spf=none smtp.mailfrom=libertysurf.fr Received: from fomalhaut.localnet (unknown [IPv6:2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp2-g21.free.fr (Postfix) with ESMTP id 2911D2003BE; Sat, 8 Jan 2022 18:34:03 +0100 (CET) From: Eric Botcazou To: Martin Uecker Cc: Richard Biener , "gcc@gcc.gnu.org" Subject: Re: reordering of trapping operations and volatile Date: Sat, 08 Jan 2022 18:33:57 +0100 Message-ID: <2089811.irdbgypaU6@fomalhaut> In-Reply-To: <2e1783a9e2a107dff24ecc4944bd43b1903746f1.camel@gmail.com> References: <832b1b3957a0243ca37378a774effe537642eed3.camel@gmail.com> <5784303.lOV4Wx5bFT@fomalhaut> <2e1783a9e2a107dff24ecc4944bd43b1903746f1.camel@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jan 2022 17:34:07 -0000 > Most C programmers would assume that volatile accesses already > provides this guarantee, so actually doing so would be good. I'm a little skeptical of this statement: if it was true, how come the most recent version of the standard does not provide it 30 years after the language was first standardized? > Or a more practical example: While debugging some embedded > device, it would also be very annoying if the compilers reorders > some trap before some debugging output. I could easily imagine > loosing hours figuring out what happens. The thing to do to avoid losing these hours is to debug the code at -O0. -- Eric Botcazou