diff mbox series

vect: Initialize new_temp to avoid false positive warning [PR110652]

Message ID 8baf564b-e742-0b95-c052-53b1082db372@linux.ibm.com
State New
Headers show
Series vect: Initialize new_temp to avoid false positive warning [PR110652] | expand

Commit Message

Kewen.Lin July 17, 2023, 2:22 a.m. UTC
Hi,

As PR110652 and its duplicate PRs show, there could be one
build error

  error: 'new_temp' may be used uninitialized

for some build configurations.  It's a false positive warning
(or error at -Werror), but in order to make the build succeed,
this patch is to initialize the reported variable 'new_temp'
as NULL_TREE.

Confirmed this patch fixed the reported issue in PR110652
(with the same configuration).

Is it ok for trunk?

BR,
Kewen
-----
	PR tree-optimization/110652

gcc/ChangeLog:

	* tree-vect-stmts.cc (vectorizable_load): Initialize new_temp as
	NULL_TREE.
---
 gcc/tree-vect-stmts.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--
2.31.1

Comments

Richard Biener July 17, 2023, 6:39 a.m. UTC | #1
On Mon, Jul 17, 2023 at 4:22 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>
> Hi,
>
> As PR110652 and its duplicate PRs show, there could be one
> build error
>
>   error: 'new_temp' may be used uninitialized
>
> for some build configurations.  It's a false positive warning
> (or error at -Werror), but in order to make the build succeed,
> this patch is to initialize the reported variable 'new_temp'
> as NULL_TREE.
>
> Confirmed this patch fixed the reported issue in PR110652
> (with the same configuration).
>
> Is it ok for trunk?

OK.

> BR,
> Kewen
> -----
>         PR tree-optimization/110652
>
> gcc/ChangeLog:
>
>         * tree-vect-stmts.cc (vectorizable_load): Initialize new_temp as
>         NULL_TREE.
> ---
>  gcc/tree-vect-stmts.cc | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
> index c08d0ef951f..cb86d544313 100644
> --- a/gcc/tree-vect-stmts.cc
> +++ b/gcc/tree-vect-stmts.cc
> @@ -9297,7 +9297,8 @@ vectorizable_load (vec_info *vinfo,
>    class loop *containing_loop = gimple_bb (stmt_info->stmt)->loop_father;
>    bool nested_in_vect_loop = false;
>    tree elem_type;
> -  tree new_temp;
> +  /* Avoid false positive uninitialized warning, see PR110652.  */
> +  tree new_temp = NULL_TREE;
>    machine_mode mode;
>    tree dummy;
>    tree dataref_ptr = NULL_TREE;
> --
> 2.31.1
Kewen.Lin July 17, 2023, 8:48 a.m. UTC | #2
on 2023/7/17 14:39, Richard Biener wrote:
> On Mon, Jul 17, 2023 at 4:22 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>>
>> Hi,
>>
>> As PR110652 and its duplicate PRs show, there could be one
>> build error
>>
>>   error: 'new_temp' may be used uninitialized
>>
>> for some build configurations.  It's a false positive warning
>> (or error at -Werror), but in order to make the build succeed,
>> this patch is to initialize the reported variable 'new_temp'
>> as NULL_TREE.
>>
>> Confirmed this patch fixed the reported issue in PR110652
>> (with the same configuration).
>>
>> Is it ok for trunk?
> 
> OK.

Thanks Richi, pushed as r14-2560.

BR,
Kewen
diff mbox series

Patch

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index c08d0ef951f..cb86d544313 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -9297,7 +9297,8 @@  vectorizable_load (vec_info *vinfo,
   class loop *containing_loop = gimple_bb (stmt_info->stmt)->loop_father;
   bool nested_in_vect_loop = false;
   tree elem_type;
-  tree new_temp;
+  /* Avoid false positive uninitialized warning, see PR110652.  */
+  tree new_temp = NULL_TREE;
   machine_mode mode;
   tree dummy;
   tree dataref_ptr = NULL_TREE;