* [PATCH] vect: Init inside_cost in vect_model_reduction_cost
@ 2021-03-25 6:04 Kewen.Lin
2021-03-25 6:16 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Kewen.Lin @ 2021-03-25 6:04 UTC (permalink / raw)
To: GCC Patches
Hi,
I happened to find this possible use of uninitialized inside_cost during
checking the cost for reduction. Before r11-6587, all the if/else if/else
arms will assign values to inside_cost, so it was fine. But from r11-6587
the else path won't assign any more, it leads the inside_cost possibly
uninitialized for later use. Note that it won't have any functionality
issues, just could show one unreasonable cost in dump file.
This is a trivial fix and I guess it can be counted as obvious, but
I'm not sure if it's ok in stage 4. So is it ok for trunk?
BR,
Kewen
-----
gcc/ChangeLog:
* tree-vect-loop.c (vect_model_reduction_cost): Init inside_cost.
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 3e973e774af..38d96fc1634 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -4465,7 +4465,7 @@ vect_model_reduction_cost (loop_vec_info loop_vinfo,
vect_reduction_type reduction_type,
int ncopies, stmt_vector_for_cost *cost_vec)
{
- int prologue_cost = 0, epilogue_cost = 0, inside_cost;
+ int prologue_cost = 0, epilogue_cost = 0, inside_cost = 0;
enum tree_code code;
optab optab;
tree vectype;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] vect: Init inside_cost in vect_model_reduction_cost
2021-03-25 6:04 [PATCH] vect: Init inside_cost in vect_model_reduction_cost Kewen.Lin
@ 2021-03-25 6:16 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2021-03-25 6:16 UTC (permalink / raw)
To: Kewen.Lin, GCC Patches
On 3/25/2021 12:04 AM, Kewen.Lin via Gcc-patches wrote:
> Hi,
>
> I happened to find this possible use of uninitialized inside_cost during
> checking the cost for reduction. Before r11-6587, all the if/else if/else
> arms will assign values to inside_cost, so it was fine. But from r11-6587
> the else path won't assign any more, it leads the inside_cost possibly
> uninitialized for later use. Note that it won't have any functionality
> issues, just could show one unreasonable cost in dump file.
>
> This is a trivial fix and I guess it can be counted as obvious, but
> I'm not sure if it's ok in stage 4. So is it ok for trunk?
>
>
> BR,
> Kewen
> -----
> gcc/ChangeLog:
>
> * tree-vect-loop.c (vect_model_reduction_cost): Init inside_cost.
OK
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-25 6:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 6:04 [PATCH] vect: Init inside_cost in vect_model_reduction_cost Kewen.Lin
2021-03-25 6:16 ` Jeff Law
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).