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

Compiler is inconsistent: recompiling same source produces different output

    XMLWordPrintable

Details

    • 1.1
    • sparc
    • solaris_2.5
    • Not verified

    Description

      The 1.0.2 javac compiler doesn't produce an identical output file every time (for exactly the same source code). Things that make the output vary include compiling source files in different orders or giving source files in a different order on the command line to javac. The output file differences don't appear to be important. I analyzed two output files from the same source file and the only differences were in the order of symbols in the symbol table.

      It would be good if the compiler produced the same output every time. I'm trying to reproduce some subtle compiler bugs, and it's very difficult because I can't use diff to determine when and if a class file is bad; it reports lots of differences every time, even though the code produced has identical effect.

      I think it would be easy to modify the compiler to produce the symbol table in the same order every time: just sort it on the type and on the order in the source file. Or perhaps on the type and on the contents of the symbol record. Or perhaps just on the contents of the symbol record.

      By the way, I noticed that lots of symbols were getting included that weren't referenced anywhere. The file I looked at had 3 unused attribute names and 2 unused class records (each with an associated string) for a total of 7 out of 22 symbols.

      Attachments

        Activity

          People

            busersunw Btplusnull User (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: