`-> param(foo, -)` makes TITAN crash (note the dash)
Summary
TITAN segfaults while compiling my (potentially invalid) code.
Steps and/or TTCN-3 code to reproduce
Try compiling this code:
module TESTEM {
signature TESTEM_req(integer a, integer b);
signature TESTEM_rsp(integer result);
type port TESTEM_PROC_PT procedure {
inout TESTEM_req;
inout TESTEM_rsp;
} with { extension "internal" };
type component TESTEM_CT {
port TESTEM_PROC_PT PROC;
}
type component dummy_CT { };
function f_TESTEM_main() runs on TESTEM_CT {
const integer secret := 42;
var integer a, b, res;
var dummy_CT vc_conn;
alt {
/* "-> param(a, -)" makes TITAN crash (note the dash) */
[] PROC.getcall(TESTEM_req:{?, 0}) -> param(a, -) sender vc_conn {
res := secret * a;
PROC.reply(TESTEM_rsp:{res}) to vc_conn;
}
[] PROC.getcall(TESTEM_req:{?, ?}) -> param(a, b) sender vc_conn {
res := secret * a / b;
PROC.reply(TESTEM_rsp:{res}) to vc_conn;
}
}
}
}
What is the current bug behavior?
$ make compile
...
make: *** [Makefile:212: compile] Segmentation fault (core dumped)
What is the expected correct behavior?
Regardless if the code is valid or not, TITAN should not crash and give a meaningful error.
Relevant logs and/or screenshots
Reading symbols from /opt/eclipse-titan/bin/compiler...
[New LWP 3502663]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/opt/eclipse-titan/bin/ttcn3_compiler -L -D General_Types.ttcn IPCP_Types.ttcn'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00005c3e2cfd29b6 in Ttcn::ParamRedirect::chk_ves (this=0x5c3e37c5f6c0, p_sig=0x5c3e37c58610, p_parlist=0x5c3e37c58170, is_out=false) at Statement.cc:11066
11066 t_ve->get_ref()->set_ref_side(Common::Ref_simple::LHS_REF);
(gdb) bt
#0 0x00005c3e2cfd29b6 in Ttcn::ParamRedirect::chk_ves (this=0x5c3e37c5f6c0, p_sig=0x5c3e37c58610, p_parlist=0x5c3e37c58170, is_out=false) at Statement.cc:11066
#1 0x00005c3e2cfd1e17 in Ttcn::ParamRedirect::chk (this=0x5c3e37c5f6c0, p_sig=0x5c3e37c58610, is_out=false) at Statement.cc:10923
#2 0x00005c3e2cfb80dc in Ttcn::Statement::chk_getcall (this=0x5c3e37c5f9f0) at Statement.cc:5005
#3 0x00005c3e2cfb17f5 in Ttcn::Statement::chk (this=0x5c3e37c5f9f0) at Statement.cc:3369
#4 0x00005c3e2cfe1cff in Ttcn::AltGuard::chk (this=0x5c3e37c61640) at Statement.cc:14730
#5 0x00005c3e2cfe312b in Ttcn::AltGuards::chk (this=0x5c3e37c61700) at Statement.cc:15030
#6 0x00005c3e2cfb44c3 in Ttcn::Statement::chk_alt (this=0x5c3e37c64b90) at Statement.cc:4148
#7 0x00005c3e2cfb1718 in Ttcn::Statement::chk (this=0x5c3e37c64b90) at Statement.cc:3327
#8 0x00005c3e2cfa5d30 in Ttcn::StatementBlock::chk (this=0x5c3e37c5ccf0) at Statement.cc:488
#9 0x00005c3e2cf7679f in Ttcn::Def_Function::chk (this=0x5c3e37c64c90) at AST_ttcn3.cc:8269
#10 0x00005c3e2cf59c32 in Ttcn::Definitions::chk (this=0x5c3e37c52ad0) at AST_ttcn3.cc:2852
#11 0x00005c3e2cf5da0d in Ttcn::Module::chk (this=0x5c3e37c57920) at AST_ttcn3.cc:3626
#12 0x00005c3e2cdc06e2 in Common::Module::chk_recursive (this=0x5c3e37c57920, checked_modules=...) at AST.cc:1471
#13 0x00005c3e2cdb9d96 in Common::Modules::chk (this=0x5c3e36dee8f0) at AST.cc:179
#14 0x00005c3e2cde43c1 in main (argc=43, argv=0x7ffd2790f5f8) at main.cc:1291
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)
Titan version
TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor
Version: 10.1.2
Build date: Sep 17 2024 17:55:31
Compiled with: GCC 14.2.1
Using OpenSSL 3.3.2 3 Sep 2024
Platform details (OS type and version)
Arch Linux https://aur.archlinux.org/packages/eclipse-titan
/cc @aknappqwt @mmagyari