all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: "as-is" rule
Date: Wed, 30 Nov 2011 09:20:27 -0500	[thread overview]
Message-ID: <jwv7h2h7l9f.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <E1RVjNc-00017m-H6@fencepost.gnu.org> (Eli Zaretskii's message of "Wed, 30 Nov 2011 07:35:16 -0500")

> See bug #10164: I've been hit by code re-ordering under the "as-is" rule.
> I asked before, but no one replied: is there a place where I can read
> the description of conditions that _disallow_ such reordering?

I think you've hit a bug in gcc in this case: "e1 || e2" should not
evaluate e2 if e1 evaluates to non-0.  The as-is rule allows gcc to run
any part of e2 (or any other code for that matter) at any time it feels
like, but only if you can't tell the difference, and in this case we can
definitely tell the difference.

Of course, in the world of C it's pretty common for such problems to be
due not really to a compiler bug but to an "unspecified",
"implementation defined" or "undefined" part of the language semantics
giving more freedom to the compiler than the programmer expects.
But I don't think this can be the case here (and I can't think of any
reason why the C language would allow the problem for "e1 || e2" but
not for "if (!e1) e2", since both seem to have just as much of
a sequencing point between the two expresssions).

BTW, I don't like this "#if XASSERTS" and would hence much prefer

	      xassert ((row->enabled_p && !row->mode_line_p)
		       ? verify_row_hash (row) : 1);


        Stefan



  parent reply	other threads:[~2011-11-30 14:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-30 12:35 "as-is" rule Eli Zaretskii
2011-11-30 13:57 ` Andreas Schwab
2011-11-30 14:20 ` Stefan Monnier [this message]
2011-11-30 17:02   ` Eli Zaretskii
2011-11-30 19:09     ` Stefan Monnier
2011-11-30 18:44   ` Samuel Bronson

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=jwv7h2h7l9f.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.