[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-11-07 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:a73035b886b6f17149ca6a4387c4e943d944d4cc

commit a73035b886b6f17149ca6a4387c4e943d944d4cc
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 3f5f0e727665..a7c20eec4fc8 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14446,7 +14446,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14475,6 +14475,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-11-01 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:621e567cae24d12f4eb34d0e37889bfb8ec0d036

commit 621e567cae24d12f4eb34d0e37889bfb8ec0d036
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 3f5f0e727665..a7c20eec4fc8 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14446,7 +14446,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14475,6 +14475,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-10-18 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:db02e1f5575fa8f622967f30fdc19adcd460510d

commit db02e1f5575fa8f622967f30fdc19adcd460510d
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index df6e95668e03..955a3580d3a6 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14439,7 +14439,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14468,6 +14468,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-09-13 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:70295d057d0631466be6b6315fb47673ed2ef7cc

commit 70295d057d0631466be6b6315fb47673ed2ef7cc
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index df6e95668e03..955a3580d3a6 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14439,7 +14439,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14468,6 +14468,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-09-07 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:57234351e1fec1164f68b5b63c281d6d90dc95b4

commit 57234351e1fec1164f68b5b63c281d6d90dc95b4
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index b511f70b6ada..c45c1683860a 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14438,7 +14438,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14467,6 +14467,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-08-25 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:64ded697681e489951c054af6b12b5ea5fac7ff7

commit 64ded697681e489951c054af6b12b5ea5fac7ff7
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index b511f70b6ada..c45c1683860a 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14438,7 +14438,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14467,6 +14467,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-07-23 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:091ab9463a2025a635fe23c88b7c1f8adaef6a0a

commit 091ab9463a2025a635fe23c88b7c1f8adaef6a0a
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 54395b8d3a74..0b10842d1765 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14429,7 +14429,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14458,6 +14458,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-07-05 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:ca3b6681835957568ec9c2beac4d697ddda8424a

commit ca3b6681835957568ec9c2beac4d697ddda8424a
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 54395b8d3a74..0b10842d1765 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14429,7 +14429,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14458,6 +14458,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }


[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] [RISC-V] Fix false positive from Wuninitialized

2025-05-19 Thread Jeff Law via Gcc-cvs
https://gcc.gnu.org/g:7b6a39a58c37fe584659bc74e402aa57e2b1d958

commit 7b6a39a58c37fe584659bc74e402aa57e2b1d958
Author: Jeff Law 
Date:   Mon May 19 12:00:56 2025 -0600

[RISC-V] Fix false positive from Wuninitialized

As Mark and I independently tripped, there's a Wuninitialized issue in the
RISC-V backend.  While *I* know the value would always be properly 
initialized,
it'd be somewhat painful to either eliminate the infeasible paths or do deep
enough analysis to suppress the false positive.

So this initializes OUTPUT and verifies it's got a reasonable value before
using it for the final copy into operands[0].

Bootstrapped on the BPI (regression testing still has ~12hrs to go).

gcc/
* config/riscv/riscv.cc (synthesize_ior_xor): Initialize OUTPUT and
verify it's non-null before emitting the final copy insn.

(cherry picked from commit cbc258cd318756db8b5f0e4055dd8f1c1d618d22)

Diff:
---
 gcc/config/riscv/riscv.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 54395b8d3a74..0b10842d1765 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -14429,7 +14429,7 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   /* Synthesis is better than loading the constant.  */
   ival = INTVAL (operands[2]);
   rtx input = operands[1];
-  rtx output;
+  rtx output = NULL_RTX;
 
   /* Emit the [x]ori insn that sets the low 11 bits into
  the proper state.  */
@@ -14458,6 +14458,8 @@ synthesize_ior_xor (rtx_code code, rtx operands[3])
   input = output;
   ival &= ~tmpval;
 }
+
+  gcc_assert (output);
   emit_move_insn (operands[0], output);
   return true;
 }