https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84309

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #4 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Isn't this just an invalid test?  I mean, when working with floating point,
> especially when using -ffast-math, one needs to accept some inaccuracy.
> Here we compute
> 0x1.ffffffffffff9p+11
> which is 7ulps from the correct result, I'd say for -ffast-math that is
> within the acceptability limit.

There's some warnings for it:

$ /usr/local/bin/gcc -o 84309.exe -ffast-math -Wall -Wextra -pedantic
-Wconversion -Wfloat-equal -Wdouble-promotion -Wtraditional-conversion
-Wunsuffixed-float-constants 84309.c
84309.c: In function 'main':
84309.c:10:29: warning: passing argument 1 of 'log2' as floating rather than
integer due to prototype [-Wtraditional-conversion]
   size_t c = pow (2, (log2 (a) + log2 (b)) / 2);
                             ^
84309.c:10:40: warning: passing argument 1 of 'log2' as floating rather than
integer due to prototype [-Wtraditional-conversion]
   size_t c = pow (2, (log2 (a) + log2 (b)) / 2);
                                        ^
84309.c:10:19: warning: passing argument 1 of 'pow' as floating rather than
integer due to prototype [-Wtraditional-conversion]
   size_t c = pow (2, (log2 (a) + log2 (b)) / 2);
                   ^
84309.c:10:14: warning: conversion from 'double' to 'size_t' {aka 'long
unsigned int'} may change value [-Wfloat-conversion]
   size_t c = pow (2, (log2 (a) + log2 (b)) / 2);
              ^~~
$

Often times -Wconversion warnings are just noise, but in this case it seems as
if they might actually be relevant.

Reply via email to