This is the mail archive of the
mailing list for the Cygwin project.
Re: [PATCH 4/5] Cygwin: fix GCC 8.3 'asm volatile' errors (fwd)
- From: Johannes Schindelin <Johannes dot Schindelin at gmx dot de>
- To: cygwin-patches at cygwin dot com
- Date: Thu, 18 Jul 2019 15:14:39 +0200 (CEST)
- Subject: Re: [PATCH 4/5] Cygwin: fix GCC 8.3 'asm volatile' errors (fwd)
Apparently I ran afoul of some overzealous spam filter:
SMTP error from remote server for TEXT command, host: sourceware.org
(188.8.131.52) 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: "email@example.com" <firstname.lastname@example.org>
Cc: Ken Brown <email@example.com>
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?