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.

C55 compiler v4.3.9 #pragma MUST_ITERATE 0-iteration test

Hello,

We observe the following behavior which seems to be incorrect for the C55 compiler version 4.3.9.  For a loop with an indeterminate count, the compiler does not remove the 0-iteration test in the following despite the presence of the MUST_ITERATE pragma which guarantees at least one iteration through the loop.

void doloop(int niters)

{

#pragma MUST_ITERATE(1,10,)

for (int i=0; i<niters; ++i) do something;

}

The resulting assembly code still shows a 0-iteration loop test.  However, the following code does not result in the 0-iteration test, which is the expected behavior.

void doloop(int niters)

{

int i = 0;

#pragma MUST_ITERATE(1,10,)

for (; i<niters; ++i) do something;

}

It appears that declaring the index variable in the for loop is somehow causing the 0-iteration information to be ignored.

Thanks for looking into this. 

  • I am able to reproduce this issue.  I submitted SDSCM00041834 in the SDOWP system.  Feel free to track it with the SDOWP link in my sig below.

    FWIW, the C5500 compiler manual does say, in the section on MUST_ITERATE, that no source statements may appear between the MUST_ITERATE and the loop.  Defining "int i" in the loop header line is an example of such a statement.  However, this is such a common idiom in C++ code that this issue clearly needs to be fixed.

    Thanks and regards,

    -George