﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4893	ligc segfault at fmiInstantiateModel	simon.zeni@…	Lennart Ochel	"Hi,

I'm using fmi version 1 with the C simulation runtime, and for a specific FMU there is a SIGSEGV thrown when instantiating the model.

Here's the GDB stacktrace

{{{
(gdb) bt
#0  0xabfc366d in GC_find_limit_with_bound (p=0x81a0604 """", up=0, bound=0x0) at os_dep.c:966
#1  0xabfc373f in GC_find_limit (p=0x81a0604 """", up=0) at os_dep.c:978
#2  0xabfc37c0 in GC_init_linux_data_start () at os_dep.c:463
#3  0xabfc1799 in GC_init () at misc.c:1159
#4  0xabfbb76c in GC_generic_malloc_inner (lb=0, k=2) at malloc.c:125
#5  0xabfbb809 in GC_generic_malloc (lb=0, k=2) at malloc.c:196
#6  0xabfbbb69 in GC_generic_malloc_uncollectable (lb=<value optimized out>, k=2) at malloc.c:319
#7  0xabfbbc05 in GC_malloc_uncollectable (lb=0) at malloc.c:351
#8  0xaf881d19 in initializeDataStruc (data=0x83bf078, threadData=0x83bf410) at simulation/solver/model_help.c:903
#9  0xac4de7ec in GENSAL_fmiInstantiateModel (instanceName=<value optimized out>, GUID=<value optimized out>, functions=..., loggingOn=76 'L')
    at include/fmi1/fmu1_model_interface.c:189
(gdb) frame 0
#0  0xabfc366d in GC_find_limit_with_bound (p=0x81a0604 """", up=0, bound=0x0) at os_dep.c:966
966                     GC_noop1((word)(*result));
(gdb) print result
$5 = (volatile ptr_t) 0x8047f00 <Address 0x8047f00 out of bounds>
(gdb) frame 8
#8  0xaf881d19 in initializeDataStruc (data=0x83bf078, threadData=0x83bf410) at simulation/solver/model_help.c:903
903         tmpSimData.stringVars = (modelica_string*) omc_alloc_interface.malloc_uncollectable(data->modelData->nVariablesString * sizeof(modelica_string));
(gdb) info locals
tmpSimData = {timeValue = 0, realVars = 0x83bf500, integerVars = 0x83bef30, booleanVars = 0x83b99a0 """", stringVars = 0x0, inlineVars = 0x0}
i = <value optimized out>
(gdb) print data->modelData->nVariablesString
$6 = 0

}}}

Link the the function https://github.com/ivmai/bdwgc/blob/master/os_dep.c#L982

This model has only one string parameter, yet data->modelData->nVariablesString is 0.

I cannot test the c++ runtime because i'm using Centos 6.9 32 bits and cannot compile it due to boost errors.

Is this a known problem?

Thanks

"	defect	new	high	Future	Code Generation	v1.13.0-dev-nightly		SIGSEGV, libgc, c, fmi1	
