public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95221] g++.dg/ubsan/vptr-12.C fails with -fstrong-eval-order=all Date: Tue, 19 May 2020 20:09:57 +0000 [thread overview] Message-ID: <bug-95221-4-oCriHVs8Gu@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-95221-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95221 --- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> --- It is caused by this code: 853 if (flag_strong_eval_order == 2 854 && CALL_EXPR_FN (*expr_p) 855 && cp_get_callee_fndecl_nofold (*expr_p) == NULL_TREE) 856 { 857 tree fnptrtype = TREE_TYPE (CALL_EXPR_FN (*expr_p)); 858 enum gimplify_status t 859 = gimplify_to_rvalue (&CALL_EXPR_FN (*expr_p), pre_p, NULL, 860 is_gimple_call_addr); 861 if (t == GS_ERROR) 862 ret = GS_ERROR; 863 /* GIMPLE considers most pointer conversion useless, but for 864 calls we actually care about the exact function pointer type. */ 865 else if (TREE_TYPE (CALL_EXPR_FN (*expr_p)) != fnptrtype) 866 CALL_EXPR_FN (*expr_p) 867 = build1 (NOP_EXPR, fnptrtype, CALL_EXPR_FN (*expr_p)); 868 } and causes this difference: --- 1g 2020-05-19 11:42:32.123168379 -0400 +++ 2g 2020-05-19 11:42:41.254133594 -0400 @@ -18,21 +18,21 @@ operator delete (D.2725, 8); } c = D.2725; + _1 = c->_vptr.MyClass; + _2 = *_1; c.0 = c; - _1 = c.0->_vptr.MyClass; - _2 = (long unsigned int) _1; - .UBSAN_VPTR (c.0, _2, 2968783897514143607, &_ZTI7MyClass, 4B); - _3 = c->_vptr.MyClass; - _4 = *_3; - OBJ_TYPE_REF(_4;(struct MyClass)c->0) (c.0); + _3 = c.0->_vptr.MyClass; + _4 = (long unsigned int) _3; + .UBSAN_VPTR (c.0, _4, 2968783897514143607, &_ZTI7MyClass, 4B); + OBJ_TYPE_REF(_2;(struct MyClass)c->0) (c.0); + _5 = c->_vptr.MyClass; + _6 = _5 + 16; + _7 = *_6; c.1 = c; - _5 = c.1->_vptr.MyClass; - _6 = (long unsigned int) _5; - .UBSAN_VPTR (c.1, _6, 2968783897514143607, &_ZTI7MyClass, 4B); - _7 = c->_vptr.MyClass; - _8 = _7 + 16; - _9 = *_8; - OBJ_TYPE_REF(_9;(struct MyClass)c->2) (c.1); + _8 = c.1->_vptr.MyClass; + _9 = (long unsigned int) _8; + .UBSAN_VPTR (c.1, _9, 2968783897514143607, &_ZTI7MyClass, 4B); + OBJ_TYPE_REF(_7;(struct MyClass)c->2) (c.1); D.2751 = 0; return D.2751; }
next prev parent reply other threads:[~2020-05-19 20:09 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-19 20:06 [Bug c++/95221] New: " mpolacek at gcc dot gnu.org 2020-05-19 20:09 ` mpolacek at gcc dot gnu.org [this message] 2020-05-19 20:22 ` [Bug c++/95221] " mpolacek at gcc dot gnu.org 2020-05-19 20:30 ` mpolacek at gcc dot gnu.org 2020-05-19 21:57 ` pinskia at gcc dot gnu.org 2020-05-19 22:02 ` mpolacek at gcc dot gnu.org 2020-05-20 5:18 ` jason at gcc dot gnu.org 2020-05-22 3:32 ` jason at gcc dot gnu.org 2020-05-22 21:04 ` jason at gcc dot gnu.org 2020-05-29 16:21 ` cvs-commit at gcc dot gnu.org 2020-06-01 20:52 ` cvs-commit at gcc dot gnu.org
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=bug-95221-4-oCriHVs8Gu@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).