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

Wrong error message when the input array for a vector is too small

    XMLWordPrintable

Details

    Description

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 22.04.2 LTS
      openjdk version "20-internal" 2023-03-21
      OpenJDK Runtime Environment (build 20-internal-adhoc.admin1.jdk-jdk-20-34)
      OpenJDK 64-Bit Server VM (build 20-internal-adhoc.admin1.jdk-jdk-20-34, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      There seems to be a wrong error message when the IntVector.fromArray function is used with an array that is too small. For example, the attached code produces an IndexOutOfBoundsException: Index 0 out of bounds for length -4, which is not really helpful to resolve the issue. It would be good if the error message could clarify that the provided array is too small for the specified vector species. (The issue also occurs with other vector types.)

      class Test{
          public static void main(String args[]){
           jdk.incubator.vector.IntVector vx = jdk.incubator.vector.IntVector.fromArray(jdk.incubator.vector.IntVector.SPECIES_256, new int[] { 0,1,2}, 0);
          }
      }


      Attachments

        Issue Links

          Activity

            People

              psandoz Paul Sandoz
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: