[PATCH] Include math.h in nextafter-2.c test.
Segher Boessenkool
segher@kernel.crashing.org
Wed Nov 18 20:20:58 GMT 2020
On Sun, Nov 15, 2020 at 12:12:34PM -0500, Michael Meissner wrote:
> --- a/gcc/testsuite/gcc.dg/nextafter-2.c
> +++ b/gcc/testsuite/gcc.dg/nextafter-2.c
> @@ -6,6 +6,18 @@
>
> #include <stdlib.h>
>
> +/* In order to run on systems like the PowerPC that have 3 different long
> + double types, include math.h so it can choose what is the appropriate
> + nextafterl function to use.
> +
> + If we didn't use -fno-builtin for this test, the PowerPC compiler would have
> + changed the names of the built-in functions that use long double. The
> + nextafter-1.c function runs with this mapping.
> +
> + Since this test uses -fno-builtin, include math.h, so that math.h can make
> + the appropriate choice to use. */
> +#include <math.h>
So if you use -fno-builtin (or just for some functions), and you don't
include <math.h>, things just break? Nasty.
Of course such things aren't proper C (you *have to* include <math.h>
if you use functions from there), but how often will code like this
happen in practice :-/
The patch is okay for trunk. Thanks!
Segher
More information about the Gcc-patches
mailing list