Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Version 1.06.0
- Under X11, ScreenControl GET_WINDOW_HANDLE places the Display ptr in param2
- Updated bindings: SDL2 2.0.6, SDL2_image 2.0.1, SDL2_mixer 2.0.1, SDL2_net 2.0.1, SDL2_ttf 2.0.14
- allow overload operator SQR()
- allow [static] shared byref variables to be initialized with byref variable

[fixed]
- win/d3dx9.bi no longer has a hard-coded #inclib "d3dx9d". d3dx9d.dll is apparently not a generally valid choice. In practice programs have to be linked against d3dx9_33.dll or d3dx9_39.dll, etc.
Expand Down Expand Up @@ -62,6 +63,7 @@ Version 1.06.0
- #878: Fix fbc-64bit hangs on 'Case True' + 'Case False' inside 'Select Case As const'
- Fix SELECT CASE AS CONST to allow both signed & unsigned case range values
- #822, #814, #842: Compiler crash when initializing static/shared reference (DIM SHARED/STATIC BYREF) with non-constant initializer (e.g. another reference, or dynamic array element)
- ASM backend: Fix bad code generated for comparisons such as IF @globalvar = 0 THEN


Version 1.05.0
Expand Down
2 changes: 2 additions & 0 deletions src/compiler/ir-tac.bas
Original file line number Diff line number Diff line change
Expand Up @@ -2019,6 +2019,8 @@ private sub hFlushCOMP _
doload = TRUE
elseif( v1_typ = IR_VREGTYPE_IMM) then '' /
doload = TRUE
elseif( v1_typ = IR_VREGTYPE_OFS and v2_typ = IR_VREGTYPE_IMM ) then
doload = TRUE
elseif( v2_typ <> IR_VREGTYPE_REG ) then '' /
if( v2_typ <> IR_VREGTYPE_IMM ) then
doload = TRUE
Expand Down
45 changes: 45 additions & 0 deletions src/compiler/parser-decl-var.bas
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,49 @@ private function hBuildFakeByrefInitExpr( byval dtype as integer, byval subtype
function = astNewDEREF( expr )
end function

'' resolve reference to a reference
private function hResolveRefToRefInitializer( byval dtype as integer, byval expr as ASTNODE ptr ) as ASTNODE ptr

dim tree as ASTNODE ptr = any
dim n as ASTNODE ptr = any

'' if initializer expr is a REF VAR, then crawl the INITREE of the var
'' it references for a VAR initializer. If none found just return the
'' original expr.

if( expr andalso astIsDEREF( expr ) ) then
if( expr->l andalso astIsVAR( expr->l ) ) then
if( expr->l->sym andalso symbIsRef( expr->l->sym ) andalso symbIsVar( expr->l->sym ) ) then
tree = expr->l->sym->var_.initree
if( tree andalso astIsTYPEINI( tree ) ) then
if( tree->l andalso tree->l->class = AST_NODECLASS_TYPEINI_ASSIGN ) then
n = tree->l->l
if( n ) then

select case astGetClass( n )
case AST_NODECLASS_OFFSET
n = n->l
if( n andalso astIsVAR( n ) ) then
'' compatible types?
if( astGetFullType( n ) = dtype ) then
astDelTree( expr )
expr = astCloneTree( n )
end if
end if
end select

end if
end if
end if

end if
end if
end if

function = expr

end function

private function hCheckAndBuildByrefInitializer( byval sym as FBSYMBOL ptr, byref expr as ASTNODE ptr ) as ASTNODE ptr
'' Check data types, CONSTness, etc.
var ok = astCheckByrefAssign( sym->typ, sym->subtype, expr )
Expand All @@ -866,6 +909,8 @@ private function hCheckAndBuildByrefInitializer( byval sym as FBSYMBOL ptr, byre
errReport( FB_ERRMSG_INVALIDDATATYPES )
astDelTree( expr )
expr = hBuildFakeByrefInitExpr( sym->typ, sym->subtype )
else
expr = hResolveRefToRefInitializer( sym->typ, expr )
end if

'' Build the TYPEINI for initializing the reference/pointer
Expand Down
Loading