parent
5d56361383
commit
7ea318a053
3 changed files with 27 additions and 6 deletions
|
|
@ -328,7 +328,8 @@ proc initLocalVar(p: BProc, v: PSym, immediateAsgn: bool) =
|
||||||
proc getTemp(p: BProc, t: PType, result: var TLoc; needsInit=false) =
|
proc getTemp(p: BProc, t: PType, result: var TLoc; needsInit=false) =
|
||||||
inc(p.labels)
|
inc(p.labels)
|
||||||
result.r = "LOC" & rope(p.labels)
|
result.r = "LOC" & rope(p.labels)
|
||||||
linefmt(p, cpsLocals, "$1 $2;$n", getTypeDesc(p.module, t), result.r)
|
addf(p.blocks[0].sections[cpsLocals],
|
||||||
|
"$1 $2;$n", [getTypeDesc(p.module, t), result.r])
|
||||||
result.k = locTemp
|
result.k = locTemp
|
||||||
#result.a = - 1
|
#result.a = - 1
|
||||||
result.t = t
|
result.t = t
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import
|
||||||
from msgs import TLineInfo
|
from msgs import TLineInfo
|
||||||
|
|
||||||
type
|
type
|
||||||
TLabel* = Rope # for the C generator a label is just a rope
|
TLabel* = Rope # for the C generator a label is just a rope
|
||||||
TCFileSection* = enum # the sections a generated C file consists of
|
TCFileSection* = enum # the sections a generated C file consists of
|
||||||
cfsMergeInfo, # section containing merge information
|
cfsMergeInfo, # section containing merge information
|
||||||
cfsHeaders, # section for C include file headers
|
cfsHeaders, # section for C include file headers
|
||||||
|
|
@ -89,7 +89,7 @@ type
|
||||||
# requires 'T x = T()' to become 'T x; x = T()'
|
# requires 'T x = T()' to become 'T x; x = T()'
|
||||||
# (yes, C++ is weird like that)
|
# (yes, C++ is weird like that)
|
||||||
gcFrameId*: Natural # for the GC stack marking
|
gcFrameId*: Natural # for the GC stack marking
|
||||||
gcFrameType*: Rope # the struct {} we put the GC markers into
|
gcFrameType*: Rope # the struct {} we put the GC markers into
|
||||||
|
|
||||||
TTypeSeq* = seq[PType]
|
TTypeSeq* = seq[PType]
|
||||||
|
|
||||||
|
|
@ -111,10 +111,10 @@ type
|
||||||
tmpBase*: Rope # base for temp identifier generation
|
tmpBase*: Rope # base for temp identifier generation
|
||||||
typeCache*: TIdTable # cache the generated types
|
typeCache*: TIdTable # cache the generated types
|
||||||
forwTypeCache*: TIdTable # cache for forward declarations of types
|
forwTypeCache*: TIdTable # cache for forward declarations of types
|
||||||
declaredThings*: IntSet # things we have declared in this .c file
|
declaredThings*: IntSet # things we have declared in this .c file
|
||||||
declaredProtos*: IntSet # prototypes we have declared in this .c file
|
declaredProtos*: IntSet # prototypes we have declared in this .c file
|
||||||
headerFiles*: TLinkedList # needed headers to include
|
headerFiles*: TLinkedList # needed headers to include
|
||||||
typeInfoMarker*: IntSet # needed for generating type information
|
typeInfoMarker*: IntSet # needed for generating type information
|
||||||
initProc*: BProc # code for init procedure
|
initProc*: BProc # code for init procedure
|
||||||
postInitProc*: BProc # code to be executed after the init proc
|
postInitProc*: BProc # code to be executed after the init proc
|
||||||
preInitProc*: BProc # code executed before the init proc
|
preInitProc*: BProc # code executed before the init proc
|
||||||
|
|
|
||||||
20
tests/ccgbugs/tescaping_temps.nim
Normal file
20
tests/ccgbugs/tescaping_temps.nim
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
# bug #4505
|
||||||
|
|
||||||
|
proc f(t: tuple[]) = discard
|
||||||
|
f((block: ()))
|
||||||
|
|
||||||
|
# bug #4230
|
||||||
|
# If we make `test` function return nothing - the bug disappears
|
||||||
|
proc test(dothejob: proc()): int {.discardable.} =
|
||||||
|
dothejob()
|
||||||
|
|
||||||
|
test proc() =
|
||||||
|
let f = 15
|
||||||
|
if f > 10:
|
||||||
|
test proc() = discard
|
||||||
|
# If we remove elif branch of the condition - the bug disappears
|
||||||
|
elif f < 3:
|
||||||
|
test proc() = discard
|
||||||
|
else:
|
||||||
|
test proc() = discard
|
||||||
Loading…
Add table
Add a link
Reference in a new issue