Skip to content

Compound assignment with post increment in lhs miscompiles #2730

@abextm

Description

@abextm

Bug description

Compound assignment where the left hand side is an array with a post increment index generates incorrect code.

let a = new Uint32Array(1);
let v = 0;
a[v++] |= 1234;

actually is generating something like

let a = new Uint32Array(1);
let v = 0;
let v$0 = v;
v += 1;
a[v$0] = a[v] | 1234;

Steps to reproduce

Editor

Should print 1234, instead crashes

AssemblyScript version

0.27.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions