yallop / ocaml-ctypes

Library for binding to C libraries using pure OCaml
MIT License
371 stars 95 forks source link

Incompatible pointer types error #784

Open jamesjer opened 2 months ago

jamesjer commented 2 months ago

Describe the bug

context When I compile ocaml-ctypes 0.23.0 with gcc 14.1.1 and run the tests, one test fails. GCC 14.x is stricter about incompatible pointer types than previous versions of GCC.

expectation I expect the tests to pass.

bug But instead the compiler throws an error:

generated_stubs.c: In function ‘cstubs_tests_2_new_chorse’:
generated_stubs.c:14:25: error: initialization of ‘struct animal *’ from incompatible pointer type ‘struct chorse *’ [-Wincompatible-pointer-types]
   14 |    struct animal* x10 = new_chorse(x7);
      |                         ^~~~~~~~~~

This code appears to have been generated from tests/test-oo_style/stubs/functions.ml, lines 84 and 85.

problem This is a problem for Linux distribution packagers, because we want to see package tests succeed.

Reproduce the bug

  1. Gain access to a machine with GCC 14.x; I am using Fedora Rawhide.
  2. Build ocaml-ctypes 0.23.0
  3. Run the tests

List your environment

The following Fedora packages are installed (not a complete list; devel packages are also installed in most cases):

yallop commented 2 months ago

Thank you for the report, @jamesjer. There's a fix for the test in #785. I can make a 0.23.1 release that includes the fix, if that'd be useful.

jamesjer commented 2 months ago

Thank you for the quick response! I'm okay with waiting until the next time you have a reason to make a release, actually. I can patch the test locally until then.