From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C48CE385BF83; Wed, 1 Apr 2020 07:35:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C48CE385BF83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585726542; bh=U6+EQgyGbnn9zH6MgbmS7NPtbzLfPzBNeznBe04OK+Y=; h=From:To:Subject:Date:From; b=T/3PlibUKUC6FdACThy2mL7gmbU4R5wbuEXvsThGEo0TLKQt592H/FjPpo6P7tMr4 mJnKfS/+ggPwV+s4weunjW9sav6DCarlh1qZBXhrhoBghm201bBauAmbhj5QOzgFy9 QRe9nLj/5iN1gMbhNWOkBHZO8bq1MEuC032cmB48= From: "ofekshilon at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/94429] New: Bogus sequence point warning Date: Wed, 01 Apr 2020 07:35:42 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ofekshilon at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Apr 2020 07:35:42 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94429 Bug ID: 94429 Summary: Bogus sequence point warning Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ofekshilon at gmail dot com Target Milestone: --- This code: int main()=20 { int a =3D 1; a =3D ++a ; } built with -std=3Dc++17 -Wall (or just -Wsequence-point) gives:=20 :4:5: warning: operation on 'a' may be undefined [-Wsequence-point] 4 | a =3D ++a ; | ~~^~~~~ Since c++17 this is no longer undefined: https://timsong-cpp.github.io/cppwp/n4659/expr.ass#1 Moreover, it seems that sometime ago the gcc team was aware of it: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wsequence-poi= nt "The C++17 standard will define the order of evaluation of operands in more cases: in particular it requires that the right-hand side of an assignment = be evaluated before the left-hand side, so the above examples are no longer undefined. But this option will still warn about them, to help people avoid writing code that is undefined in C and earlier revisions of C++." I (and others, https://stackoverflow.com/questions/60937761/sequence-points-is-this-gcc-wa= rning-a-bug) consider this definitely a bug. When I'm writing in C++17 and need to prod= uce warning-free code, I don't expect to work around the compiler saying I shou= ld write code that would be valid in other language versions.=