303RE: [TMS470_ARM] No assembly code generated
- Jan 30, 2014
The first thing I thought of too was using a volatile data type (which you should be doing even if it is not actually THE problem). However, that would not prevent the generation of code, it would have just made it not work correctly since the inner while loop could be running off of a cached data value and never see the flag change in the register field it should be referencing.
The only reason beyond there being a bug in the compiler is if the compiler assumes it can optimize the code away. This is only done if the compiler, using more information than is available in your code snippet, can determine a priori that the outer while loop will be a constant false value or the operation to be performed inside the loop is effectively a no-op.
Since insufficient information is provided with the data types and values represented by the constants, any more support than that is impossible without merely providing guesses and assumptions.
Follow the data types and constant values back to their definitions and attempt to determine if they are values that will never be true in the while condition or if the operation to be performed accomplishes nothing and can be removed due to an invalid value or something similar.
Tried and got the same results, no assembly code was generated for the do...while loop. Thanks again.
- << Previous post in topic Next post in topic >>