This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Don't use -Wno-uninitialized in math/

On Mon, 24 Aug 2015, Andreas Schwab wrote:

> That breaks aarch64.
> In file included from ../include/fpu_control.h:1:0,
>                  from ../sysdeps/aarch64/fpu/math_private.h:23,
>                  from ../sysdeps/ieee754/dbl-64/e_exp.c:41:
> ../sysdeps/ieee754/dbl-64/e_exp.c: In function '__ieee754_exp':
> ../sysdeps/aarch64/fpu/fpu_control.h:28:3: error: 'ctx.env.__fpcr' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    __asm__ __volatile__ ("msr fpcr, %0" : : "r" (fpcr))
>    ^
> In file included from ../sysdeps/ieee754/flt-32/math_private.h:3:0,
>                  from ../sysdeps/ieee754/dbl-64/wordsize-64/math_private.h:3,
>                  from ../sysdeps/aarch64/fpu/math_private.h:326,
>                  from ../sysdeps/ieee754/dbl-64/e_exp.c:41:
> ../sysdeps/generic/math_private.h:652:17: note: 'ctx.env.__fpcr' was declared here
>    struct rm_ctx ctx __attribute__((cleanup (CLEANUPFUNC ## _ctx))); \
>                  ^
> ../sysdeps/generic/math_private.h:661:3: note: in expansion of macro 'SET_RESTORE_ROUND_GENERIC'
>    SET_RESTORE_ROUND_GENERIC (RM, libc_feholdsetround, libc_feresetround)
>    ^
> ../sysdeps/ieee754/dbl-64/e_exp.c:63:5: note: in expansion of macro 'SET_RESTORE_ROUND'
>      ^

Does putting the DIAG_* macros (with appropriate comments) in the relevant 
inline functions (possibly libc_feresetround_aarch64_ctx or 
libc_feresetround_noex_aarch64_ctx) help?  That would seem to be the right 
approach for this (if the issue is that ctx.env.__fpcr is only used if 
ctx.updated_status, which is only true if ctx.env.__fpcr was set earlier, 
but the compiler can't see this).  (Failing that, maybe selected files 
need -Wno-uninitialized for aarch64, which would still be better than 
having it globally for all of math/ on all architectures.)

Joseph S. Myers

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]