* [PATCH 1/2] Fix uninitialized field in expand_operand.
@ 2020-01-16 7:08 apinski
2020-01-16 7:32 ` [PATCH 2/2] Uninitialized padding in struct _dep apinski
2020-01-16 9:40 ` [PATCH 1/2] Fix uninitialized field in expand_operand Richard Biener
0 siblings, 2 replies; 4+ messages in thread
From: apinski @ 2020-01-16 7:08 UTC (permalink / raw)
To: gcc-patches; +Cc: Andrew Pinski
From: Andrew Pinski <apinski@marvell.com>
Commit g:f96bf49a0 added the target field to expand_operand.
But it leaves it uninitialized when doing a full initialization
inside create_expand_operand. This fixes the problem and improves
the code generation inside create_expand_operand too.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
ChangeLog:
* optabs.h (create_expand_operand): Initialize target field also.
Change-Id: Ib653fbfbb2b0709970db87fb94de14b59758bc6c
---
gcc/optabs.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/gcc/optabs.h b/gcc/optabs.h
index 07bdc56586e..5bd19503a0a 100644
--- a/gcc/optabs.h
+++ b/gcc/optabs.h
@@ -78,6 +78,7 @@ create_expand_operand (class expand_operand *op,
{
op->type = type;
op->unsigned_p = unsigned_p;
+ op->target = 0;
op->unused = 0;
op->mode = mode;
op->value = value;
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/2] Uninitialized padding in struct _dep.
2020-01-16 7:08 [PATCH 1/2] Fix uninitialized field in expand_operand apinski
@ 2020-01-16 7:32 ` apinski
2020-01-16 9:41 ` Richard Biener
2020-01-16 9:40 ` [PATCH 1/2] Fix uninitialized field in expand_operand Richard Biener
1 sibling, 1 reply; 4+ messages in thread
From: apinski @ 2020-01-16 7:32 UTC (permalink / raw)
To: gcc-patches; +Cc: Andrew Pinski
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.
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))
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] Fix uninitialized field in expand_operand.
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:40 ` Richard Biener
1 sibling, 0 replies; 4+ messages in thread
From: Richard Biener @ 2020-01-16 9:40 UTC (permalink / raw)
To: gcc-patches, apinski; +Cc: Andrew Pinski
On January 16, 2020 6:08:48 AM GMT+01:00, apinski@marvell.com wrote:
>From: Andrew Pinski <apinski@marvell.com>
>
>Commit g:f96bf49a0 added the target field to expand_operand.
>But it leaves it uninitialized when doing a full initialization
>inside create_expand_operand. This fixes the problem and improves
>the code generation inside create_expand_operand too.
>
>OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
OK.
Richard.
>ChangeLog:
>* optabs.h (create_expand_operand): Initialize target field also.
>
>Change-Id: Ib653fbfbb2b0709970db87fb94de14b59758bc6c
>---
> gcc/optabs.h | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/gcc/optabs.h b/gcc/optabs.h
>index 07bdc56586e..5bd19503a0a 100644
>--- a/gcc/optabs.h
>+++ b/gcc/optabs.h
>@@ -78,6 +78,7 @@ create_expand_operand (class expand_operand *op,
> {
> op->type = type;
> op->unsigned_p = unsigned_p;
>+ op->target = 0;
> op->unused = 0;
> op->mode = mode;
> op->value = value;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] Uninitialized padding in struct _dep.
2020-01-16 7:32 ` [PATCH 2/2] Uninitialized padding in struct _dep apinski
@ 2020-01-16 9:41 ` Richard Biener
0 siblings, 0 replies; 4+ messages in thread
From: Richard Biener @ 2020-01-16 9:41 UTC (permalink / raw)
To: gcc-patches, apinski; +Cc: Andrew Pinski
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))
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-01-16 8:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-01-16 9:40 ` [PATCH 1/2] Fix uninitialized field in expand_operand Richard Biener
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).