fixes #914
This commit is contained in:
parent
09c8a51348
commit
49fa421ba7
4 changed files with 7 additions and 3 deletions
|
|
@ -593,7 +593,7 @@ proc unaryArith(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
|
||||||
|
|
||||||
proc genDeref(p: BProc, e: PNode, d: var TLoc) =
|
proc genDeref(p: BProc, e: PNode, d: var TLoc) =
|
||||||
var a: TLoc
|
var a: TLoc
|
||||||
if mapType(e.sons[0].typ) == ctArray:
|
if mapType(e.sons[0].typ) in {ctArray, ctPtrToArray}:
|
||||||
# XXX the amount of hacks for C's arrays is incredible, maybe we should
|
# XXX the amount of hacks for C's arrays is incredible, maybe we should
|
||||||
# simply wrap them in a struct? --> Losing auto vectorization then?
|
# simply wrap them in a struct? --> Losing auto vectorization then?
|
||||||
expr(p, e.sons[0], d)
|
expr(p, e.sons[0], d)
|
||||||
|
|
|
||||||
|
|
@ -185,7 +185,7 @@ proc mapType(typ: PType): TCTypeKind =
|
||||||
of tyPtr, tyVar, tyRef:
|
of tyPtr, tyVar, tyRef:
|
||||||
var base = skipTypes(typ.sons[0], typedescInst)
|
var base = skipTypes(typ.sons[0], typedescInst)
|
||||||
case base.kind
|
case base.kind
|
||||||
of tyOpenArray, tyArrayConstr, tyArray, tyVarargs: result = ctArray
|
of tyOpenArray, tyArrayConstr, tyArray, tyVarargs: result = ctPtrToArray
|
||||||
else: result = ctPtr
|
else: result = ctPtr
|
||||||
of tyPointer: result = ctPtr
|
of tyPointer: result = ctPtr
|
||||||
of tySequence: result = ctNimSeq
|
of tySequence: result = ctNimSeq
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,8 @@ type
|
||||||
ctInt, ctInt8, ctInt16, ctInt32, ctInt64,
|
ctInt, ctInt8, ctInt16, ctInt32, ctInt64,
|
||||||
ctFloat, ctFloat32, ctFloat64, ctFloat128,
|
ctFloat, ctFloat32, ctFloat64, ctFloat128,
|
||||||
ctUInt, ctUInt8, ctUInt16, ctUInt32, ctUInt64,
|
ctUInt, ctUInt8, ctUInt16, ctUInt32, ctUInt64,
|
||||||
ctArray, ctStruct, ctPtr, ctNimStr, ctNimSeq, ctProc, ctCString
|
ctArray, ctPtrToArray, ctStruct, ctPtr, ctNimStr, ctNimSeq, ctProc,
|
||||||
|
ctCString
|
||||||
TCFileSections* = array[TCFileSection, PRope] # represents a generated C file
|
TCFileSections* = array[TCFileSection, PRope] # represents a generated C file
|
||||||
TCProcSection* = enum # the sections a generated C proc consists of
|
TCProcSection* = enum # the sections a generated C proc consists of
|
||||||
cpsLocals, # section of local variables for C proc
|
cpsLocals, # section of local variables for C proc
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ var
|
||||||
new(a)
|
new(a)
|
||||||
q(a)
|
q(a)
|
||||||
|
|
||||||
|
# bug #914
|
||||||
|
var x = newWideCString("Hello")
|
||||||
|
|
||||||
echo "success"
|
echo "success"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue