From patchwork Wed Jul 29 16:45:52 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Steve Kargl X-Patchwork-Id: 501769 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7D7251402F0 for ; Thu, 30 Jul 2015 02:46:09 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=ZOyW2qpU; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; q=dns; s= default; b=VxnEYuOap3a4Jr4oSS9RSnWEgBaE7bFBedsxciHbRzgFnKJ66vi1h FIFNZgvGREDFUd+cDWP6f2VKyhz9CbULiwocRze17CF41YABcMgMOqSa+LfQTcjv pfPZV4XVYHqm2unZVwCR3vtETpZJTOnhPnJ6qkJmhPqjmaVFfpMDNo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:content-transfer-encoding:in-reply-to; s=default; bh=3/1px61DUzLbTV26kBo6qOUDvTk=; b=ZOyW2qpUQm73bQ0xjNeXEmws9ToG AwTTLfBntfixQvxSzdzj9kBdXhK+J+4t/bcMpPJP8NOmrqtXrs8XgB3wArxRqWqi tLkF8BXHdJq12G2CAViZs0wVe1JXmlfw1RgFhWmQui4vVICbW3R1QAVgTmYUwDjX TJ7uYtoj4vIQXe0= Received: (qmail 67394 invoked by alias); 29 Jul 2015 16:45:57 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 67371 invoked by uid 89); 29 Jul 2015 16:45:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: troutmask.apl.washington.edu Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 29 Jul 2015 16:45:55 +0000 Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.15.2/8.15.2) with ESMTPS id t6TGjrfR012073 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 29 Jul 2015 09:45:53 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.15.2/8.15.2/Submit) id t6TGjqv4012072; Wed, 29 Jul 2015 09:45:52 -0700 (PDT) (envelope-from sgk) Date: Wed, 29 Jul 2015 09:45:52 -0700 From: Steve Kargl To: Richard Biener Cc: Mikael Morin , "fortran@gcc.gnu.org" , GCC Patches Subject: Re: [PATCH] PR fortran/66942 -- avoid referencing a NULL C++ thing Message-ID: <20150729164552.GA12035@troutmask.apl.washington.edu> References: <20150721190814.GA32735@troutmask.apl.washington.edu> <55B77DF4.3070209@sfr.fr> <20150728131925.GA63678@troutmask.apl.washington.edu> <55B89E0B.1030506@sfr.fr> <55B8C028.1000409@sfr.fr> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) On Wed, Jul 29, 2015 at 02:04:12PM +0200, Richard Biener wrote: > On Wed, Jul 29, 2015 at 1:59 PM, Mikael Morin wrote: > > Le 29/07/2015 13:22, Richard Biener a écrit : > >> > >> On Wed, Jul 29, 2015 at 11:34 AM, Mikael Morin > >> wrote: > >>> > >>> Le 29/07/2015 10:26, Richard Biener a écrit : > >>>>>> > >>>>>> > >>>>>> Did you try using vec_safe_splice? > >>>> > >>>> > >>>> > >>>> That handles NULL retargs, not NULL or empty arglist. > >>>> > >>> I think retargs is NULL. > >> > >> > >> Not if the patch fixes anything. > >> > > The case retargs == NULL is the case arglen == 0, which means every vector > > pointer we are about to splice is NULL. > > So the patch fixes it. > > Ok, that wasn't obvious from reading the patch. > This builds and passes regression testing on x86_64-*-freebsd. OP found the problem by running the sanatizers. I don't know how to build gcc with this as a build option. I'll commit whichever diff you recommend. Index: trans-expr.c =================================================================== --- trans-expr.c (revision 226328) +++ trans-expr.c (working copy) @@ -5921,18 +5921,18 @@ gfc_conv_procedure_call (gfc_se * se, gf vec_safe_reserve (retargs, arglen); /* Add the return arguments. */ - retargs->splice (arglist); + vec_safe_splice (retargs, arglist); /* Add the hidden present status for optional+value to the arguments. */ - retargs->splice (optionalargs); + vec_safe_splice (retargs, optionalargs); /* Add the hidden string length parameters to the arguments. */ - retargs->splice (stringargs); + vec_safe_splice (retargs, stringargs); /* We may want to append extra arguments here. This is used e.g. for calls to libgfortran_matmul_??, which need extra information. */ - if (!vec_safe_is_empty (append_args)) - retargs->splice (append_args); + vec_safe_splice (retargs, append_args); + arglist = retargs; /* Generate the actual call. */