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.

Taking address of a near variable



Hello,

I have some problems using the address of a near variable and doing some arithmetic with it.
Example:

near int Value;
unsigned int test()
{
    unsigned int addr = (unsigned int)&Value;
    addr += (1 << 28);
    return addr;
}

When using the ELF format for C66x I get an assembly warning:

[W0001]
         Value out of range; converted to 0
               MVK     .S1     $DPR_byte(Value)+268435456,A3 ; |175|

When using the COFF format for C64x I get no warning, but the linker hangs in a loop.

This problem only occurs with optimizations turn on. I get the same result with CG Tools v7.3.8 and v7.4.6.

Thanks,
Ralf

  • Thank you for bringing this to our attention.  This is some sort of bug in the compiler tools.  The compiler should never generate code which the assembler doesn't like.  I can reproduce the problem.  I filed SDSCM00049545 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

  • Hi George,

    thanks for your quick answer.
    I think that the volatile keyword can be used as a workaround in the meantime:

    unsigned int test()
    {
        volatile unsigned int addr = (unsigned int)&Value;
        addr += (1 << 28);
        return addr;
    }

    Ralf