[Pixman] [PATCH] Workaround bug in llvm-gcc

Andrea Canciani ranma42 at gmail.com
Sat Aug 20 07:41:46 PDT 2011


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.

Fixes region-contains-test.
---
 pixman/pixman-region.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c
index 9ff5157..47beb52 100644
--- a/pixman/pixman-region.c
+++ b/pixman/pixman-region.c
@@ -102,7 +102,11 @@
 
 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
 
 static box_type_t *pixman_region_empty_box =
     (box_type_t *)&PREFIX (_empty_box_);
-- 
1.7.4.4



More information about the Pixman mailing list