Hello,

I have often a compiler internal error "Segmentation fault", specially when
my code contains loops (while, do while, for).

It seems to me that the compiler option -Wunreachable-code causes the error,
idenpendently of the option -O (I tried -O0 to -O3 and -Os, with indentical
result).

I don't know if it is a fault in my code (see below) or in the compiler.

Does anyone know where is the problem ?

Thank you.

Jean-Marc Michel


Detail
------
I use mspgcc-win32, version 20041112 (windows 2000 SP4).


Without option -Wunrechable-code
--------------------------------
Command line :
    msp430-gcc -c -mmcu=msp430x149 -Os -g2 project.c
Result :
    always ok.


With option -Wunrechable-code
-----------------------------
Command line :
    msp430-gcc -c -mmcu=msp430x149 -Os -Wunreachable-code -g2 project.c
Result :
    project.c: In function `fb':
    project.c:20: internal error: Segmentation fault
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <URL:http://gcc.gnu.org/bugs.html> for instructions.


project.c
---------
#include <io.h>

int fa(void);
void fb(void);

int fa(void)
{
    return TAR;
}

void fb(void)
{
    int i;

    do
    {
        i = fa();
    }
    while (i < 10000);
}   // line 20

int main(void)
{
    for(;;)
    {
        fb();
    }
}


Jean-Marc Michel


Reply via email to