EmbeddedRelated.com
Forums

IAR compiler crashes on optimization

Started by Dirk Reymann March 25, 2004
Hallo everybody!

I just had first look at the C compiler from IAR
included with the FET-tool.

Unfortunately it took only 5 Minutes to make this thing
stuff up.  The behaviour is somewhat strange, so I hope
anybody here knows something about it.

- latest Kickstart version from TI's website
- blinking LED sample file - C language
- everything works fine.

But:
When I turn on optimization for size on *medium* or *high* level.
The compiler seems not to like the "P1OUT ^= 0x01;" statement.
In this case the compiler process takes all CPU time and hangs.

It's getting more strange...
P1OUT ^= 1;                 // hangs
P1OUT &= 1;                 // works fine
P1OUT |= 1;                 // works fine
P1OUT = P1OUT + 1;          // hangs


Now I'm confused.   :-)

Has anybody heard of this bug or has any idea for a workaround?



Dirk








Beginning Microcontrollers with the MSP430

--- In msp430@msp4..., Dirk Reymann <d.reymann@w...> wrote:
 > I just had first look at the C compiler from IAR
> included with the FET-tool.
> [SNIP]
> Has anybody heard of this bug or has any idea for a workaround?

The full version's CD-ROM has a patch that IIRC addresses a compiler
crash that occurs when certain optimizations are used.

In the IAR installer, look towards the bottom of the splash screen
(above Exit) and see if the KickStart version doesn't also have this
patch.

--Andrew


Dirk Reymann wrote:

> I just had first look at the C compiler from IAR
> included with the FET-tool.
>
> Unfortunately it took only 5 Minutes to make this thing
> stuff up.  The behaviour is somewhat strange, so I hope
> anybody here knows something about it.
>
> - latest Kickstart version from TI's website
> - blinking LED sample file - C language
> - everything works fine.
>
> But:
> When I turn on optimization for size on *medium* or *high* level.
> The compiler seems not to like the "P1OUT ^= 0x01;" statement.
> In this case the compiler process takes all CPU time and hangs.
>
> It's getting more strange...
> P1OUT ^= 1;                 // hangs
> P1OUT &= 1;                 // works fine
> P1OUT |= 1;                 // works fine
> P1OUT = P1OUT + 1;          // hangs
>
>
> Now I'm confused.   :-)
>
> Has anybody heard of this bug or has any idea for a workaround?

Yes, to both your questions ;-)

This is a known bug in that particular release.  On the page below you
will find information on it as well as a patch.

  http://www.iar.com/Support?noteW397

    -- Anders Lindgren, IAR Systems
-- 
Disclaimer: Opinions expressed in this posting are strictly my own and
not necessarily those of my employer.