mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 23:29:55 +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> {
|
private fun copyStringValue(assign: Assignment): List<IAstModification> {
|
||||||
val identifier = assign.target.identifier!!
|
val identifier = assign.target.identifier!!
|
||||||
val sourceIdent = assign.value as? IdentifierReference
|
|
||||||
val strcopy = FunctionCallStatement(IdentifierReference(listOf("sys", "internal_stringcopy"), assign.position),
|
val strcopy = FunctionCallStatement(IdentifierReference(listOf("sys", "internal_stringcopy"), assign.position),
|
||||||
mutableListOf(
|
mutableListOf(
|
||||||
if(sourceIdent!=null)
|
assign.value as? IdentifierReference ?: assign.value,
|
||||||
AddressOf(sourceIdent, assign.position)
|
identifier
|
||||||
else
|
|
||||||
assign.value,
|
|
||||||
AddressOf(identifier, assign.position)
|
|
||||||
),
|
),
|
||||||
true,
|
true,
|
||||||
assign.position
|
assign.position
|
||||||
|
@ -27,7 +27,14 @@ main {
|
|||||||
ubyte @shared value = inline_candidate()
|
ubyte @shared value = inline_candidate()
|
||||||
|
|
||||||
str name = "irmen123ABC"
|
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_ub(string.upper(name))
|
||||||
txt.print(name)
|
txt.print(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user