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

compiler gives bogus error with constuctor with 100 parameters

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      generic, sparc
    • OS:
      solaris_2.4, solaris_2.5, solaris_2.5.1
    • Verification:
      Not verified

      Description

      61() {
            int sum, correct_sum = 61*62/2;
            sum = f(0 , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61);
            if (sum != correct_sum) {
             System.out.println("Error: sum != correct_sum : " + sum + " != " + correct_sum);
            }
      }
      }

      public class clss021 {
        public static void main(String args[]) {
         clss021_a x = new clss021_a();
         x.test60();
         x.test61();
        }
      }

          
      ---------------------------------------------------------------------

      The description field as copied from bug report 1237557 follows:

      Can not instanciate more than 63 classes at one time.
      I know there is probably a bug for this already, but better
      be safe than sorry.

      I get the following error at compile time:

      test100.java:629: Statement not reached.
                      var63.foo();
                      ^
      test100.java:629: Variable var63 may not have been initialized.
                      var63.foo();
                      ^
      test100.java:630: Statement not reached.
                      test64 var64 = new test64();
                      ^
      3 errors

      TEST CASE
      ---------
      class test1 {
      void foo () {
      System.out.println("test1");
      }
      }
      class test2 {
      void foo () {
      System.out.println("test2");
      }
      }
      class test3 {
      void foo () {
      System.out.println("test3");
      }
      }
      class test4 {
      void foo () {
      System.out.println("test4");
      }
      }
      class test5 {
      void foo () {
      System.out.println("test5");
      }
      }
      class test6 {
      void foo () {
      System.out.println("test6");
      }
      }
      class test7 {
      void foo () {
      System.out.println("test7");
      }
      }
      class test8 {
      void foo () {
      System.out.println("test8");
      }
      }
      class test9 {
      void foo () {
      System.out.println("test9");
      }
      }
      class test10 {
      void foo () {
      System.out.println("test10");
      }
      }
      class test11 {
      void foo () {
      System.out.println("test11");
      }
      }
      class test12 {
      void foo () {
      System.out.println("test12");
      }
      }
      class test13 {
      void foo () {
      System.out.println("test13");
      }
      }
      class test14 {
      void foo () {
      System.out.println("test14");
      }
      }
      class test15 {
      void foo () {
      System.out.println("test15");
      }
      }
      class test16 {
      void foo () {
      System.out.println("test16");
      }
      }
      class test17 {
      void foo () {
      System.out.println("test17");
      }
      }
      class test18 {
      void foo () {
      System.out.println("test18");
      }
      }
      class test19 {
      void foo () {
      System.out.println("test19");
      }
      }
      class test20 {
      void foo () {
      System.out.println("test20");
      }
      }
      class test21 {
      void foo () {
      System.out.println("test21");
      }
      }
      class test22 {
      void foo () {
      System.out.println("test22");
      }
      }
      class test23 {
      void foo () {
      System.out.println("test23");
      }
      }
      class test24 {
      void foo () {
      System.out.println("test24");
      }
      }
      class test25 {
      void foo () {
      System.out.println("test25");
      }
      }
      class test26 {
      void foo () {
      System.out.println("test26");
      }
      }
      class test27 {
      void foo () {
      System.out.println("test27");
      }
      }
      class test28 {
      void foo () {
      System.out.println("test28");
      }
      }
      class test29 {
      void foo () {
      System.out.println("test29");
      }
      }
      class test30 {
      void foo () {
      System.out.println("test30");
      }
      }
      class test31 {
      void foo () {
      System.out.println("test31");
      }
      }
      class test32 {
      void foo () {
      System.out.println("test32");
      }
      }
      class test33 {
      void foo () {
      System.out.println("test33");
      }
      }
      class test34 {
      void foo () {
      System.out.println("test34");
      }
      }
      class test35 {
      void foo () {
      System.out.println("test35");
      }
      }
      class test36 {
      void foo () {
      System.out.println("test36");
      }
      }
      class test37 {
      void foo () {
      System.out.println("test37");
      }
      }
      class test38 {
      void foo () {
      System.out.println("test38");
      }
      }
      class test39 {
      void foo () {
      System.out.println("test39");
      }
      }
      class test40 {
      void foo () {
      System.out.println("test40");
      }
      }
      class test41 {
      void foo () {
      System.out.println("test41");
      }
      }
      class test42 {
      void foo () {
      System.out.println("test42");
      }
      }
      class test43 {
      void foo () {
      System.out.println("test43");
      }
      }
      class test44 {
      void foo () {
      System.out.println("test44");
      }
      }
      class test45 {
      void foo () {
      System.out.println("test45");
      }
      }
      class test46 {
      void foo () {
      System.out.println("test46");
      }
      }
      class test47 {
      void foo () {
      System.out.println("test47");
      }
      }
      class test48 {
      void foo () {
      System.out.println("test48");
      }
      }
      class test49 {
      void foo () {
      System.out.println("test49");
      }
      }
      class test50 {
      void foo () {
      System.out.println("test50");
      }
      }
      class test51 {
      void foo () {
      System.out.println("test51");
      }
      }
      class test52 {
      void foo () {
      System.out.println("test52");
      }
      }
      class test53 {
      void foo () {
      System.out.println("test53");
      }
      }
      class test54 {
      void foo () {
      System.out.println("test54");
      }
      }
      class test55 {
      void foo () {
      System.out.println("test55");
      }
      }
      class test56 {
      void foo () {
      System.out.println("test56");
      }
      }
      class test57 {
      void foo () {
      System.out.println("test57");
      }
      }
      class test58 {
      This field was too long for bugtraq+ and has been archived
      The field has been made an attachmentas "fieldname".bugid
      The first 20000 bytes are available here

      compiler gives bogus error with constuctor with 100 parameters

      I get the following error:

      p5test100.java:3: Statement not reached.
              test1 (test1 x1

      TESTCASE
      --------
      class test1 {
      test1() {}
      test1 (test1 x1
      ,test1 x2
      ,test1 x3
      ,test1 x4
      ,test1 x5
      ,test1 x6
      ,test1 x7
      ,test1 x8
      ,test1 x9
      ,test1 x10
      ,test1 x11
      ,test1 x12
      ,test1 x13
      ,test1 x14
      ,test1 x15
      ,test1 x16
      ,test1 x17
      ,test1 x18
      ,test1 x19
      ,test1 x20
      ,test1 x21
      ,test1 x22
      ,test1 x23
      ,test1 x24
      ,test1 x25
      ,test1 x26
      ,test1 x27
      ,test1 x28
      ,test1 x29
      ,test1 x30
      ,test1 x31
      ,test1 x32
      ,test1 x33
      ,test1 x34
      ,test1 x35
      ,test1 x36
      ,test1 x37
      ,test1 x38
      ,test1 x39
      ,test1 x40
      ,test1 x41
      ,test1 x42
      ,test1 x43
      ,test1 x44
      ,test1 x45
      ,test1 x46
      ,test1 x47
      ,test1 x48
      ,test1 x49
      ,test1 x50
      ,test1 x51
      ,test1 x52
      ,test1 x53
      ,test1 x54
      ,test1 x55
      ,test1 x56
      ,test1 x57
      ,test1 x58
      ,test1 x59
      ,test1 x60
      ,test1 x61
      ,test1 x62
      ,test1 x63
      ,test1 x64
      ,test1 x65
      ,test1 x66
      ,test1 x67
      ,test1 x68
      ,test1 x69
      ,test1 x70
      ,test1 x71
      ,test1 x72
      ,test1 x73
      ,test1 x74
      ,test1 x75
      ,test1 x76
      ,test1 x77
      ,test1 x78
      ,test1 x79
      ,test1 x80
      ,test1 x81
      ,test1 x82
      ,test1 x83
      ,test1 x84
      ,test1 x85
      ,test1 x86
      ,test1 x87
      ,test1 x88
      ,test1 x89
      ,test1 x90
      ,test1 x91
      ,test1 x92
      ,test1 x93
      ,test1 x94
      ,test1 x95
      ,test1 x96
      ,test1 x97
      ,test1 x98
      ,test1 x99
      ,test1 x100
      ) {
      System.out.println("test100");
      }
      }

      class test {
      public static void main (String args[]) {
      test1 varx = new test1(new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      ,new test1()
      );
      }
      }

      The description field as copied from bug report 1240530 follows:

      Compiler should allow more than 63 local variables.

      Steps to reproduce
      Compile the attached code

      class LocalVarTest
      {
         public static void main(String argv[])
         {
            int i1 = 1;
            int i2 = 2;
            int i3 = 3;
            int i4 = 4;
            int i5 = 5;
            int i6 = 6;
            int i7 = 7;
            int i8 = 8;
            int i9 = 9;
            int i10 = 10;
            int i11 = 11;
            int i12 = 12;
            int i13 = 13;
            int i14 = 14;
            int i15 = 15;
            int i16 = 16;
            int i17 = 17;
            int i18 = 18;
            int i19 = 19;
            int i20 = 20;
            int i21 = 21;
            int i22 = 22;
            int i23 = 23;
            int i24 = 24;
            int i25 = 25;
            int i26 = 26;
            int i27 = 27;
            int i28 = 28;
            int i29 = 29;
            int i30 = 30;
            int i31 = 31;
            int i32 = 32;
            int i33 = 33;
            int i34 = 34;
            int i35 = 35;
            int i36 = 36;
            int i37 = 37;
            int i38 = 38;
            int i39 = 39;
            int i40 = 40;
            int i41 = 41;
            int i42 = 42;
            int i43 = 43;
            int i44 = 44;
            int i45 = 45;
            int i46 = 46;
            int i47 = 47;
            int i48 = 48;
            int i49 = 49;
            int i50 = 50;
            int i51 = 51;
            int i52 = 52;
            int i53 = 53;
            int i54 = 54;
            int i55 = 55;
            int i56 = 56;
            int i57 = 57;
            int i58 = 58;
            int i59 = 59;
            int i60 = 60;
            int i61 = 61;
            int i62 = 62;
            int i63 = 63;
            int i64 = 64;

         }
      }


      Actually, 32 doubles do the same thing.

      The description field as copied from bug report 1243008 follows:

      Following test case uses array of doubles with length 65.
      When compiled with javac , compiler gives following error messages.

      The strange thing to notice is, the compiler compiles the testcase if I change
      the array dimension to 93 or 96. But it does not like arrays of length 94 and 95.

      $ javac t95.java
      t95.java:6: Statement not reached.
      for ( int i=0; i < arr.length; i++ ) {
      ^
      t95.java:7: Variable max_value may not have been initialized.
      if ( arr[i] > max_value )
                    ^
      t95.java:8: Statement not reached.
      max_value = arr[i] ;
      ^
      t95.java:10: Variable max_value may not have been initialized.
      return max_value ;
             ^
      4 errors

      $ cat t95.java
      // test for arrays of double and function calls that return double
      public class t95 {
      public static double max ( double val0, double val1, double val2, double val3, double val4, double val5, double val6, double val7, double val8, double val9, double val10, double val11, double val12, double val13, double val14, double val15, double val16, double val17, double val18, double val19, double val20, double val21, double val22, double val23, double val24, double val25, double val26, double val27, double val28, double val29, double val30, double val31, double val32, double val33, double val34, double val35, double val36, double val37, double val38, double val39, double val40, double val41, double val42, double val43, double val44, double val45, double val46, double val47, double val48, double val49, double val50, double val51, double val52, double val53, double val54, double val55, double val56, double val57, double val58, double val59, double val60, double val61, double val62, double val63, double val64, double val65, double val66, double val67, double val68, double val69, double val70, double val71, double val72, double val73, double val74, double val75, double val76, double val77, double val78, double val79, double val80, double val81, double val82, double val83, double val84, double val85, double val86, double val87, double val88, double val89, double val90, double val91, double val92, double val93 , double val94) {
      double arr[] = { val0, val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12, val13, val14, val15, val16, val17, val18, val19, val20, val21, val22, val23, val24, val25, val26, val27, val28, val29, val30, val31, val32, val33, val34, val35, val36, val37, val38, val39, val40, val41, val42, val43, val44, val45, val46, val47, val48, val49, val50, val51, val52, val53, val54, val55, val56, val57, val58, val59, val60, val61, val62, val63, val64, val65, val66, val67, val68, val69, val70, val71, val72, val73, val74, val75, val76, val77, val78, val79, val80, val81, val82, val83, val84, val85, val86, val87, val88, val89, val90, val91, val92, val93 , val94} ;
      double max_value = arr[0] ;
      for ( int i=0; i < arr.length; i++ ) {
      if ( arr[i] > max_value )
      max_value = arr[i] ;
      }
      return max_value ;
      }

      public static void main(String argv[]) {
      double arr [] = { 0.0182753, 0.805326, 0.132989, 0.69735, 0.917442, 0.367528, 0.330729, 0.944153, 0.751429, 0.176508, 0.475757, 0.747609, 0.104801, 0.808441, 0.0816012, 0.159014, 0.475771, 0.47908, 0.481501, 0.0201901, 0.994218, 0.210765, 0.0618297, 0.697163, 0.968381, 0.446269, 0.201158, 0.6689, 0.57663, 0.488393, 0.356341, 0.474987, 0.270728, 0.394203, 0.98705, 0.776159, 0.706984, 0.202836, 0.26015, 0.531595, 0.271704, 0.625756, 0.72533, 0.546878, 0.517354, 0.57839, 0.40339, 0.896523, 0.0758229, 0.182036, 0.978597, 0.974995, 0.865217, 0.114953, 0.0365034, 0.180098, 0.656569, 0.441541, 0.538657, 0.482667, 0.316881, 0.298513, 0.975579, 0.386452, 0.294905, 0.0669681, 0.889445, 0.0321115, 0.166066, 0.909277, 0.707855, 0.449205, 0.302935, 0.799674, 0.0801047, 0.210117, 0.987653, 0.427469, 0.157374, 0.98979, 0.532724, 0.601796, 0.508218, 0.785197, 0.226574, 0.0367752, 0.610794, 0.798442, 0.170276, 0.646032, 0.113199, 0.237406, 0.321871, 0.725448 , 0.1 } ;

      System.out.println("Unsorted arr:");
      for (int i=0; i<arr.length; i++)
      System.out.print(arr[i] + " ");
      System.out.println();
      double max_value = max ( 0.0182753, 0.805326, 0.132989, 0.69735, 0.917442, 0.367528, 0.330729, 0.944153, 0.751429, 0.176508, 0.475757, 0.747609, 0.104801, 0.808441, 0.0816012, 0.159014, 0.475771, 0.47908, 0.481501, 0.0201901, 0.994218, 0.210765, 0.0618297, 0.697163, 0.968381, 0.446269, 0.201158, 0.6689, 0.57663, 0.488393, 0.356341, 0.474987, 0.270728, 0.394203, 0.98705, 0.776159, 0.706984, 0.202836, 0.26015, 0.531595, 0.271704, 0.625756, 0.72533, 0.546878, 0.517354, 0.57839, 0.40339, 0.896523, 0.0758229, 0.182036, 0.978597, 0.974995, 0.865217, 0.114953, 0.0365034, 0.180098, 0.656569, 0.441541, 0.538657, 0.482667, 0.316881, 0.298513, 0.975579, 0.386452, 0.294905, 0.0669681, 0.889445, 0.0321115, 0.166066, 0.909277, 0.707855, 0.449205, 0.302935, 0.799674, 0.0801047, 0.210117, 0.987653, 0.427469, 0.157374, 0.98979, 0.532724, 0.601796, 0.508218, 0.785197, 0.226574, 0.0367752, 0.610794, 0.798442, 0.170276, 0.646032, 0.113199, 0.237406, 0.321871, 0.725448 , 0.1) ;
      System.out.println("max value=" + max_value);
      }
      }

      The description field as copied from bug report 1239048 follows:

      The Java compiler produces wrong error messages for the correct Java
      program. The effect appears only when the number of parameters and assignments
      is more than 63 ( 2**6-1 ??? :-) ).

      > /usr/local/java/1.0/bin/javac clss021.java
      clss021.java:70: Statement not reached.
      int f(int x , int p00, int p01, int p02, int p03, int p04, int p05, int p06, int p07, int p08, int p09, int p10, int p11, int p12, int p13, int p14, int p15, int p16, int p17, int p18, int p19, int p20, int p21, int p22, int p23, int p24, int p25, int p26, int p27, int p28, int p29, int p30, int p31, int p32, int p33, int p34, int p35, int p36, int p37, int p38, int p39, int p40, int p41, int p42, int p43, int p44, int p45, int p46, int p47, int p48, int p49, int p50, int p51, int p52, int p53, int p54, int p55, int p56, int p57, int p58, int p59, int p60, int p61) {
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^
      clss021.java:132: Variable p61 may not have been initialized.
         p61 += p60;
         ^
      clss021.java:134: Statement not reached.
         return p61;
         ^
      clss021.java:134: Variable p61 may not have been initialized.
         return p61;
                ^
      4 errors


      ---------------------------------clss021.java------------------------
      // Ident: @(#)clss021.java 1.1 96/01/14
      // Copyright 14 Jan 1996 Sun Microsystems, Inc. All Rights Reserved

      class clss021_a {
      int f(int x , int p00, int p01, int p02, int p03, int p04, int p05, int p06, int p07, int p08, int p09, int p10, int p11, int p12, int p13, int p14, int p15, int p16, int p17, int p18, int p19, int p20, int p21, int p22, int p23, int p24, int p25, int p26, int p27, int p28, int p29, int p30, int p31, int p32, int p33, int p34, int p35, int p36, int p37, int p38, int p39, int p40, int p41, int p42, int p43, int p44, int p45, int p46, int p47, int p48, int p49, int p50, int p51, int p52, int p53, int p54, int p55, int p56, int p57, int p58, int p59, int p60) {
         p00 += x;
         p01 += p00;
         p02 += p01;
         p03 += p02;
         p04 += p03;
         p05 += p04;
         p06 += p05;
         p07 += p06;
         p08 += p07;
         p09 += p08;
         p10 += p09;
         p11 += p10;
         p12 += p11;
         p13 += p12;
         p14 += p13;
         p15 += p14;
         p16 += p15;
         p17 += p16;
         p18 += p17;
         p19 += p18;
         p20 += p19;
         p21 += p20;
         p22 += p21;
         p23 += p22;
         p24 += p23;
         p25 += p24;
         p26 += p25;
         p27 += p26;
         p28 += p27;
         p29 += p28;
         p30 += p29;
         p31 += p30;
         p32 += p31;
         p33 += p32;
         p34 += p33;
         p35 += p34;
         p36 += p35;
         p37 += p36;
         p38 += p37;
         p39 += p38;
         p40 += p39;
         p41 += p40;
         p42 += p41;
         p43 += p42;
         p44 += p43;
         p45 += p44;
         p46 += p45;
         p47 += p46;
         p48 += p47;
         p49 += p48;
         p50 += p49;
         p51 += p50;
         p52 += p51;
         p53 += p52;
         p54 += p53;
         p55 += p54;
         p56 += p55;
         p57 += p56;
         p58 += p57;
         p59 += p58;
         p60 += p59;
         return p60;
      }

      int f(int x , int p00, int p01, int p02, int p03, int p04, int p05, int p06, int p07, int p08, int p09, int p10, int p11, int p12, int p13, int p14, int p15, int p16, int p17, int p18, int p19, int p20, int p21, int p22, int p23, int p24, int p25, int p26, int p27, int p28, int p29, int p30, int p31, int p32, int p33, int p34, int p35, int p36, int p37, int p38, int p39, int p40, int p41, int p42, int p43, int p44, int p45, int p46, int p47, int p48, int p49, int p50, int p51, int p52, int p53, int p54, int p55, int p56, int p57, int p58, int p59, int p60, int p61) {
         p00 += x;
         p01 += p00;
         p02 += p01;
         p03 += p02;
         p04 += p03;
         p05 += p04;
         p06 += p05;
         p07 += p06;
         p08 += p07;
         p09 += p08;
         p10 += p09;
         p11 += p10;
         p12 += p11;
         p13 += p12;
         p14 += p13;
         p15 += p14;
         p16 += p15;
         p17 += p16;
         p18 += p17;
         p19 += p18;
         p20 += p19;
         p21 += p20;
         p22 += p21;
         p23 += p22;
         p24 += p23;
         p25 += p24;
         p26 += p25;
         p27 += p26;
         p28 += p27;
         p29 += p28;
         p30 += p29;
         p31 += p30;
         p32 += p31;
         p33 += p32;
         p34 += p33;
         p35 += p34;
         p36 += p35;
         p37 += p36;
         p38 += p37;
         p39 += p38;
         p40 += p39;
         p41 += p40;
         p42 += p41;
         p43 += p42;
         p44 += p43;
         p45 += p44;
         p46 += p45;
         p47 += p46;
         p48 += p47;
         p49 += p48;
         p50 += p49;
         p51 += p50;
         p52 += p51;
         p53 += p52;
         p54 += p53;
         p55 += p54;
         p56 += p55;
         p57 += p56;
         p58 += p57;
         p59 += p58;
         p60 += p59;
         p61 += p60;

         return p61;
      }

      void test60() {
            int sum, correct_sum = 60*61/2;
            sum = f(0 , 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60);
            if (sum != correct_sum) {
             System.out.println("Error: sum != correct_sum : " + sum + " != " + correct_sum);
            }
      }
      void test

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                fyellinsunw Frank Yellin (Inactive)
                Reporter:
                hwilliamsunw Headley Williamson (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: