This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I'm encountering some problem compiling, with optimizations, a code which uses the intrinsic "__byte((int*)foo, CONST)".
The problem is present from the version 6.1.6 to the version 6.2.5 of the C2000 compiler (not tried the versions from 6.1.1 to 6.1.5).
On a new project for F2837xD I get "INTERNAL ERROR: Illegal use of intrinsic: __byte"
In an old project for C28346 I get "INTERNAL ERROR: no match for MCALL".
It seems related to the use of __byte() passing a constant as byte_index parameter; using a variable (in a for() loop for example) it works as it should do.
Someone encountered the same problem? Is there a solution?
Thank you. BR,
Gianluca
I am unable to reproduce this diagnostic. Please submit a test case, probably preprocessed like this, which I can compile to see those diagnostics. Please include the exact compiler options used.
Thanks and regards,
-George
George,
after a "bit" of work I obtained a really small code which reproduces the behavior of the complex project I started from.
I have attached the CCS 5 project. Changing just a bit in the Main.c file, will force the optimizer to work differently and the compiling output changes.
Please let me know if you can run it and if it is possible to see the error.
Thank you very much and BR,
Gianluca
Thank you for submitting a test case. I can reproduce the error with
>> main.c, line 12: INTERNAL ERROR: Illegal use of intrinsic: __byte
I filed SDSCM00049942 in the SDOWP system to have this investigated. Feel free to follow it with the SDOWP link below in my signature.
Thanks and regards,
-George
The compiler should not fail like that no matter what the input. That's why I filed the entry in SDOWP.
But your code doesn't look right. You write ...
uint16 buff_ptr = 0; if (__byte((int *)(buff_ptr), 1) != 0)
Casting a unsigned int variable to a pointer type doesn't make sense. The first operand to __byte should not be a ordinary scalar like that, but an address. You probably mean to write ...
uint16 buff_ptr = 0; if (__byte((int *)(&buff_ptr), 1) != 0)
Notice the addition of "&".
Thanks and regards,
-George
In the original code that was a "uint32" and is a scalar that has to be intended as a pointer (without the &). It simply comes from a network stream and some fields are addresses, others are real scalars. It is not "pure" but it works very well with older compilers or without optimizations.
The code I posted is just a very hard work to reduce the original code maintaining its behavior; I did not look at the style.
BR,
Gianluca