Commit 8e640712 by Martin Sebor Committed by Martin Sebor

PR bootstrap/80486 - spurious -Walloc-size-larger-than and -Wstringop-overflow…

PR bootstrap/80486 - spurious -Walloc-size-larger-than and -Wstringop-overflow in dominance.c during profiledbootstrap

gcc/ChangeLog:

	PR bootstrap/80486
	* dominance.c (dom_info::m_n_basic_blocks): Change type to unsigned.
	(new_zero_array): Adjust signature.
	(dom_info::dom_init): Used unsigned rather that size_t.
	(dom_info::dom_info): Same.

From-SVN: r247261
parent 7629ae90
2017-04-25 Martin Sebor <msebor@redhat.com>
PR bootstrap/80486
* dominance.c (dom_info::m_n_basic_blocks): Change type to unsigned.
(new_zero_array): Adjust signature.
(dom_info::dom_init): Used unsigned rather that size_t.
(dom_info::dom_info): Same.
2017-04-25 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com> 2017-04-25 Ramana Radhakrishnan <ramana.radhakrishnan@arm.com>
Jakub Jelinek <jakub@redhat.com> Jakub Jelinek <jakub@redhat.com>
......
...@@ -125,7 +125,7 @@ private: ...@@ -125,7 +125,7 @@ private:
bitmap m_fake_exit_edge; bitmap m_fake_exit_edge;
/* Number of basic blocks in the function being compiled. */ /* Number of basic blocks in the function being compiled. */
size_t m_n_basic_blocks; unsigned m_n_basic_blocks;
/* True, if we are computing postdominators (rather than dominators). */ /* True, if we are computing postdominators (rather than dominators). */
bool m_reverse; bool m_reverse;
...@@ -148,7 +148,7 @@ void debug_dominance_tree (cdi_direction, basic_block); ...@@ -148,7 +148,7 @@ void debug_dominance_tree (cdi_direction, basic_block);
`x = new T[num] {};'. */ `x = new T[num] {};'. */
template<typename T> template<typename T>
inline T *new_zero_array (size_t num) inline T *new_zero_array (unsigned num)
{ {
T *result = new T[num]; T *result = new T[num];
memset (result, 0, sizeof (T) * num); memset (result, 0, sizeof (T) * num);
...@@ -160,14 +160,15 @@ inline T *new_zero_array (size_t num) ...@@ -160,14 +160,15 @@ inline T *new_zero_array (size_t num)
void void
dom_info::dom_init (void) dom_info::dom_init (void)
{ {
size_t num = m_n_basic_blocks; unsigned num = m_n_basic_blocks;
m_dfs_parent = new_zero_array <TBB> (num); m_dfs_parent = new_zero_array <TBB> (num);
m_dom = new_zero_array <TBB> (num); m_dom = new_zero_array <TBB> (num);
m_path_min = new TBB[num]; m_path_min = new TBB[num];
m_key = new TBB[num]; m_key = new TBB[num];
m_set_size = new unsigned int[num]; m_set_size = new unsigned int[num];
for (size_t i = 0; i < num; i++) for (unsigned i = 0; i < num; i++)
{ {
m_path_min[i] = m_key[i] = i; m_path_min[i] = m_key[i] = i;
m_set_size[i] = 1; m_set_size[i] = 1;
...@@ -221,13 +222,13 @@ dom_info::dom_info (function *fn, cdi_direction dir) ...@@ -221,13 +222,13 @@ dom_info::dom_info (function *fn, cdi_direction dir)
dom_info::dom_info (vec<basic_block> region, cdi_direction dir) dom_info::dom_info (vec<basic_block> region, cdi_direction dir)
{ {
m_n_basic_blocks = region.length (); m_n_basic_blocks = region.length ();
unsigned int nm1 = m_n_basic_blocks - 1; unsigned nm1 = m_n_basic_blocks - 1;
dom_init (); dom_init ();
/* Determine max basic block index in region. */ /* Determine max basic block index in region. */
int max_index = region[0]->index; int max_index = region[0]->index;
for (size_t i = 1; i <= nm1; i++) for (unsigned i = 1; i <= nm1; i++)
if (region[i]->index > max_index) if (region[i]->index > max_index)
max_index = region[i]->index; max_index = region[i]->index;
max_index += 1; /* set index on the first bb out of region. */ max_index += 1; /* set index on the first bb out of region. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment