S12 CW11 internal compiler error - report to cw_bug@freescale.com

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S12 CW11 internal compiler error - report to cw_bug@freescale.com

跳至解决方案
2,785 次查看
StefanoGattazzo
NXP Employee
NXP Employee

Hi Team,

see below what my customer wrote:

I get the following compiler error

 

..\BSW\KERNEL\MCAL_S12x\mcu\Mcu.c:211: internal compiler error (report to

..\BSW\KERNEL\MCAL_S12x\mcu\Mcu.c:211: <cw_bug@freescale.com>)

..\BSW\KERNEL\MCAL_S12x\mcu\Mcu.c:211: while executing in file 'Coloring.c'

..\BSW\KERNEL\MCAL_S12x\mcu\Mcu.c:211: line: 698

..\BSW\KERNEL\MCAL_S12x\mcu\Mcu.c:211: (compiling 'Mcu_InitClock' in 'Mcu.c')

 

Trying to compile the attached function (mcu.c) for the S12 target.

I’m using the following compiler version (mwccs12lisa):

 

CodeWarrior C/C++ for S12/L-ISA.

Copyright (c) 2017, Freescale Semiconductor, Inc

All rights reserved.

Version 5.0.44 (build 17292)

Runtime Built: Oct 20 2017 21:44:00

 

Using the options in the attached file Compiler.opt.

 

Any indication from your side about the cause of the error, and a possible workaround or fix, would be very welcome.

This issue is quite urgent for our development.

Thanks and BR

标记 (2)
1 解答
2,482 次查看
kef2
Senior Contributor V

Hi Stefano

if you didn't workaround it, it seems compiler is having problem with these quite similar lines

    u8CpmuRefDivReg = ( u8RefFrq << 6 ) | ( u8RefDiv & 0x0FU );

    u8CpmuSynrReg = ( u8VcoFrq << 6U ) | ( u8SynDiv & 0x3FU );

Splitting them into simpler expressions makes compiler happy:

    u8CpmuRefDivReg = ( u8RefFrq << 6 );

   u8CpmuRefDivReg |= ( u8RefDiv & 0x0FU );

u8CpmuSynrReg = ( u8VcoFrq << 6U );

u8CpmuSynrReg |= ( u8SynDiv & 0x3FU );

Edward

在原帖中查看解决方案

6 回复数
2,482 次查看
mikedoidge
NXP Employee
NXP Employee

Hello StefanoGattazzo‌,

Checked with our compiler experts, this is their assessment:

>>>

There's an error your program, which by definition of the C language standard, would cause undefined behavior of the compiler. Typically, undefined behavior would mean undefined at runtime, but the compiler protected the user against unpredictable runtime behavior by just exiting with an internal error.

Std_ReturnType Mcu_InitClock( void )
{
uint16 u16FRef, u16FVco;
uint8 u8SynDiv, u8RefFrq, u8VcoFrq, u8RefDiv;
uint8 u8Tmp, u8CpmuRefDivReg, u8CpmuSynrReg;
boolean bFound;

Mcu_InitClock is declared and defined with return type Std_ReturnType.
The function does not return a value:

CPMUHTCTL = 0x00U;

CPMUVREGCTL = 0x01U;
// #endif
}

This is an error in the program.

<<<

Best Regards,

Mike

0 项奖励
回复
2,482 次查看
kef2
Senior Contributor V

Hi,

Wow. I believe decent compilers just emit warning or error message clearly stating that return statement is missing.

BTW error message clearly stated ir is an internal compiler error and asks to report about it to specified email address.

Edward

0 项奖励
回复
2,482 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Stefano Gattazzo,

Could you please tell me the chip number , also share a project that I can reproduce the error on my side,

then if it is really a bug , I will report it to CW development team.


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复
2,482 次查看
StefanoGattazzo
NXP Employee
NXP Employee
  1. The device is MC9S12VML12SVBLIN (mounted on evaluation board).

Attached a bareboard project.

BR
Stefano

0 项奖励
回复
2,483 次查看
kef2
Senior Contributor V

Hi Stefano

if you didn't workaround it, it seems compiler is having problem with these quite similar lines

    u8CpmuRefDivReg = ( u8RefFrq << 6 ) | ( u8RefDiv & 0x0FU );

    u8CpmuSynrReg = ( u8VcoFrq << 6U ) | ( u8SynDiv & 0x3FU );

Splitting them into simpler expressions makes compiler happy:

    u8CpmuRefDivReg = ( u8RefFrq << 6 );

   u8CpmuRefDivReg |= ( u8RefDiv & 0x0FU );

u8CpmuSynrReg = ( u8VcoFrq << 6U );

u8CpmuSynrReg |= ( u8SynDiv & 0x3FU );

Edward

2,328 次查看
raja1999
Contributor II

Hello,

How did you find error? Any hint from compiler?

Basically I am getting error on ending line of a function (at closing curly brace).

Here's my error:

<fileName>.c|1677|0|1|91472|1)
=}
>internal compiler error (report to <cw_bug@freescale.com>)
>while executing in file 'ExpandIR.c' line: 7135
>(compiling '<functionName>' in '<fileName>.c')

Errors caused tool to abort.
NMAKE : fatal error U1077: '"C:\Freescale\CW MCU v11.1\MCU\S12lisa_Tools\Build_Tools\mwccs12lisa.exe"'
: return code '0x1'
Stop.
NMAKE : fatal error U1077: 'C:\apps\Nmake\nmake.EXE' : return code '0x2'
Stop.

 

Usually compiler lay out their concerns for our code. But this one just tells line no.! Installed it today.

Edit: I emptied out function, the error vanished.

Also, I changed compiler optimization level from 2 to 0, it worked. No error. Any opt level except 0 generates error.

P.S: I am using evaluation version of compiler (awaiting license from customer). Is this error because of any free eval limit?

0 项奖励
回复