From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: "as-is" rule
Date: Wed, 30 Nov 2011 19:02:27 +0200 [thread overview]
Message-ID: <837h2h5ysc.fsf@gnu.org> (raw)
In-Reply-To: <jwv7h2h7l9f.fsf-monnier+emacs@gnu.org>
> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
> Date: Wed, 30 Nov 2011 09:20:27 -0500
> Cc: emacs-devel@gnu.org
>
> > 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.
This is what I always knew: that `e1 || e2 || e3' are evaluated left
to right. But I understand the "as-is" rule relaxed that. Or maybe
I'm confused (which is why I asked the question in the first place).
> 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.
How do you mean "we can tell the difference"? In general, if the
"left-to-right evaluation" rule is no longer a must, e1, e2, and e3
could have been evaluated in _any_ order, and then if one of them is
non-zero, the condition holds. No?
Again, I'm utterly confused about this issue. If someone can explain
or point me to an existing explanation, I'd be grateful.
> 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);
If we are dealing with a compiler bug, how can we be sure this
expression will not hit the same bug?
Anyway, I eventually removed the assertion altogether, so this is a
moot point now.
next prev parent reply other threads:[~2011-11-30 17:02 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
2011-11-30 17:02 ` Eli Zaretskii [this message]
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=837h2h5ysc.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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.