-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
math.h: Wrong prototypes for frexp, frexpf, frexpl lead to bogus code #929
Labels
bug
Something isn't working
Comments
sprintersb
added a commit
that referenced
this issue
Jan 31, 2024
* include/math.h (frexp, frexpf, frexpl): Remove __ATTR_CONST__.
Resolved by 28e58e0 |
sprintersb
added a commit
to sprintersb/avr-libc
that referenced
this issue
Jun 8, 2024
sprintersb
added a commit
that referenced
this issue
Jun 8, 2024
dl8dtl
pushed a commit
that referenced
this issue
Jun 8, 2024
dl8dtl
added a commit
that referenced
this issue
Jun 8, 2024
* Remove obsolete tags from doxygen.conf.in * Attempt to add a logo to the documentation * Increase spacing betwen logo and title * Oops, the logo files were ignored due to global gitignore Refine gitignore about what PNGs to ignore. * Use correct automake variables to refer to source files * NEWS - Mention #929: Wrong frexp* erotos in math.h * NEWS - Add / fix #962, #936, #642. * NEWS - Mention Issue #931 (FLAMP). * Update year, mention Johann. * Unify spaces between paragraphs * Update description for mktime() tm_isdst is a value that is used on input and output, and it controls how the function works, according to the C standard. Closes issue #967 * tools-install.dox - Typo: master -> main * Remove old LaTeX tweaks when generating docs These were once used to tune certain things which are no longer applicable anyway. * Attempt to add a logo to the documentation * Place the logo in the center of the HTML header Instead of declaring it as a Doxygen-managed logo, replace the old "avrs.png" by the new logo. --------- Co-authored-by: Georg-Johann Lay <avr@gjlay.de>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
frexp
family of math functions has a bogusattribute((const))
.The only effect of
const
functions is to evaluate arguments and to return a value (basically also applies topure
). The prototype however is:float frexpf (float x, int *ex);
but with attribute
const
, GCC will assume thatex
will not be changed in calls likefrexp (x, &ex)
. Here is a complete test case:What happens is that gcc thinks that
frexpf (x, &ex)
does not changeex
and returns 123.This bug was introduced with the big math.h transition with e08bbd2 so my bad.
FYI, the runtest in
./tests/simulate/math/frexp-01.c
triggers, so can also be used as a regression test.The text was updated successfully, but these errors were encountered: