[5/5] ranger: Fix LTO uninitialized variable warning about m_range_tree
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_build--master-arm |
success
|
Build passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-arm |
success
|
Test passed
|
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 |
success
|
Test passed
|
Commit Message
With LTO, initialize_integral_ops, initialize_integral_ops and initialize_float_ops
are all inlined into the constructor of range_op_table, so you get an uninitialized
warning about m_range_tree not being initialized due to it having a clobber at the
begining of the constructor. This adds a value initialization for m_range_tree to have
it initialized inside the constructor. This has a small startup cost since we are zeroing
the whole array a second time though since we setting it later on to be, the cost of pulling
it into the cache is going to be small.
Bootstrapped and tested on x86_64-linux-gnu with no regressions.
gcc/ChangeLog:
* range-op.h (class range_op_table): Value initialize m_range_tree.
Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
---
gcc/range-op.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
@@ -404,7 +404,12 @@ private:
gcc_checking_assert (m_range_tree[code] == NULL);
m_range_tree[code] = &op;
}
- range_operator *m_range_tree[RANGE_OP_TABLE_SIZE];
+
+ /* m_range_tree needs to be value initialized instead
+ of default initialized; otherwise it could be considered
+ as unitialized even though it is zero initialized due to
+ being a static variable, there is a clobber in the ctor. */
+ range_operator *m_range_tree[RANGE_OP_TABLE_SIZE]{};
void initialize_integral_ops ();
void initialize_pointer_ops ();
void initialize_float_ops ();