xcc internal unrecoverable error on struct initialise

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
data
Active Member
Posts: 43
Joined: Wed Apr 06, 2011 8:02 pm

xcc internal unrecoverable error on struct initialise

Post by data »

I have found a simple way to trigger an "internal unrecoverable error" message in xcc going back to at least 14.0.1. The code which triggers the error may be incorrect -- I can't seem to find a solid spec for XC 2.0 spec to check this against -- but I assume that the reaction of the compiler in this case is not correct.

A test project is in the attached zip, but the test case is very simple -- the error seems to be triggered by an empty struct initialiser inside of another struct initialiser:

Code: Select all

#include <platform.h>

typedef struct inner_t {
    unsigned char a;
    unsigned char b;
    unsigned short c;
    unsigned short d;
} inner_t;

typedef struct outer_t {
    inner_t inner;
} outer_t;

int main()
{
#if 1
    // The following causes the compiler internal error.
    outer_t x = { {} };
#else
    // The following does not cause the error ..
    outer_t x = { {0, 0, 0, 0} };

    // neither does the following ..
    //outer_t x = { {0} };

    // neither does the following.
    //outer_t x = {};
#endif

    return 0;
}
I have not investigated thoroughly enough to determine the precise circumstances which trigger the error, but at this point I'm satisfied to leave that to the compiler authors.

I hope this will be useful to someone!
You do not have the required permissions to view the files attached to this post.


henk
Respected Member
Posts: 347
Joined: Wed Jan 27, 2016 5:21 pm

Post by henk »

Thanks data

I've logged it and it will be dealt with in due course.

Cheers,
Henk