Skip to content

Fix incompatible pointer types (32-bit) - and fix for PHP 8.5#59

Open
remicollet wants to merge 2 commits intovitoc:masterfrom
remicollet:issue-pointers
Open

Fix incompatible pointer types (32-bit) - and fix for PHP 8.5#59
remicollet wants to merge 2 commits intovitoc:masterfrom
remicollet:issue-pointers

Conversation

@remicollet
Copy link
Copy Markdown
Contributor

Raised as error with GCC 14 on Fedora 40

See https://kojipkgs.fedoraproject.org//work/tasks/9956/112369956/build.log

/builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/gmagickdraw_methods.c: In function 'php_gmagick_check_font':
/builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/gmagickdraw_methods.c:1415:39: error: passing argument 2 of 'MagickQueryFonts' from incompatible pointer type [-Wincompatible-pointer-types]
 1415 |         fonts = MagickQueryFonts("*", &num_fonts);
      |                                       ^~~~~~~~~~
      |                                       |
      |                                       size_t * {aka unsigned int *}
In file included from /usr/include/GraphicsMagick/wand/wand_api.h:41,
                 from /builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/php_gmagick.h:42,
                 from /builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/gmagickdraw_methods.c:20:
/usr/include/GraphicsMagick/wand/magick_wand.h:64:35: note: expected 'long unsigned int *' but argument is of type 'size_t *' {aka 'unsigned int *'}
   64 |   **MagickQueryFonts(const char *,unsigned long *),
      |                                   ^~~~~~~~~~~~~~~
make: *** [Makefile:219: gmagickdraw_methods.lo] Error 1
make: *** Waiting for unfinished jobs....
/builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/gmagick_methods.c: In function 'zim_Gmagick_getimagechannelextrema':
/builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/gmagick_methods.c:4988:82: error: passing argument 3 of 'MagickGetImageChannelExtrema' from incompatible pointer type [-Wincompatible-pointer-types]
 4988 |         status = MagickGetImageChannelExtrema(intern->magick_wand, channel_type, &minima, &maxima);
      |                                                                                  ^~~~~~~
      |                                                                                  |
      |                                                                                  size_t * {aka unsigned int *}
In file included from /usr/include/GraphicsMagick/wand/wand_api.h:41,
                 from /builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/php_gmagick.h:42,
                 from /builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/gmagick_methods.c:20:
/usr/include/GraphicsMagick/wand/magick_wand.h:201:63: note: expected 'long unsigned int *' but argument is of type 'size_t *' {aka 'unsigned int *'}
  201 |   MagickGetImageChannelExtrema(MagickWand *,const ChannelType,unsigned long *,
      |                                                               ^~~~~~~~~~~~~~~
/builddir/build/BUILD/php-pecl-gmagick-2.0.6~RC1/gmagick-2.0.6RC1/gmagick_methods.c:4988:91: error: passing argument 4 of 'MagickGetImageChannelExtrema' from incompatible pointer type [-Wincompatible-pointer-types]
 4988 |         status = MagickGetImageChannelExtrema(intern->magick_wand, channel_type, &minima, &maxima);
      |                                                                                           ^~~~~~~
      |                                                                                           |
      |                                                                                           size_t * {aka unsigned int *}
/usr/include/GraphicsMagick/wand/magick_wand.h:202:5: note: expected 'long unsigned int *' but argument is of type 'size_t *' {aka 'unsigned int *'}
  202 |     unsigned long *),
      |     ^~~~~~~~~~~~~~~

@remicollet
Copy link
Copy Markdown
Contributor Author

Build with patch applied
https://koji.fedoraproject.org/koji/taskinfo?taskID=112599623

@cmb69
Copy link
Copy Markdown

cmb69 commented Oct 7, 2024

Also an issue on LLP64 (e.g. Windows x64) where long is 32 bit, but size_t is 64bit. Likely harmless on little-endian architectures, though, but serious for big-endian if the types have different sizes.

@remicollet
Copy link
Copy Markdown
Contributor Author

1 more commit for 8.5

@remicollet remicollet changed the title Fix incompatible pointer types (32-bit) Fix incompatible pointer types (32-bit) - PHP 8.5 Jul 17, 2025
@remicollet remicollet changed the title Fix incompatible pointer types (32-bit) - PHP 8.5 Fix incompatible pointer types (32-bit) - and fix for PHP 8.5 Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants