This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Register allocation failed

Hi,

I am porting a project into CCS and am compiling with ARM 5.1.6.  I get the following error when building

INTERNAL ERROR: >>>Register allocation failed: handleRTDEventSettings


This may be a serious problem.  Please contact customer support with a
description of this problem and a sample of the source files that caused this
INTERNAL ERROR message to appear.

Cannot continue compilation - ABORTING!

I can't share my source...but can you give me an idea of what can cause this error to point me in the right direction to fix it?

 

Thanks,

David

  • This is a compiler bug.  There's likely nothing you can do to work around it. You could try adjusting the optimization level, or switching to version 5.1.7, but it's really hard to predict without a test case whether that will affect the problem.

  • The function handleRTDEventSettings is being compiled when the error occurs.  When register allocation fails, that usually means the compiler is trying to put lots of values (variables as well as intermediate results) in registers all at once.

    Perhaps the function is too long, or it contains some very long and complex expressions.  Is it auto-generated?  Try to simplify it. 

    Are you inlining lots of functions?  If so, disable it.

    An easy way to run lots of experiments with the --opt_level and --opt_for_speed options is to use the Optimizer Assistant.  I suspect some builds will fail, while others will succeed.  And there is a good chance one of those successful builds will work for you.  No one had this scenario in mind for Optimizer Assistant.  But I think it is worth a try.

    Thanks and regards,

    -George

  • Hi,

    Thanks for the info.

     

    Is it auto-generated?

    No.  I don't think it is long or uses complex expressions, but I pasted the function at the end of the post.

    Are you inlining lots of functions? 

    I know the project uses inlined functions, but I don't know how many, I will look into it.  I will also look into the optimization settings.

    EDIT - If I turn optimization off or level 0, it does not seem to get the error.  Anything level 1 or greater and the error is there.  I'll continue to investigate since I think we will need / want a higher optimization setting.

     

    Thanks for your help,

    David

     

    void handleRTDEventSettings (CmdFmt_Obj *pCmd, RspFmt_Obj *pRsp)
    {
    	if (pCmd->query == CMDMODE_COMMAND)
    	{
    		
    	}
    	else if (pCmd->query == CMDMODE_QUERY)
    	{
       		pRsp->num_parms = 6;
    		pRsp->params[PARAM1] = pCmd->params[PARAM1]; // test num
    		pRsp->params[PARAM2] = storeFloat(5.0); // update interval (s)
    		pRsp->params[PARAM3] = storeFloat(5.0); // sampling interval (s)
    		
    		switch (pCmd->params[PARAM1])
    		{
    			case TEST_NUM_33:
    			{
    				pRsp->params[PARAM4] = storeFloat(TOL_33);
    				pRsp->params[PARAM5] = storeFloat(TOL_33);
    				pRsp->params[PARAM6] = storeFloat(EXPECTED_33);
    			}
    			break;
    				
    			case TEST_NUM_5:
    			{
    				pRsp->params[PARAM4] = storeFloat(TOL_5);
    				pRsp->params[PARAM5] = storeFloat(TOL_5);
    				pRsp->params[PARAM6] = storeFloat(EXPECTED_5);
    			}
    			break;
    				
    			case TEST_NUM_TEMP:
    			{
    				pRsp->params[PARAM4] = storeFloat(TEMP_TOL);
    				pRsp->params[PARAM5] = storeFloat(TEMP_TOL);
    				pRsp->params[PARAM6] = storeFloat(EXPECTED_TEMP);
    			}
    			break;
    				
    			default:
    			{
    				pRsp->status = CMD_HDRERR;
    			}
    			break;
    		}
    	}
    	else
    	{
    		pRsp->status = CMD_HDRERR;
    	}
    }

     

     

  • That appears to be a very typical function.  Thus, the most likely explanation for the register allocation error is some bug in the compiler.

    To pursue this bug, we need a test case which allows us to reproduce it.  I'd appreciate if you would preprocess the source to the function handleRTDEventSettings and attach that to your next post.  If you are not comfortable doing that, just let me know.  We can exchange the file privately.  We also need to know the exact compiler options you are using.

    Thanks and regards,

    -George

  • I can send you the .pp file, privately would be best.  I will also get the compiler options and send them to you.


    David

  • Thank you for sending in a test case.  Unfortunately, it builds clean for me.  Is there any chance you could try your build on a different machine?

    Thanks and regards,

    -George

  • I realized you didn't include optimization with your build options.  I see the same internal error if I add --opt_level=1 or higher.  I filed SDSCM00050677 in the SDOWP system to have this addressed.  Feel free to follow it with the SDOWP link below in my signature.

    Thanks and regards,

    -George