Had a new one today using DC10.72...an error from the compiler said "Cannot load object, report to Rabbit"

Using 10.72…The error is a bit strange. I hit it when using some macros to do some runtime detection. The following test program compiles fine (target happens to be RCM6750):

#define MACRO1 (0)

main() {

int i,j;

i = 0;
j = 0;

if (i == 0 || (MACRO1 == 1 || j == 0)) {
	printf("All is well");
}

}

And this one causes the compiler error:

#define MACRO1 (0)

main() {

int i,j;

i = 0;
j = 0;

if (i == 0 || (MACRO1 == 1 && j == 0)) {
	printf("All is well");
}

}

The delta being the last && vs ||.

If I change MACRO1 to something that will evaluates as true, the error goes away. I tried optimization changes for size and speed to no avail. Different values for i and j also don’t matter. And, if the initial i == 0 isn’t present, the error doesn’t occur.

I can work around using different constructs, but this one seemed quite strange. Anybody ever see it?

1 Like

This one is strange, and it looks like an error in how the compiler short-circuits conditionals at compile-time.

The compiler should be able to reduce that code to “if (i == 0)”, but I believe it’s stumbling on what to do with the “j == 0”.

Thanks for pointing out the error – I’ll make sure it’s added as a “known issue” in the next Dynamic C release so we can investigate it if/when we work on the compiler again.