mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 08:29:25 +00:00
fix assigning a pointer (uword) to string not copying the correct memory
This commit is contained in:
parent
4dc9b45297
commit
d1a707df57
@ -414,14 +414,10 @@ internal class StatementReorderer(val program: Program,
|
||||
|
||||
private fun copyStringValue(assign: Assignment): List<IAstModification> {
|
||||
val identifier = assign.target.identifier!!
|
||||
val sourceIdent = assign.value as? IdentifierReference
|
||||
val strcopy = FunctionCallStatement(IdentifierReference(listOf("sys", "internal_stringcopy"), assign.position),
|
||||
mutableListOf(
|
||||
if(sourceIdent!=null)
|
||||
AddressOf(sourceIdent, assign.position)
|
||||
else
|
||||
assign.value,
|
||||
AddressOf(identifier, assign.position)
|
||||
assign.value as? IdentifierReference ?: assign.value,
|
||||
identifier
|
||||
),
|
||||
true,
|
||||
assign.position
|
||||
|
@ -27,7 +27,14 @@ main {
|
||||
ubyte @shared value = inline_candidate()
|
||||
|
||||
str name = "irmen123ABC"
|
||||
str other = "zrmen123ABC"
|
||||
str other = "zrmen123zzz"
|
||||
|
||||
txt.print(name)
|
||||
txt.nl()
|
||||
name=other
|
||||
txt.print(name)
|
||||
txt.nl()
|
||||
txt.nl()
|
||||
|
||||
txt.print_ub(string.upper(name))
|
||||
txt.print(name)
|
||||
|
Loading…
Reference in New Issue
Block a user