This is the mail archive of the
mailing list for the GCC project.
result of fabs or fma when <math.h> is not included?
- From: Vincent Lefevre <vincent+gcc at vinc17 dot org>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 15 May 2017 13:22:45 +0200
- Subject: result of fabs or fma when <math.h> is not included?
- Authentication-results: sourceware.org; auth=none
Following PR80756 (which is currently about missing diagnostics, but
the problem may be more important), what should be the result of the
double fabs (double x)
return x + 1.0;
int main (void)
double x = fabs (2.0);
return x != 3.0;
Note that <math.h> is not included. When -fno-builtin-fabs is used,
the program returns 0 (because x == 3.0). But by default, a builtin
is used, and the program returns 1. Since <math.h> is not included,
I don't think this is correct. But Clang has the same behavior.
Note that neither give any warning, even with -Wall -Wextra.
Vincent Lefèvre <email@example.com> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)