[PATCH 4/5] Cygwin: fix GCC 8.3 'asm volatile' errors (fwd)
Thu Jul 18 13:15:00 GMT 2019
Apparently I ran afoul of some overzealous spam filter:
SMTP error from remote server for TEXT command, host: sourceware.org
(18.104.22.168) reason: 552 spam score exceeded threshold
---------- Forwarded message ----------
Date: Thu, 18 Jul 2019 11:01:33 +0200 (CEST)
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: "firstname.lastname@example.org" <email@example.com>
Cc: Ken Brown <firstname.lastname@example.org>
Subject: Re: [PATCH 4/5] Cygwin: fix GCC 8.3 'asm volatile' errors
On Wed, 17 Jul 2019, Corinna Vinschen wrote:
> Hi Ken,
> On Jul 16 17:34, Ken Brown wrote:
> > Remove 'volatile'.
> What happened to asm volatile? Can you add a short description (single
> sentence) to the commit msg explaining why this is a problem now?
As it so happens, we discussed this very patch in the MSYS2 Gitter channel the other day, and this is what I found:
winsup/cygwin/miscfuncs.cc:748:5: error:sm qualifier 'volatile' ignored outside of function body [-Werror]
748 | asm volatile (" \n\
it seems that the GCC team meant to demote this to a mere warning.
But of course -Werror will upgrade that to an error.
The patches suggest that the volatile qualifier here is unnecessary and
has no effect. My understanding is that the `asm volatile` construct
prevents assembler code from being optimized away, but only in inline
assembler instructions. Top-level functions, such as that `memset()`
family of functions, should not be subject to optimization anyway, so I
kind of understand why the `volatile` attribute is ignored.
In short: it seems that the `volatile` attribute of a top-level `asm`
block has no effect, and has not had any effect for some time.
Note: I am no longer really good at machine code, so I might be reading
this all wrong. Hopefully it gives you some inspiration for a good
commit message, though?
More information about the Cygwin-patches