#338 internal compiler error at final_scan_insn, final.c:2623

LTS/20120406
open
gcc (183)
7
2012-11-05
2012-11-05
E.W.
No

This error only occurs when optimization is enabled.
It occurs via macports and on CentOS 6 using a self-compiled and patched msp430-gcc using the following guide:
https://sourceforge.net/apps/mediawiki/mspgcc/index.php?title=Install:fromsource

Most source file compile without error. Error occurs at the last closing curly bracket of the following c code:

msp430-gcc -I. -I/path/to/include -g -mmcu=MSP430F122 -Os -fpack-struct -fshort-enums -std=c99 -ffunction-sections -fdata-sections -funsigned-bitfields -funsigned-char -Wall -Wstrict-prototypes -c c_code/ecc_in_c/gf2m/gf2m_gen.c -o _out/ecc_in_c/gf2m/gf2m_gen.o
c_code/ecc_in_c/gf2m/gf2m_gen.c: In Funktion »gf2m_inverse_by_exponent«:
c_code/ecc_in_c/gf2m/gf2m_gen.c:192:1: interner Compiler-Fehler: in final_scan_insn, bei final.c:2623

void gf2m_inverse_by_exponent(bigint_t res, const bigint_t a, const bigint_t modulo) {
bigint_t temp, result;
int bit = 0;
int j,i = 1;
int exponent = bigint_get_msb(modulo); /* f(x) = 2^exp + other stuff , should be ECC_IN_BITS */

while((1 << bit) < exponent)
bit++;
bit -= 2;

/* make sure the lsb of the exponent is zero*/
exponent --;

bigint_copy(result, a);

while(bit >= 0) {
gf2m_square_var(temp, result, modulo);

for(j = 1; j < i; j++) {
gf2m_square_var(temp, temp, modulo);
}

gf2m_multiply_var(result, temp, result, modulo);
i *= 2;

if((exponent & (1 << bit)) > 0) {
gf2m_square_var(result, result, modulo);
gf2m_multiply_var(result, a, result, modulo);
i++;
}

bit--;
}

/* 2^(exp-1) - 1 --> 2^exp - 2 */
gf2m_square_var(res, result, modulo);
}

Discussion

  • E.W.
    E.W.
    2012-11-05

    msp430-gcc -Os -c -o tmp.o tmp.c

     
    Attachments
  • E.W.
    E.W.
    2012-11-05

    I appended a small sample c file so you can easily check the error for yourself. I compiled the file with

    msp430-gcc -Os -c -o tmp.o tmp.c

     
  • E.W.
    E.W.
    2012-11-05

    • priority: 5 --> 7
     
  • Peter A. Bigot
    Peter A. Bigot
    2012-11-05

    Confirmed present in both LTS-20120406 and in the 4.7 development series. I'll look into fixing this if/when another mspgcc release is scheduled.