http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437
Jason Merrill changed:
What|Removed |Added
Status|ASSIGNED|RESOLVED
Resolution|
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437
--- Comment #17 from Jason Merrill 2011-07-09
03:33:56 UTC ---
Author: jason
Date: Sat Jul 9 03:33:54 2011
New Revision: 176072
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=176072
Log:
PR c++/45437
gcc/
* gimplify.c (goa_stabil
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437
Jason Merrill changed:
What|Removed |Added
Keywords||wrong-code
Status|NEW
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437
Patrick Horgan changed:
What|Removed |Added
CC||phorgan1 at gmail dot com
--- Comment #1
--- Comment #15 from jason at gcc dot gnu dot org 2010-09-02 15:50 ---
Indeed, C++0x 5.17p1 is quite clear.
--
jason at gcc dot gnu dot org changed:
What|Removed |Added
--- Comment #14 from igodard at pacbell dot net 2010-08-31 02:20 ---
Reopened, based on following communication from Clark Nelson
+
> > In one interpretation, it means the rvalue evaluation of b and f(); in
> > this interpr
--- Comment #13 from redi at gcc dot gnu dot org 2010-08-29 22:39 ---
Here's a reduced testcase, struct s is not relevant:
bool f(bool& b) {
b = true;
return false;
}
int main() {
bool b = false;
b |= f(b);
return b;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437
--- Comment #12 from redi at gcc dot gnu dot org 2010-08-29 20:50 ---
(In reply to comment #10)
>
> However you beg the question because you assume that "evaluation of operands"
> means "evaluation of rvalues derived from the operands".
I assume nothing of the sort.
> It does not; it
--- Comment #11 from igodard at pacbell dot net 2010-08-29 18:24 ---
Note to Nelson, for the record here:
There is a disagreement about C++ sequence semantics happening in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437
The gist is the following code:
bool b = false;
bool f()
--- Comment #10 from igodard at pacbell dot net 2010-08-29 18:00 ---
I agree that Nelson's proposal (in particular 5.17p1 -assignment and compound
assignment operators) defines the ordering as:
- evaluation of operands
- assignment
- evaluation of assignment expression i.e. evaluating re
--- Comment #9 from redi at gcc dot gnu dot org 2010-08-29 11:28 ---
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1944 proposed the
changes to sequencing wording, revised in
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2239.html
The new wording makes it clear tha
--- Comment #8 from redi at gcc dot gnu dot org 2010-08-29 00:55 ---
The sequencing rules have changed in C++0x, but G++ doesn't implement them yet
AFAIK, and I'm not sure if the new rules affect this example
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437
--- Comment #7 from redi at gcc dot gnu dot org 2010-08-28 23:48 ---
(In reply to comment #6)
> Thank you. Don't know about C, but this is C++ in which operators are
> function.
Builtin operators are not functions.
See e.g. footnote 12 on 1.9p18 in C++ 2003 which makes it clear that b
--- Comment #6 from igodard at pacbell dot net 2010-08-28 17:49 ---
Thank you. Don't know about C, but this is C++ in which operators are function.
BTW, even in C the standard goes to some lengths in places to make things that
look like functions but have odd semantics be defined as macr
--- Comment #5 from rguenth at gcc dot gnu dot org 2010-08-28 11:40 ---
Note that internally there is no such thing as an operator|= for fundamental
types, but things are treated like in C. If you were in C,
sz.b |= f (&sz, &sz, &sz, 3);
there is no sequence point before |= as it's n
--- Comment #4 from igodard at pacbell dot net 2010-08-28 04:32 ---
Yes, I understand that the comma is not a sequence point, and a may be
evaluated (to a&) in any order w/r/t f() (to bool). But it is not legal to
evaluate a to bool before the call of |=, because |= takes bool&,
not bool
--- Comment #3 from pinskia at gcc dot gnu dot org 2010-08-28 04:15 ---
>There *is* a sequence point.
No, the comma for function arguments is not a sequence point. So a or f()
could be evaluated first. And then really |= is not a real function :). It is
an operator which the operator
--- Comment #2 from igodard at pacbell dot net 2010-08-28 04:11 ---
"No it must be evaluated as if it was:
operator|=(a, f())"
Exactly. The arguments (a and f()) must be evaluated to their parameter types
(bool& and bool) before the call to |=. There *is* a sequence point; it's the
--- Comment #1 from pinskia at gcc dot gnu dot org 2010-08-28 03:34 ---
This code is undefined.
sz.b |= f(sz, sz, sz, 3);
Has two setting of sz.b without a sequence point.
That is it can be interrupted as either:
bool temp = sz.b;
bool temp1 = f(sz, sz, sz, 3);
sz.b = temp | te
19 matches
Mail list logo