From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8227 invoked by alias); 26 Oct 2015 14:38:19 -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 8215 invoked by uid 89); 26 Oct 2015 14:38:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f171.google.com Received: from mail-ig0-f171.google.com (HELO mail-ig0-f171.google.com) (209.85.213.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 26 Oct 2015 14:38:17 +0000 Received: by igbdj2 with SMTP id dj2so57393312igb.1 for ; Mon, 26 Oct 2015 07:38:15 -0700 (PDT) X-Received: by 10.50.138.6 with SMTP id qm6mr2609519igb.74.1445870295445; Mon, 26 Oct 2015 07:38:15 -0700 (PDT) Received: from msticlxl57.ims.intel.com (jfdmzpr01-ext.jf.intel.com. [134.134.139.70]) by smtp.gmail.com with ESMTPSA id o74sm13123748ioo.8.2015.10.26.07.38.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Oct 2015 07:38:14 -0700 (PDT) Date: Mon, 26 Oct 2015 14:39:00 -0000 From: Ilya Verbin To: Jakub Jelinek Cc: Thomas Schwinge , Kirill Yukhin , gcc-patches@gcc.gnu.org Subject: Re: [PATCH 0/4] OpenMP 4.0 offloading to Intel MIC Message-ID: <20151026143753.GC35077@msticlxl57.ims.intel.com> References: <20141021171323.GA47586@msticlxl57.ims.intel.com> <87k31jzye3.fsf@kepler.schwinge.homeip.net> <20151022182637.GC63867@msticlxl57.ims.intel.com> <20151023081006.GX478@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151023081006.GX478@tucnak.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg02753.txt.bz2 On Fri, Oct 23, 2015 at 10:10:06 +0200, Jakub Jelinek wrote: > On Thu, Oct 22, 2015 at 09:26:37PM +0300, Ilya Verbin wrote: > > On Mon, Dec 22, 2014 at 13:01:40 +0100, Thomas Schwinge wrote: > > > By chance (when tracking down a different problem), I've found the > > > following. Would you please check whether that's a real problem in > > > liboffloadmic, or its libgomp plugin, or just a mis-diagnosis by > > > Valgrind? > > > > > > ==21327== Syscall param write(buf) points to uninitialised byte(s) > > > > Finally we have investigated this :) Valgrind warns about uninitialized bytes, > > inserted into the struct for alignment. It's possible to avoid the warning by > > the patch bellow. Should I commit it, or just leave it as is? > > Or use calloc instead of malloc, or add two uint8_t padding fields after the > two uint8_t fields and initialize them too. Though, as you have some > padding after the name, I think calloc is best. Here is what I committed to trunk together with an obvious change. liboffloadmic/ * runtime/offload_host.cpp (OffloadDescriptor::setup_misc_data): Use calloc instead of malloc. (__offload_fini_library): Set mic_engines_total to zero. diff --git a/liboffloadmic/runtime/offload_host.cpp b/liboffloadmic/runtime/offload_host.cpp index c6c6518..a150410 100644 --- a/liboffloadmic/runtime/offload_host.cpp +++ b/liboffloadmic/runtime/offload_host.cpp @@ -2424,8 +2424,8 @@ bool OffloadDescriptor::setup_misc_data(const char *name) } // initialize function descriptor - m_func_desc = (FunctionDescriptor*) malloc(m_func_desc_size + - misc_data_size); + m_func_desc = (FunctionDescriptor*) calloc(1, m_func_desc_size + + misc_data_size); if (m_func_desc == NULL) LIBOFFLOAD_ERROR(c_malloc); m_func_desc->console_enabled = console_enabled; @@ -5090,6 +5090,7 @@ static void __offload_fini_library(void) OFFLOAD_DEBUG_TRACE(2, "Cleanup offload library ...\n"); if (mic_engines_total > 0) { delete[] mic_engines; + mic_engines_total = 0; if (mic_proxy_fs_root != 0) { free(mic_proxy_fs_root); -- Ilya