ivmai/bdwgc — Issue #14: 7.2alpha6 fails to compile with clang
Author: apetresc
Created: 2012-02-27 20:30:21+00:00
State: open

Users of Homebrew have noticed the following problems when compiling with the default clang: [1](https://github.com/mxcl/homebrew/issues/10539#issuecomment-4202076) and [2](https://github.com/mxcl/homebrew/issues/10453).

The issue seems to be around the following macro:

```
libtool: compile: /usr/bin/clang -DHAVE_CONFIG_H -I./include -I./include -I./libatomic_ops/src -I./libatomic_ops/src -fexceptions -Os -w -pipe -march=native -Qunused-arguments -c os_dep.c -fno-common -DPIC -o .libs/os_dep.o
misc.c:943:7: error: array size is negative
GC_STATIC_ASSERT((ptr_t)(word)(-1) > (ptr_t)0);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./include/private/gc_priv.h:2143:51: note: expanded from macro 'GC_STATIC_ASSERT'
# define GC_STATIC_ASSERT(expr) (void)sizeof(char[(expr)? 1 : -1])
^~~~~~~~~~~~~~
1 error generated.
```

Nobody is quite sure what that macro is intended to be doing (whether it is a bug in clang or a bug in the macro which clang exposes), but in either case it seems like something we should report upstream.

It compiles cleanly with LLVM.