<p>Another thing to verify would be how can a variable in a group have the offset 172, when the group size is calculated to be 172 (probably something to do with <code>pragma</code>).</p>
<p>To check what's going on, I added another integer cfg variable to the last group. The memory mapping this time (without using <code>pragma</code> blocks) is as follows:</p>
<pre><code>START
block address: 0x7fde5c80fa08
vars address: 0x7fde5c80fa0c
Total allocated size: 1168
Group number: 1
Group location from start 20
Group size: 248
Group number: 2
Group location from start 284
Group size: 56
Group number: 3
Group location from start 356
Group size: 4
Group number: 4
Group location from start 380
Group size: 4
Group number: 5
Group location from start 404
Group size: 4
Group number: 6
Group location from start 428
Group size: 176
Group number: 7
Group location from start 620
Group size: 104
Group number: 8
Group location from start 740
Group size: 200
Group number: 9
Group location from start 956
Group size: 16
Group number: 10
Group location from start 988
Group size: 180

#For the new variable added 

(gdb) print var->offset
$3 = 176
(gdb) print group
$4 = (cfg_group_t *) 0x7fdee1bca108
(gdb) print group->var_offset
$5 = 984
</code></pre>
<p>So, this time, the offset and group size make sense.</p>
<p>According to me, using <code>pragma</code> blocks would create more problems. The next thing to investigate would be this inconsistency between group size and variable offset.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/issues/1583#issuecomment-403649773">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AF36ZW2pT4RL5ZK-EP9x-w8kMgIKhKMKks5uE-UfgaJpZM4VDDlj">mute the thread</a>.<img src="https://github.com/notifications/beacon/AF36ZZrtr60AqicF6kT8HgxVQYG3wfGOks5uE-UfgaJpZM4VDDlj.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/kamailio/kamailio","title":"kamailio/kamailio","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/kamailio/kamailio"}},"updates":{"snippets":[{"icon":"PERSON","message":"@vinesinha in #1583: Another thing to verify would be how can a variable in a group have the offset 172, when the group size is calculated to be 172 (probably something to do with `pragma`). \r\n\r\nTo check what's going on, I added another integer cfg variable to the last group. The memory mapping this time (without using `pragma` blocks) is as follows:\r\n\r\n```\r\nSTART\r\nblock address: 0x7fde5c80fa08\r\nvars address: 0x7fde5c80fa0c\r\nTotal allocated size: 1168\r\nGroup number: 1\r\nGroup location from start 20\r\nGroup size: 248\r\nGroup number: 2\r\nGroup location from start 284\r\nGroup size: 56\r\nGroup number: 3\r\nGroup location from start 356\r\nGroup size: 4\r\nGroup number: 4\r\nGroup location from start 380\r\nGroup size: 4\r\nGroup number: 5\r\nGroup location from start 404\r\nGroup size: 4\r\nGroup number: 6\r\nGroup location from start 428\r\nGroup size: 176\r\nGroup number: 7\r\nGroup location from start 620\r\nGroup size: 104\r\nGroup number: 8\r\nGroup location from start 740\r\nGroup size: 200\r\nGroup number: 9\r\nGroup location from start 956\r\nGroup size: 16\r\nGroup number: 10\r\nGroup location from start 988\r\nGroup size: 180\r\n\r\n#For the new variable added \r\n\r\n(gdb) print var-\u003eoffset\r\n$3 = 176\r\n(gdb) print group\r\n$4 = (cfg_group_t *) 0x7fdee1bca108\r\n(gdb) print group-\u003evar_offset\r\n$5 = 984\r\n```\r\n\r\nSo, this time, the offset and group size make sense. \r\n\r\nAccording to me, using `pragma` blocks would create more problems. The next thing to investigate would be this inconsistency between group size and variable offset. \r\n"}],"action":{"name":"View Issue","url":"https://github.com/kamailio/kamailio/issues/1583#issuecomment-403649773"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/issues/1583#issuecomment-403649773",
"url": "https://github.com/kamailio/kamailio/issues/1583#issuecomment-403649773",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
},
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"hideOriginalBody": "false",
"originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB",
"title": "Re: [kamailio/kamailio] cfg_rpc updates changing variable values to large random numbers  (#1583)",
"sections": [
{
"text": "",
"activityTitle": "**vinesinha**",
"activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png",
"activitySubtitle": "@vinesinha",
"facts": [

]
}
],
"potentialAction": [
{
"name": "Add a comment",
"@type": "ActionCard",
"inputs": [
{
"isMultiLine": true,
"@type": "TextInput",
"id": "IssueComment",
"isRequired": false
}
],
"actions": [
{
"name": "Comment",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1583,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}"
}
]
},
{
"name": "Close issue",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"kamailio/kamailio\",\n\"issueId\": 1583\n}"
},
{
"targets": [
{
"os": "default",
"uri": "https://github.com/kamailio/kamailio/issues/1583#issuecomment-403649773"
}
],
"@type": "OpenUri",
"name": "View on GitHub"
},
{
"name": "Unsubscribe",
"@type": "HttpPOST",
"target": "https://api.github.com",
"body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 353122659\n}"
}
],
"themeColor": "26292E"
}
]</script>