-O2 issue on powerpc-eabivle-gcc : Assembler : Illegal immediate value

cancel
Showing results for 
Search instead for 
Did you mean: 

-O2 issue on powerpc-eabivle-gcc : Assembler : Illegal immediate value

459 Views
wan35fr
Contributor III

Dear all ,

 

There is an issue if we use -O2 issue

 

uint8_t illegal_value_test(uint16_t arg0) {

    if (arg0 <= 0x7FF)

        return 1;

    else

        return 0;

}

 

The assembler generated is not correct (main.s)

illegal_value_test:

.LFB0:

  .file 1 "../src/main.c"

  .loc 1 10 0

  .cfi_startproc

.LVL0:

  .loc 1 16 0

  e_subfic %r3,%r3,2047

  e_li %r3,0

  adde %r3,%r3,%r3

 

src/main.s: Assembler messages:

src/main.s:16: Error: illegal immediate value

make: *** [src/main.o] Error 1

 

   Best Regards

 

                      Erwan

Labels (2)
0 Kudos
1 Reply

114 Views
stanish
NXP Employee
NXP Employee

Hello Erwan,

Thanks for this report. This is a known issue:

[ENGR00379772] Compiler may generate the instruction e subfic with invalid immediate value when an optimization is enabled.

The only workaround is to disable optimizations.

Anyway, the fix will be released in the next coming build tools update.

I'll check with the product team the exact update release date.

Regards,

Stan

0 Kudos