[Bug c++/45437] Loses reference during update

2011-07-08 Thread jason at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437 Jason Merrill jason at gcc dot gnu.org changed: What|Removed |Added Keywords||wrong-code

[Bug c++/45437] Loses reference during update

2011-07-08 Thread jason at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437 --- Comment #17 from Jason Merrill jason at gcc dot gnu.org 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=gccview=revrev=176072 Log: PR c++/45437 gcc/ *

[Bug c++/45437] Loses reference during update

2011-07-08 Thread jason at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437 Jason Merrill jason at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|RESOLVED

[Bug c++/45437] Loses reference during update

2011-03-23 Thread phorgan1 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45437 Patrick Horgan phorgan1 at gmail dot com changed: What|Removed |Added CC||phorgan1 at

[Bug c++/45437] Loses reference during update

2010-09-02 Thread jason at gcc dot gnu dot org
--- 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

[Bug c++/45437] Loses reference during update

2010-08-30 Thread igodard at pacbell dot net
--- 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

[Bug c++/45437] Loses reference during update

2010-08-29 Thread redi at gcc dot gnu dot org
--- 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

[Bug c++/45437] Loses reference during update

2010-08-29 Thread igodard at pacbell dot net
--- 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

[Bug c++/45437] Loses reference during update

2010-08-29 Thread igodard at pacbell dot net
--- 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()

[Bug c++/45437] Loses reference during update

2010-08-29 Thread redi at gcc dot gnu dot org
--- 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 means

[Bug c++/45437] Loses reference during update

2010-08-29 Thread redi at gcc dot gnu dot org
--- 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

[Bug c++/45437] Loses reference during update

2010-08-28 Thread rguenth at gcc dot gnu dot org
--- 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 not

[Bug c++/45437] Loses reference during update

2010-08-28 Thread igodard at pacbell dot net
--- 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

[Bug c++/45437] Loses reference during update

2010-08-28 Thread redi at gcc dot gnu dot org
--- 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

[Bug c++/45437] Loses reference during update

2010-08-28 Thread redi at gcc dot gnu dot org
--- 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

[Bug c++/45437] Loses reference during update

2010-08-27 Thread pinskia at gcc dot gnu dot org
--- 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 |

[Bug c++/45437] Loses reference during update

2010-08-27 Thread igodard at pacbell dot net
--- 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

[Bug c++/45437] Loses reference during update

2010-08-27 Thread pinskia at gcc dot gnu dot org
--- 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

[Bug c++/45437] Loses reference during update

2010-08-27 Thread igodard at pacbell dot net
--- 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 empbool/emp,