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

CharacterRangeTable: incorrect number of branches in the conditional operator

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      beta2
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description



      Name: poR10007 Date: 07/20/2001



      Javac (jdk1.4.0beta-b72) when running in -Xjcov mode misses some
      CharacterRangeTable branch entries if the conditional operator
      is used as a flow controlling expression.

      The following test demonstrates the bug:

      --Test.java---------------------------------------
      public class Test {
          public static void main (String[] args) {
      boolean t = true, b = false, c = true;
      if (t ? b : c) ;
          }
      }
      --------------------------------------------------

      For the if-statement of the test javac produces bytecodes with three
      branches:

      6: iload_1; // flow controller 't'
      7: ifeq 17; // branch for the condition 't'
      10: iload_2; // flow target 'b' (in a sense, 'b' also is
                                       // a flow controller for the if-statement)
      11: ifeq 21; // branch for the condition 'b' (missed in
                                       // CharacterRangeTable !!!)
      14: goto 21; // bypass false part of the expression
      17: iload_3; // flow target 'c' (in a sense, 'c' also is
                                       // a flow controller for the if-statement)
      18: ifeq 21; // branch for the condition 'c'

      but CharacterRangeTable attribute contains only two entries of CRT_BRANCH_xxx
      type - one per each CRT_FLOW_CONTROLLER entry: 't' and 't ? b : c'.

      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            gafter Neal Gafter
            Reporter:
            passunw Pas Pas (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: