Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8319882

SequenceLayout::toString throws ArithmeticException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2
    • 22
    • 22
    • core-libs
    • None

    Description

      If a sequence layout contains an element type with `byteSize()` zero, the SequenceLayout::toString method will throw an ArithmeticException (division by zero).

      Reproduce:

          @Test
          public void testSequenceLayoutWithZeroLength() {
              SequenceLayout layout = MemoryLayout.sequenceLayout(0, JAVA_INT);
              assertEquals(layout.toString(), "[0:i4]");

              SequenceLayout nested = MemoryLayout.sequenceLayout(0, layout);
              assertEquals(nested.toString(), "[0:[0:i4]]"); // <- Fails!
          }

      Attachments

        Issue Links

          Activity

            People

              pminborg Per-Ake Minborg
              pminborg Per-Ake Minborg
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: