[Gc] [bdwgc] 7.2alpha6 fails to compile with clang (#14)

Hans Aberg haberg-1 at telia.com
Wed Sep 26 15:03:12 PDT 2012


On 1 Mar 2012, at 18:41, Hans Aberg wrote:

> On 1 Mar 2012, at 10:45, Ivan Maidanski wrote:
> 
>> I've changed all pointer relational comparisons (except for !=) to word ones (in "master" branch) and removed that check - I'll commit the patch next week.
>> For the "release" branch, I'll add a workaround to just skip that assertion for clang-x64.
> 
> I filed a bug-report to Apple.

Apple has now fixed this problem for all 'clang' compilers that come with Xcode 4.5.

Specifically, the program below, both when using 'xcrun' (later compiler on Mac OS 10.7), and using 32- and 64-bit modes, now produces the output
   1, 1
Before, in Xcode 4.3, /usr/bin/clang (i.e., 64-bit mode) produced the output
 -1, 1

Hans


----
#include <stdio.h>

typedef unsigned long word;
typedef char* ptr_t;

int main() {
#if 1
  /* Line that produces error in clang 64-bit mode. */
  (void)sizeof(char[((ptr_t)(word)(-1) > (ptr_t)0)? 1 : -1]);
#endif
  
  int k = ((ptr_t)(word)(-1) > (ptr_t)0)? 1 : -1;
  int l = ((ptr_t)(word)(-1) > (ptr_t)0);
  
  printf("%d, %d\n", k, l);
  return 0;
}
----




More information about the Gc mailing list