This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] powerpc: Fix feraiseexcept and feclearexcept macros
- From: Tulio Magno Quites Machado Filho <tuliom at ascii dot art dot br>
- To: Matheus Castanho <msc at linux dot ibm dot com>, libc-alpha at sourceware dot org
- Cc:
- Date: Fri, 06 Mar 2020 11:13:52 -0300
- Subject: Re: [PATCH] powerpc: Fix feraiseexcept and feclearexcept macros
- References: <20200303182038.6873-1-msc@linux.ibm.com>
Matheus Castanho <msc@linux.ibm.com> writes:
> A recent change to fenvinline.h modified the check if __e is a
> a power of 2 inside feraiseexcept and feclearexcept macros. It
> introduced the use of the powerof2 macro but also removed the
> if statement checking whether __e != 0 before issuing an mtfsb*
> instruction. This is problematic because powerof2 (0) evaluates
> to 1 and without the removed if __e is allowed to be 0 when
> __builtin_clz is called. In that case the value 32 is passed
> to __MTFSB*, which is invalid.
>
> This commit uses __builtin_popcount instead of powerof2 to fix this
> issue and avoid the extra check for __e != 0. This was the approach
> used by the initial versions of that previous patch.
Pushed as 1c252f0e7e5d78695f19450aa7c470bab445aa8e.
Thanks!
--
Tulio Magno