Skip to content

FATAL ERROR is thrown by uninitialized array index

Submitted by Elemer Lelik

Link to original bug (#565542)

Description

module FatalError
{

modulepar
{ 
  integer     tsp_cl_num := 10;  
}


type component MTC_CT       {}; 


 testcase tc_Fatal_Error() runs on MTC_CT 
  {
    //This is OK 
    const integer     cl_num0 := 10;
    var   integer     Int0[cl_num0];
    //This terminates in a scary FATAL ERROR:
    const integer   cl_num := tsp_cl_num;
    var integer     Int[cl_num];
    //FATAL ERROR: /home/user/titan.core/Install/bin/compiler: In line 245 of ArrayDimensions.cc: ArrayDimension::get_value_type()
    //a more graceful exit, similar to the one below would be desirable:
    //This throws a controlled  error:
    //var integer     Int[tsp_cl_num];
    //FatalError.ttcn:18.25-34: error: Reference to an (evaluable) constant value was expected instead of module parameter `@FatalError.tsp_cl_num'
    
  }  

}

Version: 7.1.0

Edited by Adam Knapp