Skip to content

Invalid field sequence in value numbering #62178

Closed

Description

@kunalspathak
// Found by Antigen
// TestClass
using System.Runtime.InteropServices;

public class TestClass_A
{
  [StructLayout(LayoutKind.Sequential, Size = 1)]
  public struct S1
  {
  }
  
  [StructLayout(LayoutKind.Sequential, Size = 1)]
  public struct S2
  {
  }
  
  private static byte s_byte_3 = 5;
  
  private static S1 s_s1_16 = default(S1);
  
  private static S2 s_s2_17 = default(S2);
  
  private byte byte_19 = 127;
  
  private short short_23 = -2;
  
  private sbyte sbyte_26 = 2;
  
  private S1 s1_32;
  
  private S2 s2_33;
  
  public byte Method33(ref S1 p_s1_865, ref S2 p_s2_866, ref short p_short_867, S1 p_s1_868, out S1 p_s1_869, out S1 p_s1_870, out S1 p_s1_871, S1 p_s1_872, ref sbyte p_sbyte_873, out S1 p_s1_874, ref S2 p_s2_875)
  {
    p_s1_874 = s1_32;
    return s_byte_3;
  }
  
  public byte Method96(ref S2 p_s2_2493, S2 p_s2_2494, ref S1 p_s1_2495, ref S2 p_s2_2496, ref S1 p_s1_2497, short p_short_2498, S2 p_s2_2499, out ushort p_ushort_2500, ref S2 p_s2_2501, S2 p_s2_2502, out S1 p_s1_2503, ref short p_short_2504, bool p_bool_2505)
  {
    p_ushort_2500 = 11;
    return (byte)((int)Method33(ref p_s1_2497, ref s_s2_17, ref short_23, p_s1_2495, out p_s1_2495, out s_s1_16, out s1_32, s_s1_16, ref sbyte_26, out s_s1_16, ref s2_33) % 15 + 4);
  }
  
  public void Method0()
  {
    ushort p_ushort_ = 2;
    S1 p_s1_ = default(S1);
    S2 p_s2_ = default(S2);
    byte_19 = Method96(ref p_s2_, s_s2_17, ref s_s1_16, ref p_s2_, ref s1_32, 19, s2_33, out p_ushort_, ref p_s2_, s_s2_17, out p_s1_, ref short_23, p_bool_2505: true);
  }
  
  public static void Main(string[] args)
  {
    new TestClass_A().Method0();
  }
}

// Test environment:

// COMPlus_JitOptRepeat=*
// COMPlus_JitStress=2
// COMPlus_TieredCompilation=0
Assert failure(PID 25408 [0x00006340], Thread: 2848 [0x0b20]): Assertion failed 'fldSeq2 != nullptr' in 'TestClass_A:Method96(byref,S2,byref,byref,byref,short,S2,byref,byref,S2,byref,byref,bool):ubyte:this' during 'Do value numbering' (IL size 71)

    File: D:\git\dotnet-runtime\src\coreclr\jit\valuenum.cpp Line: 9008
    Image: d:\git\dotnet-runtime\artifacts\tests\coreclr\windows.x64.Checked\tests\Core_Root\corerun.exe

Activity

  1. ghost added
    area-CodeGen-coreclr
    on Nov 30, 2021
  2. ghost added
    untriaged
    on Nov 30, 2021
  3. kunalspathak commented on Nov 30, 2021

    @kunalspathak
    ContributorAuthor

    @dotnet/jit-contrib

  4. added
    needs-further-triage
    and removed
    untriaged
    on Nov 30, 2021
  5. SingleAccretion commented on Nov 30, 2021

    @SingleAccretion
    Contributor

    This is another instance of #62108 (comment), the problematic tree is as follows (the only difference is that this time it is a proper CSE use, not a def):

    N026 (  5,  5) [000026] ---XG------- arg8 out+40        |     |  |  |     +--*  IND       byte
    N025 (  2,  2) [000025] ----G--N----                    |     |  |  |     |  \--*  ADD       byref
    N023 (  1,  1) [000136] ------------                    |     |  |  |     |     +--*  LCL_VAR   ref    V33 cse1         u:2 (last use)
    N024 (  1,  1) [000024] ------------                    |     |  |  |     |     \--*  CNS_INT   long   8 Fseq[#FirstElem]
  6. removed
    needs-further-triage
    on Nov 30, 2021
  7. added this to the 7.0.0 milestone on Dec 1, 2021
  8. ghost added
    in-pr
    on Dec 10, 2021
  9. ghost removed
    in-pr
    on Jan 13, 2022
  10. ghost locked as resolved and limited conversation to collaborators on Feb 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-CodeGen-coreclr

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions