spuxlc bug: __UnsupportedConditional…

I’m only posting this here because searching for “__UnsupportedConditionalExpressionDestruction” on the internets returns no useful hits…

There appears to be a bug in the December 2006 spuxlc (the compiler that comes with Cell SDK 2.0) where it fails to link certain segments of code that have been compiled with optimizations on (-O2, -O3, etc). I’ve got a fair amount of code that I’ve copied into SPULand that wouldn’t link and it was a little frustrating not finding any hits on Google..

RT.o:(.data+0x7dc): undefined reference to `__UnsupportedConditionalExpressionDestruction(void*, long)’

Here’s the problem line of code:

if(i != ignoreobject && _objects[i]->Hit(ro, rd, hitdata))
{

The fix?

if(i != ignoreobject)
if(_objects[i]->Hit(ro, rd, hitdata))
{

Lovely. I wonder if there’s some magic-fu where it tries to optimize SPU branches that’s tripping it up.