This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/4] OpenMP 4.0 offloading to Intel MIC


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.

> diff --git a/liboffloadmic/runtime/offload_host.cpp b/liboffloadmic/runtime/offload_host.cpp
> index d04233f..66c2a01 100644
> --- a/liboffloadmic/runtime/offload_host.cpp
> +++ b/liboffloadmic/runtime/offload_host.cpp
> @@ -2425,6 +2425,7 @@ bool OffloadDescriptor::setup_misc_data(const char *name)
>                                                     misc_data_size);
>          if (m_func_desc == NULL)
>            LIBOFFLOAD_ERROR(c_malloc);
> +	memset (m_func_desc, 0, m_func_desc_size + misc_data_size);
>          m_func_desc->console_enabled = console_enabled;
>          m_func_desc->timer_enabled = offload_report_enabled &&
>              (timer_enabled || offload_report_level);
> 
> 
>   -- Ilya

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]