Skip to content

FATAL ERROR: ttcn3_compiler: In line 11645 of AST_ttcn3.cc: ActualPar::set_my_scope()

Summary

ttcn3_compiler aborts while compiling:

FATAL ERROR: /usr/ttcn3/bin/ttcn3_compiler: In line 11645 of AST_ttcn3.cc: ActualPar::set_my_scope()
make[1]: *** [Makefile:206: compile] Aborted (core dumped)
make[1]: Leaving directory '/home/pespin/dev/sysmocom/ttcn3/osmo-ttcn3-hacks/bts'

Steps and/or TTCN-3 code to reproduce

I have one such module I was writing:

module OSMUX_Types {

import from General_Types all;
import from Misc_Helpers all;

import from AMR_Types all;

external function enc_OSMUX_PDU ( in OSMUX_PDU msg ) return octetstring
        with { extension "prototype(convert) encode(RAW)" };
external function dec_OSMUX_PDU ( in octetstring msg ) return OSMUX_PDU
        with { extension "prototype(convert) decode(RAW)" };

type INT1 OsmuxCID	(0 .. 255);

type enumerated OsmuxFT {
  OSMUX_FT_LAPD,
  OSMUX_FT_AMR,
  OSMUX_FT_DUMMY
};

type record Osmux_AMR_header {
  BIT1                 marker,
  INT2b                ft,
  INT3b                ctr,
  BIT1                 amr_f,
  BIT1                 amr_q,
  INT1                 seq,
  OsmuxCID             cid,
  INT4b                amr_ft,
  INT4b                amr_cmr
} with {
  variant "FIELDORDER(msb)"
}

type record PDU_Osmux_AMR {
  Osmux_AMR_header     header,
  octetstring          data
} with {
  variant "FIELDORDER(msb)"
};

type record PDU_Osmux_DUMMY {
  Osmux_AMR_header     header,
  octetstring          data
} with {
  variant "FIELDORDER(msb)"
};

type record Osmux_session_par {
  integer               id optional,
  charstring            local_address optional,
  integer               local_port optional,
  charstring            dest_address optional,
  integer               dest_port optional
}

type record ASP_Osmux_Open_session {
  Osmux_session_par       session_id
}

type record ASP_Osmux_Open_session_result {
  Osmux_session_par       session_id
}

type record ASP_Osmux_Close_session {
  Osmux_session_par       session_id
}

type union OSMUX_PDU {
  PDU_Osmux_AMR               osmux_amr,
  PDU_Osmux_DUMMY             osmux_dummy
} with {
  variant "TAG (
    osmux_amr, header.ft = 1;
    osmux_dummy, header.ft = 2;
  )"
};

template (present) PDU_Osmux_AMR tr_OsmuxAMR(template (present) BIT1 marker := ?,
					     template (present) INT3b ctr := ?,
					     template (present) BIT1 amr_f := ?,
					     template (present) BIT1 amr_q := ?,
					     template (present) INT1 seq := ?,
					     template (present) OsmuxCID cid := ?,
					     template (present) INT4b amr_ft := ?,
					     template (present) INT4b amr_cmr := ?,
					     octetstring payload := ?) := {
	header := {
		marker := marker,
		ft := 1,
		ctr := ctr,
		amr_f := amr_f,
		amr_q := amr_q,
		seq := seq,
		cid := cid,
		amr_ft := amr_ft,
		amr_cmr := amr_cmr
	},
	data := payload
}
} with { encode "RAW"}

Then, I tried to set a template like this, which triggers the compiler crash:

	var template (present) PDU_Osmux_AMR osmux_pdu_exp := tr_OsmuxAMR(cid := g_pars.loc_osmux_cid,
									  amr_ft := amr_ft,
									  amr_cmr := amr_ft);

What is the current bug behavior?

The compiler aborts with the above provided message.

What is the expected correct behavior?

Don't crash, do what it's requested ;)

Titan version

$ ttcn3_compiler -v
warning: Charstring pattern: Cannot open file '/usr/ttcn3/etc/CaseFolding.txt' for reading. Case-insensitive universal charstring patterns are disabled.

TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor
Version: 8.1.0
Build date: Apr 12 2022 20:55:42
Compiled with: GCC 11.2.0
Using OpenSSL 1.1.1q  5 Jul 2022
Commit id: 6be5a7f23

Copyright (c) 2000-2021 Ericsson Telecom AB

Platform details (OS type and version)

(OS type/distribution and version, e.g. Ubuntu 18.04, Windows 10+Cygwin)

/cc @aknappqwt @mmagyari