[Pixman] [PATCH] Workaround bug in llvm-gcc
Soeren Sandmann
sandmann at cs.au.dk
Mon Aug 22 06:24:02 PDT 2011
Andrea Canciani <ranma42 at gmail.com> writes:
> llvm-gcc (shipped in Apple XCode 4.1.1 as the default compiler or in
> the 2.9 release of LLVM) performs an invalid optimization which
> unifies the empty_region and the bad_region structures because they
> have the same content.
>
> A bug has been filed against Apple Developers Tool for this
> issue. This commit works around this bug by making one of the two
> structures volatile, so that it cannot be merged.
Is the bug report publicly readable?
> static const box_type_t PREFIX (_empty_box_) = { 0, 0, 0, 0 };
> static const region_data_type_t PREFIX (_empty_data_) = { 0, 0 };
> +#if defined (__llvm__) && !defined (__clang__)
> +static const volatile region_data_type_t PREFIX (_broken_data_) = { 0, 0 };
> +#else
> static const region_data_type_t PREFIX (_broken_data_) = { 0, 0 };
> +#endif
It worries me a little that these #ifdefs will still trigger when Apple
fix their compiler. Can we detect it at configure time instead by
running something like this:
typedef struct { int x, y; } blah_t;
static const blah_t b1 = { 0, 0 };
static const blah_t b2 = { 0, 0 };
int
main ()
{
if (&b1 == &b2)
return 1;
else
return 0;
}
Soren
More information about the Pixman
mailing list