orcc: workaround a bug in the gcc 4.2 provided by XCode 3.2.6
authorJosep Torra <n770galaxy@gmail.com>
Wed, 20 Feb 2013 14:32:49 +0000 (15:32 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Wed, 20 Feb 2013 14:32:49 +0000 (15:32 +0100)
commit6597e084d9b9524ab199fb3019fa307b6588fd88
tree4f98e6f228c5884ec7b59c0a50b1cf918f271f68
parente9430261015d8f059ff1359f89c137895e50c81e
orcc: workaround a bug in the gcc 4.2 provided by XCode 3.2.6

When building orc in OSX Snow Leopard with '-O2 -arch i386 -m32' a bug in
the compiler is triggered and wrong assembly is generated with
the following messages:

'non-relocatable subtraction expression, "LC0" minus "L00000000008$pb"'
'symbol: "L00000000008$pb" can't be undefined in a subtraction expression'
'undefined local symbol L00000000008$pb'

The issue is triggered when the compiler tries to optimize for a constant
value in the code but it does a bad job. Declaring 'volatile' the variable
that holds the constant prevents this optimization to be performed and the
orc C generated code can be properly built.
orc/orccompiler.c
orc/orcprogram-c.c
orc/orcvariable.h