add repro for #18056 (#18057)
authorSergey Andreenko <seandree@microsoft.com>
Tue, 22 May 2018 04:08:58 +0000 (21:08 -0700)
committerGitHub <noreply@github.com>
Tue, 22 May 2018 04:08:58 +0000 (21:08 -0700)
* add repro

* add the exclusion

* fix comments

tests/issues.targets
tests/src/JIT/Regression/JitBlue/GitHub_18056/Bool_And_Op.cs [new file with mode: 0644]
tests/src/JIT/Regression/JitBlue/GitHub_18056/Bool_And_Op_cs_do.csproj [new file with mode: 0644]

index b5f8fe4..6965758 100644 (file)
         <ExcludeList Include="$(XunitTestBinBase)\Loader\classloader\TypeGeneratorTests\TypeGeneratorTest683\Generated683\*">
             <Issue>6707</Issue>
         </ExcludeList>
+        <ExcludeList Include="$(XunitTestBinBase)\JIT\Regression\JitBlue\GitHub_18056\Bool_And_Op_cs_do\Bool_And_Op_cs_do.cmd">
+            <Issue>18056</Issue>
+        </ExcludeList>
     </ItemGroup>
 
     <!-- The following are x86 failures -->
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18056/Bool_And_Op.cs b/tests/src/JIT/Regression/JitBlue/GitHub_18056/Bool_And_Op.cs
new file mode 100644 (file)
index 0000000..ee5e222
--- /dev/null
@@ -0,0 +1,99 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+//
+
+// The test originally exposed the issue with predecessors lists:
+// 1. fgReplacePred did not keep the sorted order (GitHub_13295);
+// 2. fgAddRefPred did not find the existing occurrence if the order was not sorted;
+// 3. fgReplacePred had several occurrences of the same block and when it became dead it updated only the first link;
+// 4. The link to the dead block exposed noway_assert in flowgraph.
+// The repro required JitStress=2 or complus_jitstressmodenames=STRESS_BB_PROFILE;
+// STRESS_BB_PROFILE uses file name hash to set weights, so this file can't be renamed.
+
+#pragma warning disable
+
+using System;
+class testout1
+{
+    static bool static_field_bool;
+    static bool sfb_false;
+    static bool sfb_true;
+    bool mfb;
+    bool mfb_false;
+    bool mfb_true;
+    static bool simple_func_bool()
+    {
+        return true;
+    }
+    static bool func_sb_true()
+    {
+        return true;
+    }
+    static bool func_sb_false()
+    {
+        return false;
+    }
+
+    static int Sub_Funclet_411()
+    {
+        int True_Sum = 0;
+        int False_Sum = 0;
+        int index = 1;
+        bool local_bool = true;
+        testout1 t1_i = new testout1();
+        bool[] ab_false = new bool[3];
+        bool[] ab_true = new bool[3];
+        ab_true[0] = true;
+        ab_true[1] = true;
+        ab_true[2] = true;
+
+        static_field_bool = true;
+        sfb_false = false;
+        sfb_true = true;
+
+        t1_i.mfb = true;
+        t1_i.mfb_false = false;
+        t1_i.mfb_true = true;
+        if (ab_true[index] && func_sb_true() ? static_field_bool : t1_i.mfb) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? static_field_bool : simple_func_bool()) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? static_field_bool : ab_true[index]) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? static_field_bool : ab_false[index]) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : true) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : false) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : local_bool) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : static_field_bool) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : t1_i.mfb) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : simple_func_bool()) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : ab_true[index]) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? t1_i.mfb : ab_false[index]) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : true) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : false) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : local_bool) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : static_field_bool) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : t1_i.mfb) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : simple_func_bool()) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : ab_true[index]) True_Sum++; else False_Sum++;
+        if (ab_true[index] && func_sb_true() ? simple_func_bool() : ab_false[index]) True_Sum++; else False_Sum++;
+        return (True_Sum * 2) - False_Sum;
+    }
+  
+    public static int Main()
+    {
+        int Sum = 0;
+       
+        Sum += Sub_Funclet_411();
+      
+        if (Sum == 40)
+        {
+            Console.WriteLine("PASSED");
+            return 100;
+        }
+        else
+        {
+            Console.WriteLine("FAILED");
+            return -1;
+        }
+
+    }
+}
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_18056/Bool_And_Op_cs_do.csproj b/tests/src/JIT/Regression/JitBlue/GitHub_18056/Bool_And_Op_cs_do.csproj
new file mode 100644 (file)
index 0000000..cb0aecd
--- /dev/null
@@ -0,0 +1,35 @@
+<?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>{0C9B9A3F-D3C7-428F-A506-DF7E3181DB71}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <CLRTestPriority>1</CLRTestPriority>
+  </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>Full</DebugType>
+    <Optimize>True</Optimize>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Include="Bool_And_Op.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+  </ItemGroup>
+  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
+  <PropertyGroup Condition=" '$(MsBuildProjectDirOverride)' != '' "></PropertyGroup>
+</Project>