ImageMagick and clang 3.5.0

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Posts: 11
Joined: 2014-03-04T13:43:03-07:00
Authentication code: 6789

ImageMagick and clang 3.5.0

Post by kwm »


FreeBSD is currently moving to making clang 3.5.0 our default compiler. Which exposed three problems in the IM code (based on IM 6.9.0-0) [1].

The first problem is that IM assumes clang supports __alloc_size__() [2], which it does not. It does support __hot__ and __cold__. So the patch [3] fixes both these issues.

In file included from dcraw-m.c:53:
In file included from /usr/local/include/ImageMagick-6/wand/MagickWand.h:72:
In file included from /usr/local/include/ImageMagick-6/magick/MagickCore.h:120:
/usr/local/include/ImageMagick-6/magick/memory_.h:29:36: error: unknown attribute '__alloc_size__' ignored [-Werror,-Wunknown-attributes]
*(*AcquireMemoryHandler)(size_t) magick_alloc_size(1),
/usr/local/include/ImageMagick-6/magick/method-attribute.h:127:48: note: expanded from macro 'magick_alloc_size'
# define magick_alloc_size(x) __attribute__((__alloc_size__(x)))

The third problem is that IM uses fabs() sloppy. The bug report [1] mentions a hack that we can use as a temporaly patch for the FreeBSD port. Perhaps this can be a fixed in a beter way in the IM code by using a magick_fabs() function that calls fabs(), fabsl() or fabsf() depending on the content of MAGICKCORE_SIZEOF_FLOAT_T or MAGICKCORE_SIZEOF_DOUBLE_T? Not sure about how this should be fixed.

In file included from coders/tga.c:47:
./magick/color-private.h:44:8: warning: absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value [-Wabsolute-value]
if ((fabs(red-q->red) < MagickEpsilon) &&
./magick/color-private.h:44:8: note: use function 'fabsl' instead
if ((fabs(red-q->red) < MagickEpsilon) &&



[1] Downstream bug: ... ?id=196135
User avatar
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ImageMagick and clang 3.5.0

Post by magick »

Thanks for the alerts and patches. Look for them in ImageMagick 6.9.0-1 Beta by sometime tomorrow.
Post Reply