From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4175 invoked by alias); 6 May 2019 16:46:28 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 3963 invoked by uid 89); 6 May 2019 16:46:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mail-ot1-f50.google.com Received: from mail-ot1-f50.google.com (HELO mail-ot1-f50.google.com) (209.85.210.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 06 May 2019 16:46:27 +0000 Received: by mail-ot1-f50.google.com with SMTP id 66so2659052otq.0 for ; Mon, 06 May 2019 09:46:27 -0700 (PDT) MIME-Version: 1.0 References: <20190506163206.GF4334@redhat.com> In-Reply-To: <20190506163206.GF4334@redhat.com> From: Jason Merrill Date: Mon, 06 May 2019 16:46:00 -0000 Message-ID: Subject: Re: C++ PATCH for c++/90265 - ICE with generic lambda To: Marek Polacek Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00233.txt.bz2 On Mon, May 6, 2019 at 12:32 PM Marek Polacek wrote: > > This new code > > vec_safe_push (call_args, (*call_args)[nargs-1]); > > doesn't seem to work well because "obj" points to garbage after the vec_safe_reserve > call: > > template > inline T * > vec_safe_push (vec *&v, const T &obj CXX_MEM_STAT_INFO) > { > vec_safe_reserve (v, 1, false PASS_MEM_STAT); > return v->quick_push (obj); > } Ah, sneaky pass by reference. > But using a dedicated variable works even when vec_safe_reserve actually > extends. > > Bootstrapped/regtested on x86_64-linux, ok for trunk/9? OK, thanks. Jason