Skip to content

Commit

Permalink
fbc: internal: clear AST_NODECLASS_TYPEINI_* fields
Browse files Browse the repository at this point in the history
- initialize typeini.ofs and typeini.bytes to zero even when
  fields aren't used to avoid leaving garbage in the data
  structure
  • Loading branch information
jayrm committed Feb 26, 2023
1 parent d19c1c7 commit 55a8008
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/compiler/ast-node-typeini.bas
Expand Up @@ -574,6 +574,11 @@ function astTypeIniScopeBegin _
n->sym = sym
n->typeiniscope.is_array = is_array

'' ofs and bytes (elements) should never be used for typeini scopes
'' zero them out anyway so debugging display is a little nicer
n->typeini.ofs = 0
n->typeini.bytes = 0

function = n
end function

Expand All @@ -590,6 +595,11 @@ function astTypeIniScopeEnd _
n = hAddNode( tree, AST_NODECLASS_TYPEINI_SCOPEEND )
n->sym = sym

'' ofs and bytes (elements) should never be used for typeini scopes
'' zero them out anyway so debugging display is a little nicer
n->typeini.ofs = 0
n->typeini.bytes = 0

function = n
end function

Expand Down

0 comments on commit 55a8008

Please sign in to comment.