public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: gcc-patches@gcc.gnu.org,apinski@marvell.com
Cc: Andrew Pinski <apinski@marvell.com>
Subject: Re: [PATCH 2/2] Uninitialized padding in struct _dep.
Date: Thu, 16 Jan 2020 09:41:00 -0000	[thread overview]
Message-ID: <BCE65273-32F1-4F73-8CB5-E77E780516CE@gmail.com> (raw)
In-Reply-To: <1579151329-6088-2-git-send-email-apinski@marvell.com>

On January 16, 2020 6:08:49 AM GMT+01:00, apinski@marvell.com wrote:
>From: Andrew Pinski <apinski@marvell.com>
>
>In struct _dep, there is an implicit padding of 4bits.  This
>bit-field padding is uninitialized when init_dep_1 is being called.
>This means we access uninitialized memory but never use it for
>anything.  Adding an unused bit-field field and initializing it
>in init_dep_1 will improve code generation also as we initialize
>the whole 32bits now rather than just part of it.
>
>OK?  Bootstrapped and tested on x86_64-linux-gnu.

OK. 

Richard. 

>Thanks,
>Andrew Pinski
>
>ChangeLog:
>* sched-int.h (_dep): Add unused bit-field field for the padding.
>* sched-deps.c (init_dep_1): Init unused field.
>
>Change-Id: I27000323e728f8a73189426e0b9a98c5235b8c55
>---
> gcc/sched-deps.c | 1 +
> gcc/sched-int.h  | 2 ++
> 2 files changed, 3 insertions(+)
>
>diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
>index 9182aba5588..331af5ffdb3 100644
>--- a/gcc/sched-deps.c
>+++ b/gcc/sched-deps.c
>@@ -101,6 +101,7 @@ init_dep_1 (dep_t dep, rtx_insn *pro, rtx_insn
>*con, enum reg_note type, ds_t ds
>   DEP_NONREG (dep) = 0;
>   DEP_MULTIPLE (dep) = 0;
>   DEP_REPLACE (dep) = NULL;
>+  dep->unused = 0;
> }
> 
> /* Init DEP with the arguments.
>diff --git a/gcc/sched-int.h b/gcc/sched-int.h
>index 833b552a340..a847f876e65 100644
>--- a/gcc/sched-int.h
>+++ b/gcc/sched-int.h
>@@ -238,6 +238,8 @@ struct _dep
>/* Cached cost of the dependency.  Make sure to update UNKNOWN_DEP_COST
>      when changing the size of this field.  */
>   int cost:20;
>+
>+  unsigned unused:4;
> };
> 
> #define UNKNOWN_DEP_COST ((int) ((unsigned int) -1 << 19))

  reply	other threads:[~2020-01-16  8:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-16  7:08 [PATCH 1/2] Fix uninitialized field in expand_operand apinski
2020-01-16  7:32 ` [PATCH 2/2] Uninitialized padding in struct _dep apinski
2020-01-16  9:41   ` Richard Biener [this message]
2020-01-16  9:40 ` [PATCH 1/2] Fix uninitialized field in expand_operand Richard Biener

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=BCE65273-32F1-4F73-8CB5-E77E780516CE@gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=apinski@marvell.com \
    --cc=gcc-patches@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: link
Be 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).