diff options
author | Hongtao Yu <Hongtao.Yu@microsoft.com> | 2016-01-11 15:24:49 -0800 |
---|---|---|
committer | Hongtao Yu <hoy@microsoft.com> | 2016-01-12 16:56:54 -0800 |
commit | f5bee7d646dc2b2ee185c4862be6076ac0b7d773 (patch) | |
tree | 0e0ed20889ff9e5d16097339e134589af78f91d0 /tests/src | |
parent | 880da9d64f23e2e7661eb0471f8d79394fc324d7 (diff) | |
download | coreclr-f5bee7d646dc2b2ee185c4862be6076ac0b7d773.tar.gz coreclr-f5bee7d646dc2b2ee185c4862be6076ac0b7d773.tar.bz2 coreclr-f5bee7d646dc2b2ee185c4862be6076ac0b7d773.zip |
Fix for bug 2610 Incorrect copy prop substitution.
The bug is due to missing lvAddrExposed flag for tmp vars serving as pass-by-ref arguments.
Diffstat (limited to 'tests/src')
3 files changed, 155 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.cs b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.cs new file mode 100644 index 0000000000..fb7559e4ec --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System; +using System.Runtime.CompilerServices; + +public struct MyValue +{ + public long val; + public MyValue(long a) + { val = a; } +} + +public struct MyStruct +{ + public MyValue v1; + public MyValue v2; + + public MyStruct(MyValue a, MyValue b) + { v1 = a; v2 = b; } +} + +class Program +{ + static int Main() + { + MyValue p1 = new MyValue(10); + MyValue p2 = new MyValue(20); + + MyStruct c1 = new MyStruct(p1, p2); + MyStruct c2 = new MyStruct(p2, p1); + + bool b1 = Program.IsXGeater(c1); + bool b2 = Program.IsXGeater(c2); + bool b3 = Program.IsXGeater(c1); + bool b4 = Program.IsXGeater(c2); + + if (b1) + { + Console.WriteLine("Fail"); + return -1; + } + + if (!b2) + { + Console.WriteLine("Fail"); + return -1; + } + + if (b3) + { + Console.WriteLine("Fail"); + return -1; + } + + if (!b4) + { + Console.WriteLine("Fail"); + return -1; + } + + Console.WriteLine("Pass"); + return 100; + } + + // Return true if p1.x > p2.y + [MethodImplAttribute(MethodImplOptions.NoInlining)] + public static bool IsXGeater(MyStruct line) + { + if (line.v1.val > line.v2.val) + { + line = new MyStruct(line.v2, line.v1); + return true; + } + + return false; + } +} diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.csproj new file mode 100644 index 0000000000..8f33be95db --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_2610/GitHub_2610.csproj @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <AssemblyName>$(MSBuildProjectName)</AssemblyName> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\11.0\UITestExtensionPackages</ReferencePath> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> + + <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp> + </PropertyGroup> + <!-- Default configurations to help VS understand the configurations --> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + </PropertyGroup> + <ItemGroup> + <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies"> + <Visible>False</Visible> + </CodeAnalysisDependentAssemblyPaths> + </ItemGroup> + <PropertyGroup> + <DebugType></DebugType> + <Optimize>True</Optimize> + </PropertyGroup> + <ItemGroup> + <Compile Include="$(MSBuildProjectName).cs" /> + </ItemGroup> + <ItemGroup> + <None Include="$(JitPackagesConfigFileDirectory)minimal\project.json" /> + <None Include="app.config" /> + </ItemGroup> + <ItemGroup> + <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" /> + </ItemGroup> + <PropertyGroup> + <ProjectJson>$(JitPackagesConfigFileDirectory)minimal\project.json</ProjectJson> + <ProjectLockJson>$(JitPackagesConfigFileDirectory)minimal\project.lock.json</ProjectLockJson> + </PropertyGroup> + <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> + <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "> + </PropertyGroup> +</Project> diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_2610/app.config b/tests/src/JIT/Regression/JitBlue/GitHub_2610/app.config new file mode 100644 index 0000000000..62803f5972 --- /dev/null +++ b/tests/src/JIT/Regression/JitBlue/GitHub_2610/app.config @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.20.0" newVersion="4.0.20.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Text.Encoding" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + <dependentAssembly> + <assemblyIdentity name="System.Reflection" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-4.0.10.0" newVersion="4.0.10.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file |