[4/4] math: Suppress -O0 warnings for soft-fp fsqrt [BZ #19444]

Message ID 20221229125802.2715435-5-adhemerval.zanella@linaro.org
State Committed
Commit 30546ac2d1d64adff07d317e3041ec0fc6e32f6d
Headers
Series Fix remaining -Os/-O1 compile issues [BZ #19444] |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Adhemerval Zanella Dec. 29, 2022, 12:58 p.m. UTC
  The patch suppress the same warnings from 87c266d758d29e52bfb717f90,
that shows issues for microblaze, mips soft-fp, nios2, and or1k.
---
 sysdeps/ieee754/soft-fp/s_fsqrt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
  

Comments

Carlos O'Donell Jan. 10, 2023, 10:54 p.m. UTC | #1
On 12/29/22 07:58, Adhemerval Zanella via Libc-alpha wrote:
> The patch suppress the same warnings from 87c266d758d29e52bfb717f90,
> that shows issues for microblaze, mips soft-fp, nios2, and or1k.

LGTM.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

> ---
>  sysdeps/ieee754/soft-fp/s_fsqrt.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/sysdeps/ieee754/soft-fp/s_fsqrt.c b/sysdeps/ieee754/soft-fp/s_fsqrt.c
> index ef631bc6c2..d5c7904118 100644
> --- a/sysdeps/ieee754/soft-fp/s_fsqrt.c
> +++ b/sysdeps/ieee754/soft-fp/s_fsqrt.c
> @@ -25,6 +25,15 @@
>  #undef fsqrtl
>  
>  #include <math-narrow.h>
> +#include <libc-diag.h>
> +/* R_f[01] are not set in cases where they are not used in packing,
> +   but the compiler does not see that they are set in all cases where
> +   they are used, resulting in warnings that they may be used
> +   uninitialized.  The location of the warning differs in different
> +   versions of GCC, it may be where R is defined using a macro or it
> +   may be where the macro is defined.  This happens only with -O1.  */
> +DIAG_PUSH_NEEDS_COMMENT;
> +DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");

OK. Agreed, R's usage in _FP_SQRT is conditional.

>  #include <soft-fp.h>
>  #include <single.h>
>  #include <double.h>
> @@ -51,4 +60,6 @@ __fsqrt (double x)
>    CHECK_NARROW_SQRT (ret, x);
>    return ret;
>  }
> +DIAG_POP_NEEDS_COMMENT;
> +
>  libm_alias_float_double (sqrt)
  

Patch

diff --git a/sysdeps/ieee754/soft-fp/s_fsqrt.c b/sysdeps/ieee754/soft-fp/s_fsqrt.c
index ef631bc6c2..d5c7904118 100644
--- a/sysdeps/ieee754/soft-fp/s_fsqrt.c
+++ b/sysdeps/ieee754/soft-fp/s_fsqrt.c
@@ -25,6 +25,15 @@ 
 #undef fsqrtl
 
 #include <math-narrow.h>
+#include <libc-diag.h>
+/* R_f[01] are not set in cases where they are not used in packing,
+   but the compiler does not see that they are set in all cases where
+   they are used, resulting in warnings that they may be used
+   uninitialized.  The location of the warning differs in different
+   versions of GCC, it may be where R is defined using a macro or it
+   may be where the macro is defined.  This happens only with -O1.  */
+DIAG_PUSH_NEEDS_COMMENT;
+DIAG_IGNORE_NEEDS_COMMENT (8, "-Wmaybe-uninitialized");
 #include <soft-fp.h>
 #include <single.h>
 #include <double.h>
@@ -51,4 +60,6 @@  __fsqrt (double x)
   CHECK_NARROW_SQRT (ret, x);
   return ret;
 }
+DIAG_POP_NEEDS_COMMENT;
+
 libm_alias_float_double (sqrt)