Skip to content

Commit

Permalink
swig/Multiroots.i: fix build failure with gcc 14.
Browse files Browse the repository at this point in the history
As identified in [Debian bug #1075182], Math::GSL fails to build with
gcc 14 with the following kind of symptoms due to a number of warnings
in the C compiler now gone fatal by default:

	xs/Multiroots_wrap.2.8.c:2950:12:
	error: assignment to ‘gsl_multiroot_function *’
	       {aka ‘struct gsl_multiroot_function_struct *’}
	       from incompatible pointer type ‘gsl_multiroot_function **’
	       {aka ‘struct gsl_multiroot_function_struct **’}
	       [-Wincompatible-pointer-types]
	 2950 |       arg1 = &f;
	      |            ^

This change fixes/workarounds the issue by casting the &f pointer to
the expected type.  Other approaches trying to fix the native type of
f straight away result in a segmentation faults while running tests,
and any other approaches were anything but obvious due to entanglement
with swig, but maybe there is something more appropriate than casting.

[Debian bug #1075182]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1075182

Signed-off-by: Étienne Mollier <[email protected]>
  • Loading branch information
emollier committed Jul 25, 2024
1 parent 8181fa9 commit 7384c7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion swig/Multiroots.i
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
%typemap(in) gsl_multiroot_function * {
gsl_multiroot_function *f;
/* stub */
$1 = &f;
$1 = (gsl_multiroot_function *)&f;
}

%{
Expand Down

0 comments on commit 7384c7f

Please sign in to comment.