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
解決済! 解決策の投稿を見る。
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
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
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
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!
-----------------------------------------------------------------------------------------------------------------------
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
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?