-Onca: Disable any Constant Folding

Group

OPTIMIZATIONS

Scope

Function

Syntax
  -Onca
  
  
Arguments

None

Default

None

Defines

None

Pragmas

None

Description

This option prevents the Compiler from folding constants over statement boundaries. All arithmetical operations are coded. This option must be set when using the library functions setjmp() and longjmp(), or the Compiler makes wrong assumptions (refer the following listing).

Listing: Example with If Condition Always True


void main(void) {
  jmp_buf env;

  int k = 0;

  if (setjmp(env) == 0) {

    k = 1;

    longjmp(env, 0);

    Err(1);

  } else if (k != 1) {/* assumed always TRUE */

    Err(0);

  }

}
Example
  -Onca