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.

Compiler/MSP432E411Y: ARM compiler in CCS: array initialize inside function generates strange assembly?

Part Number: MSP432E411Y

Tool/software: TI C/C++ Compiler

Dear Compiler Experts,

I have the following line of code inside a function:

uint8_t wr_buf[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

The corresponding disassembly is:

475           uint8_t wr_buf[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
          $C$L89:
0000037e:   4991                ldr        r1, [pc, #0x244]
00000380:   680A                ldr        r2, [r1]
00000382:   A802                add        r0, sp, #8
00000384:   6002                str        r2, [r0]
00000386:   6849                ldr        r1, [r1, #4]
00000388:   6041                str        r1, [r0, #4]

At the second ldr I get an exception 3.

What is wrong with the code? Why doesn't the compiler complain about?

When using the following code it works fine:

    uint8_t wr_buf[8];

    uint32_t idx;
    for (idx=0; idx<8; idx++) {
        wr_buf[idx] = 0xFF;
    }