emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "as-is" rule


From: Stefan Monnier
Subject: Re: "as-is" rule
Date: Wed, 30 Nov 2011 09:20:27 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]