Skip to content

[osx.10.12-x64/release] Parameters are not evaluated from left to right on OSX in release mode. #7870

@rvuistin

Description

@rvuistin
  • The following code fails on osx.10.12-x64 runtime in release mode but succeeds in debug mode.
  • It succeeds on win81-x64 in release and debug mode
  • I didn't check any other runtimes.
public static Foo Deserialize(Stream stream)
{
    using (var r = new BinaryReader (stream))
    {
        return new Foo (r.ReadString (), r.ReadDecimal ());
    }
}

The method ReadDecimal is called before ReadString. Surprisingly this happens only with runtime methods. If we use custom methods instead (for example extensions methods which trace the order of execution) , the code works.

Find attached the zip file which contains the netcoreapp1.1 project that reproduce the issue: I have used the following commands to publish the project:

dotnet restore -r osx.10.12-x64 ParametersEvaluationOrderTest.csproj
dotnet publish -r osx.10.12-x64 -c release ParametersEvaluationOrderTest.csproj

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIbug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions