all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: schwab@suse.de, dmantipov@yandex.ru, emacs-devel@gnu.org,
	eggert@cs.ucla.edu
Subject: Re: Warnings/errors related to possibly clobbered variables
Date: Tue, 13 Jan 2015 22:10:05 +0200	[thread overview]
Message-ID: <83egqy4f36.fsf@gnu.org> (raw)
In-Reply-To: <jwv8uh64gg7.fsf-monnier+emacs@gnu.org>

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Dmitry Antipov <dmantipov@yandex.ru>,  schwab@suse.de,  eggert@cs.ucla.edu,  emacs-devel@gnu.org
> Date: Tue, 13 Jan 2015 14:43:11 -0500
> 
> > Why not declare the offending variables 'volatile' and forget about
> > all this stuff?
> 
> FWIW, `volatile' might not necessarily give us the behavior we
> want/need.

How so?  Are you saying that qualifying an automatic variable as
'volatile' might change the semantics of the program?

> IOW if the warning is legit, we should investigate and
> decide exactly how to fix the problem (which might involve using
> `volatile' or it might on the contrary involve making a copy of the
> current value).
> 
> If the warning is not legit, then it's a problem in GCC and we shouldn't
> do anything on our side other than report a bug.

The compiler is rarely wrong in these cases, especially if the warning
comes from several different versions of it.  Programs are much better
than people in examining control flow.  They don't understand the
hidden relations between the offending variable and other conditions,
so they can flag problems that don't really exist.  But they rarely
flag something that is clearly wrong.

IME, adding 'volatile' is generally TRT in these cases.  Plus, it's
very simple, and goes "by the book" (a.k.a. the C Standard).



  reply	other threads:[~2015-01-13 20:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-13 11:32 Warnings/errors related to possibly clobbered variables Dmitry Antipov
2015-01-13 11:51 ` Andreas Schwab
2015-01-13 12:12   ` Dmitry Antipov
2015-01-13 16:21     ` Eli Zaretskii
2015-01-13 17:07       ` Paul Eggert
2015-01-13 19:43       ` Stefan Monnier
2015-01-13 20:10         ` Eli Zaretskii [this message]
2015-01-13 20:55           ` Stefan Monnier
2015-01-13 21:31           ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83egqy4f36.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=dmantipov@yandex.ru \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.