Skip to content

Commit d249ff8

Browse files
committed
Fix Bad @n stdcall suffix for non-trivial byval type parameters with -gen gcc
1 parent 77ed5c8 commit d249ff8

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Version 1.06.0
7575
- #880: Overload binary operators now support covariant arguments, overloaded procedure resolution changed especially with respect to CONST and non-CONST parameters
7676
- Fix for debugging lines in include files but not in procedures. Filename debugging information added for module level statements in included files.
7777
- #699: fix new[0] causing infinite loop when calling constructor/destructor list
78+
- #890: Fix Bad @N stdcall suffix for non-trivial byval type parameters with -gen gcc
7879

7980

8081
Version 1.05.0

src/compiler/ir-hlc.bas

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -223,8 +223,8 @@ declare sub _emitDBG _
223223
( _
224224
byval op as integer, _
225225
byval proc as FBSYMBOL ptr, _
226-
byval lnum as integer, _
227-
ByVal filename As zstring ptr = 0 _
226+
byval lnum as integer, _
227+
ByVal filename As zstring ptr = 0 _
228228
)
229229

230230
declare sub exprFreeNode( byval n as EXPRNODE ptr )
@@ -505,11 +505,13 @@ private function hNeedAlias( byval proc as FBSYMBOL ptr ) as integer
505505
function = TRUE
506506

507507
'' For stdcall with @N suffix, if the function has a hidden UDT result
508-
'' pointer parameter, we need the alias to get the correct @N suffix.
509-
'' (gcc would calculate the parameter into the @N suffix, since it
510-
'' doesn't know that the parameter is the special result parameter)
508+
'' pointer parameter, or UDT's passed byval, we need the alias to get
509+
'' the correct @N suffix. (gcc could calculate the wrong value into the
510+
'' @N suffix, since it doesn't known about the special result parameter
511+
'' or byval UDTs). It should be safe to always generate the alias
512+
'' ourselves since we already must control for the special cases.
511513
case FB_FUNCMODE_STDCALL
512-
function = symbProcReturnsOnStack( proc )
514+
function = TRUE
513515
end select
514516
end function
515517

@@ -3159,15 +3161,15 @@ private sub _emitDBG _
31593161
( _
31603162
byval op as integer, _
31613163
byval proc as FBSYMBOL ptr, _
3162-
byval lnum as integer, _
3163-
ByVal filename As zstring ptr _
3164+
byval lnum as integer, _
3165+
ByVal filename As zstring ptr _
31643166
)
31653167

31663168
if( op = AST_OP_DBG_LINEINI ) then
3167-
ctx.linenum = lnum
3169+
ctx.linenum = lnum
31683170
if( filename <> NULL ) then
31693171
hUpdateCurrentFileName( filename )
3170-
end if
3172+
end if
31713173
end if
31723174

31733175
end sub

0 commit comments

Comments
 (0)