Hi all,

I get this error with -O3 (= -O2 -finline-functions -frename-registers):

----------------------------
msp430-gcc -c -g -O2 -finline-functions -frename-registers -mmcu=msp430x1121 bug.c msp430-gcc -c -g -O2 -finline-functions -frename-registers -mmcu=msp430x1121 dco_speed.c
dco_speed.c: In function `dco_speed':
dco_speed.c:54: 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.
make: *** [dco_speed.o] Error 1
----------------------------

It works without -frename-registers.

Ciao, Paul



bug.c:
----------------------------
#include "dco_speed.h"

int main(void){
   dco_speed();
}
----------------------------



dco_speed.h:
----------------------------
#ifndef DCO_SPEED_H
#define DCO_SPEED_H

#include <io.h>
#include <iomacros.h>
#include <signal.h>

/**
* Determine MCLK freq
*/
unsigned long dco_speed();

#endif
----------------------------


dco_speed.c:
----------------------------
#include "dco_speed.h"


/**
* Determine the CPU clock frequency (MCLK). There has to be
* a 32768 Hz oscilator connected to the MSP430.
*/
unsigned long dco_speed(){

   //assume, there is a 32768 Hz low speed oscilator connected
   volatile unsigned int i=0;
   unsigned long ret=0;

   //set maximal DCO CPU speed
   DCOCTL = DCO0 +    DCO1 + DCO2;
   BCSCTL1    = DIVA_3 + RSEL2 + RSEL1 + RSEL0;
   BCSCTL2    = 0x00;

   while(++i);            //wait

   //timer    settings
   TACTL=TASSEL1+MC1+TACLR;    //clock    for TAR    is MCLK, upmode
   CCTL2=CCIS0+CM0+CAP;        //ACLK/8 input, capture mode, rising edge

   //measure
   while (!(CCTL2 & 1));        //wait until int occure
   CCTL2&=0xfffe;            //clear ie flag
   ret=CCR2;
   for (i=0;i<16;i++){
       while (!(CCTL2 & 1));    //wait until int occure
       CCTL2&=0xfffe;        //clear ie flag
       }
   return (CCR2-ret)*(32768/(8*16));    //exact MCLK freq
}
----------------------------

Makefile:
----------------------------
#OBJS=start.o uart.o dco_speed.o
OBJS=bug.o dco_speed.o

TARGET=bug.elf

CC=msp430-gcc
DELETER=del

#-O3 = -O2 -finline-functions -frename-registers
#following line cause compiler error!!
FLAGS=-g -O2 -finline-functions -frename-registers -mmcu=msp430x1121

#it works without -frename-registers
#FLAGS=-g -O2 -finline-functions -mmcu=msp430x1121

.c.o:
   $(CC) -c $(FLAGS) $<

all:    $(OBJS)
   $(CC) $(FLAGS) -o $(TARGET) $(OBJS)
clean:
   $(DELETER) *.o *.bak *.elf
----------------------------

<<attachment: bug.zip>>

Reply via email to