* [PATCH][PR bootstrap/80565] Fixed bootstrap errors due to uninitialized memory
@ 2017-06-29 7:47 Yuri Gribov
2017-06-29 8:16 ` Jan Hubicka
0 siblings, 1 reply; 2+ messages in thread
From: Yuri Gribov @ 2017-06-29 7:47 UTC (permalink / raw)
To: GCC Patches; +Cc: hubicka, marxin, chengniansun
[-- Attachment #1: Type: text/plain, Size: 443 bytes --]
Hi,
This patch fixes uninitialized memory errors which caused bootstrap to
fail on some distros (e.g. gcc12 on compile farm). This was reported
in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80565 (and maybe also
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79224#c15).
x86_64 bootstrap completed fine. I was unable to run and compare tests
(as I was unable to bootstrap compiler before the change) but
hopefully the fix is obvious.
-Yury
[-- Attachment #2: pr80565-1.patch --]
[-- Type: application/octet-stream, Size: 2379 bytes --]
From 9deefff26370416ea738966a31d885b9634671e9 Mon Sep 17 00:00:00 2001
From: Yury Gribov <tetra2005@gmail.com>
Date: Thu, 29 Jun 2017 08:14:47 +0200
Subject: [PATCH] Fixed bootstrap errors due to uninitialized memory.
2017-06-29 Yury Gribov <tetra2005@gmail.com>
PR bootstrap/80565
* ipa-cp.c (allocate_and_init_ipcp_value): Add initialization
code.
* ipa-inline.h
(edge_growth_cache_entry::edge_growth_cache_entry): New
function.
(reset_edge_growth_cache): Update to use constructor.
---
gcc/ipa-cp.c | 8 ++++++++
gcc/ipa-inline.h | 10 +++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
index c7e3c71..ee0aa9f 100644
--- a/gcc/ipa-cp.c
+++ b/gcc/ipa-cp.c
@@ -159,6 +159,10 @@ public:
/* Time benefit and size cost that specializing the function for this value
can bring about in it's callees (transitively). */
int prop_time_benefit, prop_size_cost;
+
+ ipcp_value_base ()
+ : local_time_benefit (0), local_size_cost (0),
+ prop_time_benefit (0), prop_size_cost (0) {}
};
/* Describes one particular value stored in struct ipcp_lattice. */
@@ -188,6 +192,10 @@ public:
/* True if this valye is currently on the topo-sort stack. */
bool on_stack;
+ ipcp_value()
+ : sources (0), next (0), scc_next (0), topo_next (0),
+ spec_node (0), dfs (0), low_link (0), on_stack (false) {}
+
void add_source (cgraph_edge *cs, ipcp_value *src_val, int src_idx,
HOST_WIDE_INT offset);
};
diff --git a/gcc/ipa-inline.h b/gcc/ipa-inline.h
index 54c1ed9..4b9a1c2 100644
--- a/gcc/ipa-inline.h
+++ b/gcc/ipa-inline.h
@@ -28,6 +28,14 @@ struct edge_growth_cache_entry
sreal time, nonspec_time;
int size;
ipa_hints hints;
+
+ edge_growth_cache_entry()
+ : size (0), hints (0) {}
+
+ edge_growth_cache_entry(int64_t time, int64_t nonspec_time,
+ int size, ipa_hints hints)
+ : time (time), nonspec_time (nonspec_time), size (size),
+ hints (hints) {}
};
extern vec<edge_growth_cache_entry> edge_growth_cache;
@@ -116,7 +124,7 @@ reset_edge_growth_cache (struct cgraph_edge *edge)
{
if ((int)edge_growth_cache.length () > edge->uid)
{
- struct edge_growth_cache_entry zero = {0, 0, 0, 0};
+ struct edge_growth_cache_entry zero (0, 0, 0, 0);
edge_growth_cache[edge->uid] = zero;
}
}
--
2.9.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH][PR bootstrap/80565] Fixed bootstrap errors due to uninitialized memory
2017-06-29 7:47 [PATCH][PR bootstrap/80565] Fixed bootstrap errors due to uninitialized memory Yuri Gribov
@ 2017-06-29 8:16 ` Jan Hubicka
0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2017-06-29 8:16 UTC (permalink / raw)
To: Yuri Gribov; +Cc: GCC Patches, marxin, chengniansun
> Hi,
>
> This patch fixes uninitialized memory errors which caused bootstrap to
> fail on some distros (e.g. gcc12 on compile farm). This was reported
> in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80565 (and maybe also
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79224#c15).
>
> x86_64 bootstrap completed fine. I was unable to run and compare tests
> (as I was unable to bootstrap compiler before the change) but
> hopefully the fix is obvious.
OK, thanks!
Honza
>
> -Yury
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-06-29 8:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29 7:47 [PATCH][PR bootstrap/80565] Fixed bootstrap errors due to uninitialized memory Yuri Gribov
2017-06-29 8:16 ` Jan Hubicka
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).