mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-10 15:20:10 +00:00
4dfb9c9411
The generic implementation of fetestexceptflag does: int fetestexceptflag (const fexcept_t *flagp, int excepts) { /* Most versions of fegetexceptflag store exceptions in a form such that this works. */ return *flagp & excepts & FE_ALL_EXCEPT; } In the case where FE_ALL_EXCEPT is nonzero but exceptions may not be supported at runtime, this only works if fegetexceptflag cleared all the bits of FE_ALL_EXCEPT in *flagp; otherwise it accesses uninitialized data. This showed up as a failure of math/test-fetestexceptflag for MIPS o32 soft-float. This patch makes the fallback fegetexceptflag store 0 (fexcept_t is an integer type everywhere) so that this works. (No bug report in Bugzilla because this wasn't user-visible - at least, without using tools to detect uninitialized memory use at runtime - without fetestexceptflag, which is new in 2.25.) Tested for MIPS o32 soft-float. * math/fgetexcptflg.c (__fegetexceptflag): Store 0 in fexcept_t object.
37 lines
1.3 KiB
C
37 lines
1.3 KiB
C
/* Store current representation for exceptions.
|
|
Copyright (C) 1997-2017 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public
|
|
License as published by the Free Software Foundation; either
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; if not, see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#include <fenv.h>
|
|
#include <shlib-compat.h>
|
|
|
|
int
|
|
__fegetexceptflag (fexcept_t *flagp, int excepts)
|
|
{
|
|
/* Nothing to do. */
|
|
*flagp = 0;
|
|
return 0;
|
|
}
|
|
#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
|
|
strong_alias (__fegetexceptflag, __old_fegetexceptflag)
|
|
compat_symbol (libm, __old_fegetexceptflag, fegetexceptflag, GLIBC_2_1);
|
|
#endif
|
|
versioned_symbol (libm, __fegetexceptflag, fegetexceptflag, GLIBC_2_2);
|
|
|
|
stub_warning (fegetexceptflag)
|