Fix gexpr.c due to gcc 15 incompatible pointer type warnings
Stefan Liebler
stli at linux.ibm.com
Tue Jun 24 10:04:28 CEST 2025
Hi,
According to
https://my.eng.utah.edu/~pajensen/ACM/Documentation/gmplib.org/gmpbench.html
To run the benchmarks, you also need to compile gexpr.c and put it
somewhere in your path.
I've downloaded https://gmplib.org/gexpr.c and got those warnings with
gcc 15:
gexpr.c:130:12: error: initialization of ‘double (*)(void)’ from
incompatible pointer type ‘double (*)(double)’
[-Wincompatible-pointer-types]
130 | {"log2", my_log2},
| ^~~~~~~
gexpr.c:130:12: note: (near initialization for ‘fns[0].evalfn’)
gexpr.c:123:1: note: ‘my_log2’ declared here
123 | my_log2 (double x)
| ^~~~~~~
gexpr.c:131:13: error: initialization of ‘double (*)(void)’ from
incompatible pointer type ‘double (*)(double)’
[-Wincompatible-pointer-types]
131 | {"log10", log10},
| ^~~~~
...
SNIP: multiple more for all functions in fns-array.
Simply adjusting the function prototype silences those warnings:
--- gexpr_orig.c 2025-06-24 09:40:21.747880242 +0200
+++ gexpr.c 2025-06-24 09:31:13.507903946 +0200
@@ -116,7 +116,7 @@
struct functions
{
char *spelling;
- double (* evalfn) ();
+ double (* evalfn) (double);
};
double
Can you please adjust https://gmplib.org/gexpr.c?
Bye,
Stefan Liebler
More information about the gmp-devel
mailing list