EmbeddedRelated.com
Forums

mspgcc internal compiler error

Started by ali_tlisov October 28, 2005
Hi

I got this during compilation with mspgcc. 
##################
service.c:256: Internal compiler error in verify_local_live_at_start,
at flow.c:586 
##################
Don't anybody know what may cause this error?

this code line make compiler crazy:
return ((65536 * (Conf.nUdmax - Conf.nUdmin)) / 10000 );

in the another place similar code:
nUs_charact = (65536*(nUs_target - Conf.nUdmin))/Conf.ScaleSTarget;
causes the same compiler behaviour.

By the way, this code compiles and works fine in the IAR.


Thanks!
Ali






Beginning Microcontrollers with the MSP430

>From: ali_tlisov <ali@ali@...>
>Subject: [msp430] mspgcc internal compiler error

>I got this during compilation with mspgcc. 
>##################
>service.c:256: Internal compiler error in verify_local_live_at_start,
>at flow.c:586 
>##################
>Don't anybody know what may cause this error?
>
>this code line make compiler crazy:
>return ((65536 * (Conf.nUdmax - Conf.nUdmin)) / 10000 );

I do't know the compiler, so I don't *know* the answer - but I'll
make a guess...

I would bet the compiler wants to work with this as integers... but 65536 is
0x10000 - i.e. larger than an integer word. So my bet is that the compiler
can't handle this well...

I would suggest trying to do some of the scaling yourself, as in:

(32768 * (Conf.nUdmax - Conf.nUdmin)) / 5000 )

or

(16384 * (Conf.nUdmax - Conf.nUdmin)) / 2500 )

or even

(8192 * (Conf.nUdmax - Conf.nUdmin)) / 1250 ).

It would be my quick thought for something to try... I would be
'worried' about the subtraction getting so big that the multiplication
would again overflow an integer operation... 

don't know the compiler, but maybe casting the difference as a long might
cause the calculations to be done in 32 bits. 

Remember that with an MSP430 you have 16-bit registers... going beyond that can
make things a bit ugly and, depending on how it is handled, could really add a
lot of overhead!

Good luck, and let us know how this turns out!

Rachel Adamec
Norristown, PA, USA


Rachel, while I haven't looked at GCC since the earliest 80's, I
am almost 
certain that the bug per se has nothing to do with what you wrote. It may 
bypass the bug, but given the error message, sounds like it's just one of 
those internal consistency checking thing that GCC is doing, and it finds 
itself in a state that it doesn't expect.

"..local_live..." probably refers to Liveness Analysis, a type of
analysis 
typically done by a compiler.

At 09:44 AM 10/31/2005, Rachel Adamec wrote:

> >From: ali_tlisov <ali@ali@...>
> >Subject: [msp430] mspgcc internal compiler error
>
> >I got this during compilation with mspgcc.
> >##################
> >service.c:256: Internal compiler error in verify_local_live_at_start,
> >at flow.c:586
> >##################
> >Don't anybody know what may cause this error?
> >
> >this code line make compiler crazy:
> >return ((65536 * (Conf.nUdmax - Conf.nUdmin)) / 10000 );
>
>I do't know the compiler, so I don't *know* the answer - but
I'll make a 
>guess...
>

// richard (This email is for mailing lists. To reach me directly, please 
use richard at imagecraft.com) 


Your source file is simply too large. Split it into some smaller ones and
your
code is working again.

M.

On Mon, Oct 31, 2005 at 01:30:54PM -0800, Richard
wrote:
> Rachel, while I haven't looked at GCC since the earliest 80's, I
am almost 
> certain that the bug per se has nothing to do with what you wrote. It may 
> bypass the bug, but given the error message, sounds like it's just one
of 
> those internal consistency checking thing that GCC is doing, and it finds 
> itself in a state that it doesn't expect.
> 
> "..local_live..." probably refers to Liveness Analysis, a type of
analysis 
> typically done by a compiler.
> 
> At 09:44 AM 10/31/2005, Rachel Adamec wrote:
> 
> > >From: ali_tlisov <ali@ali@...>
> > >Subject: [msp430] mspgcc internal compiler error
> >
> > >I got this during compilation with mspgcc.
> > >##################
> > >service.c:256: Internal compiler error in
verify_local_live_at_start,
> > >at flow.c:586
> > >##################
> > >Don't anybody know what may cause this error?
> > >
> > >this code line make compiler crazy:
> > >return ((65536 * (Conf.nUdmax - Conf.nUdmin)) / 10000 );
> >
> >I do't know the compiler, so I don't *know* the answer - but
I'll make a 
> >guess...
> >
> 
> // richard (This email is for mailing lists. To reach me directly, please 
> use richard at imagecraft.com) 
> 
> 
> 
> 
> .
> 
>  
> Yahoo! Groups Links
> 
> 
> 
>  
> 
> 
> 
        Matthias

The size of file has no matter. Cause of error is optimization level.

Look at this main.c file:

long x;
int max = 4000;
int min = 300;

int main (void) {
	x = (65536 * (max - min)) / 10000;
	return 0;
}

Let's compile it:

msp430-gcc -mmcu=msp430x149 -O3 main.c

And you will see an error: 

main.c: In function `main':
main.c:7: Internal compiler error in verify_local_live_at_start, at
flow.c:586
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

If I set optimization level to O2, there is no error during compilation.
I'm using mspgcc installed from file mspgcc-20051026.exe and running
on windows 2000 sp4.


--- In msp430@msp4..., Matthias Weingart <msp430@p...> wrote:
>
> Your source file is simply too large. Split it into some smaller
ones and your
> code is working again.
> 
> M.







Hi Richard,

Richard wrote:
> Rachel, while I haven't looked at GCC since the earliest 80's,

Yeah, right!

 From http://gcc.gnu.org/releases.html
0.9 (first beta release) March 22, 1987

Sure time flies ;)

Indrek

-- 
Indrek Rebane
Borthwick-Pignon OÜ, R&D
Riia 185, 51014 Tartu, Estonia
Phone: +372 7 302 641, Fax: +372 7 383 041


It's true. I remember trying to argue with Richard Stallman why there
is a 
market for low cost compilers and he was trying to argue that I should 
contribute to his GCC effort :-)... and I know Stallman before he has a 
beard...

At 02:31 AM 11/1/2005, Indrek Rebane wrote:

>Hi Richard,
>
>Richard wrote:
> > Rachel, while I haven't looked at GCC since the earliest
80's,
>
>Yeah, right!
>
>  From http://gcc.gnu.org/releases.html
>0.9 (first beta release) March 22, 1987
>
>Sure time flies ;)
>

// richard (This email is for mailing lists. To reach me directly, please 
use richard at imagecraft.com) 


Great, I remember I had a problem with longs too. Post the bug in the
mspgcc mailinglist (I used <<16 as workaround).

M.

On Tue, Nov 01, 2005 at 06:45:14AM -0000, Ali Tlisov
wrote:
> The size of file has no matter. Cause of error is optimization level.
> 
> Look at this main.c file:
> 
> long x;
> int max = 4000;
> int min = 300;
> 
> int main (void) {
> 	x = (65536 * (max - min)) / 10000;
> 	return 0;
> }
> 
> Let's compile it:
> 
> msp430-gcc -mmcu=msp430x149 -O3 main.c
> 
> And you will see an error: 
> 
> main.c: In function `main':
> main.c:7: Internal compiler error in verify_local_live_at_start, at
> flow.c:586
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
> 
> If I set optimization level to O2, there is no error during compilation.
> I'm using mspgcc installed from file mspgcc-20051026.exe and running
> on windows 2000 sp4.
> 
> 
> --- In msp430@msp4..., Matthias Weingart <msp430@p...> wrote:
> >
> > Your source file is simply too large. Split it into some smaller
> ones and your
> > code is working again.
> > 
> > M.
> 
> 

If int is 16 bit, x will be undefined and probably
zero due to the overflow. You need to force a long
multiply, probably by multiplying by a long constant:

	x = (65536L * (max - min)) / 10000;

Or you could cast the subtraction as long:

	x = (65536 * (long)(max - min)) / 10000;

The compiler shouldn't use a real multiply,
of course. It shouldn't fail, either :-).

Clifford Heath.