Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8278834: Error "Cannot read field "sym" because "this.lvar[od]" is null" when compiling #1141

Closed
wants to merge 2 commits into from

Conversation

Glavo
Copy link
Contributor

@Glavo Glavo commented Feb 1, 2023


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8278834: Error "Cannot read field "sym" because "this.lvar[od]" is null" when compiling

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/1141/head:pull/1141
$ git checkout pull/1141

Update a local copy of the PR:
$ git checkout pull/1141
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/1141/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1141

View PR using the GUI difftool:
$ git pr show -t 1141

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/1141.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 1, 2023

👋 Welcome back Glavo! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title Backport be0538d7c8e2cbfa599dbcb4c5c69533678a8421 8278834: Error "Cannot read field "sym" because "this.lvar[od]" is null" when compiling Feb 1, 2023
@openjdk
Copy link

openjdk bot commented Feb 1, 2023

This backport pull request has now been updated with issue from the original commit.

@openjdk
Copy link

openjdk bot commented Feb 1, 2023

@Glavo This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8278834: Error "Cannot read field "sym" because "this.lvar[od]" is null" when compiling

Reviewed-by: phh

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 18 new commits pushed to the master branch:

  • ac655ba: 8304880: [PPC64] VerifyOops code in C1 doesn't work with ZGC
  • 0f72c30: 8278434: timeouts in test java/time/test/java/time/format/TestZoneTextPrinterParser.java
  • 1253eb4: 8291638: Keep-Alive timeout of 0 should close connection immediately
  • f53661b: 8282227: Locale information for nb is not working properly
  • 590256d: 8275721: Name of UTC timezone in a locale changes depending on previous code
  • 8bc5ad1: 8304671: javac regression: Compilation with --release 8 fails on underscore in enum identifiers
  • a71545b: 8291226: Create Test Cases to cover scenarios for JDK-8278067
  • ec7f169: 8291637: HttpClient default keep alive timeout not followed if server sends invalid value
  • 59d8211: 8287541: Files.writeString fails to throw IOException for charset "windows-1252"
  • 6ba50fc: 8286287: Reading file as UTF-16 causes Error which "shouldn't happen"
  • ... and 8 more: https://git.openjdk.org/jdk17u-dev/compare/3b64bdeaba38beee93e240d9b3f236dd160e4425...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@phohensee) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added ready Pull request is ready to be integrated rfr Pull request is ready for review labels Feb 1, 2023
@Glavo
Copy link
Contributor Author

Glavo commented Feb 1, 2023

/integrate

@mlbridge
Copy link

mlbridge bot commented Feb 1, 2023

Webrevs

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Feb 1, 2023
@openjdk
Copy link

openjdk bot commented Feb 1, 2023

@Glavo
Your change (at version 07e9fe4) is now ready to be sponsored by a Committer.

@phohensee
Copy link
Member

@Glavo, please add a note describing the reason for the backport, testing, and risk.

@Glavo
Copy link
Contributor Author

Glavo commented Feb 1, 2023

@phohensee

javac crashed when we compiled the following code using JDK 17:

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Integer b = 1;
        new Main(b) {
            private final List<String> list = this.o instanceof Integer i ? new ArrayList<String>(i) : new ArrayList<String>();
        }.run();
    }

    protected final Object o;

    public Main(Object o) {
        this.o = o;
    }

    public void run() {

    }
}

javac output:

An exception has occurred in the compiler (17.0.6). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.NullPointerException: Cannot read field "sym" because "this.lvar[od]" is null
        at jdk.compiler/com.sun.tools.javac.jvm.Code.emitop1w(Code.java:956)
        at jdk.compiler/com.sun.tools.javac.jvm.Items$LocalItem.load(Items.java:401)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genArgs(Gen.java:902)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitNewClass(Gen.java:1967)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1852)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:877)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2316)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2450)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:877)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1875)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1797)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:877)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitExec(Gen.java:1748)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1584)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:610)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:645)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:631)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:682)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1097)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1091)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:610)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:645)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:967)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:930)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:921)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:610)
        at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2420)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:737)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1617)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1585)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:946)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:317)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
        at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
        at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:50)
printing javac parameters to: /mnt/d/Downloads/javac.20230202_005046.args

This backport is to fix this problem. I think there are no known risks.

What tests should I run for javac?

@phohensee
Copy link
Member

Thank you for the info. The langtools tier1 tests would be the right ones to use. These are run as part of pre-submit testing, which should be configured on your repo (click on "Details" on the left of Pre-submit test status". Also, did the backport fix the crash? I assume it did, but that needs to be stated. I've tagged the JBS issue on your behalf.

@Glavo
Copy link
Contributor Author

Glavo commented Feb 1, 2023

Thank you for the info. The langtools tier1 tests would be the right ones to use. These are run as part of pre-submit testing, which should be configured on your repo (click on "Details" on the left of Pre-submit test status". Also, did the backport fix the crash? I assume it did, but that needs to be stated. I've tagged the JBS issue on your behalf.

I ran and passed the pre-submit test.

@phohensee
Copy link
Member

Excellent, thank you. Now we wait for maintainer approval. Once we have that, I can sponsor.

@GoeLin
Copy link
Member

GoeLin commented Feb 3, 2023

Hi Glavo,
Please don't integrate as long as you don't have the fix-yes tag on the JBS issue!!! I'll block this by asking for a review.
Passing Pre-submit tests is only a minimal test precondition. You should run additional tests to test the fix and to assure there are no regressions. E.g., all langtool tests, some compile jobs that stress javac etc.

Also, this is a 17.0.8 change. We are still working on 17.0.7. Usually, we keep these in-sync. Also, the fix is brand-new in head. Is there a good reason you need this in 17.0.7? I would prefer to wait for 17.0.8. See also the project homepage for the timetables.

@GoeLin
Copy link
Member

GoeLin commented Feb 3, 2023

/reviewer 1

@openjdk
Copy link

openjdk bot commented Feb 3, 2023

@GoeLin Only the author (@Glavo) is allowed to issue the reviewer command.

@GoeLin
Copy link
Member

GoeLin commented Feb 3, 2023

/reviewers 1

@openjdk
Copy link

openjdk bot commented Feb 3, 2023

@GoeLin
The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 1 (with at least 1 Reviewer).

@GoeLin
Copy link
Member

GoeLin commented Feb 3, 2023

Fixes to test can always be backported as they don't have an effect on the deliverable.

Copy link
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a javac expert, but this looks like a fix for a case where expected state (currentMethodSym) could be silently trashed, resulting in a later NPE. The code in tip is more complex, but retains the "restoration of state" idea in this code. Also, the patch includes a test (which passes) derived from the one attached to the original JBS issue.

@openjdk openjdk bot added ready Pull request is ready to be integrated and removed ready Pull request is ready to be integrated labels Feb 17, 2023
@bridgekeeper
Copy link

bridgekeeper bot commented Mar 18, 2023

@Glavo This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@phohensee
Copy link
Member

Re-tagged the JBS issue.

@GoeLin
Copy link
Member

GoeLin commented Mar 23, 2023

@Glavo, can you please merge head so that thye pre submit tests run?
Click on you branch at the top, then on "Sync fork".

@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Mar 23, 2023
@Glavo
Copy link
Contributor Author

Glavo commented Mar 23, 2023

@Glavo, can you please merge head so that thye pre submit tests run? Click on you branch at the top, then on "Sync fork".

Okay. I've been busy with some other things lately, so didn't work on this PR. I'll run the tests later.

Copy link
Member

@phohensee phohensee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review. Backport has been approved, I can sponsor as soon as I see /integrate.

@Glavo
Copy link
Contributor Author

Glavo commented Apr 2, 2023

I ran the tier1 and tier2 tests. Tier1 all passed. Two tests in tier2 failed, but none of them seemed to be related to this PR.

@Glavo
Copy link
Contributor Author

Glavo commented Apr 2, 2023

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Apr 2, 2023
@openjdk
Copy link

openjdk bot commented Apr 2, 2023

@Glavo
Your change (at version 2dd0fa2) is now ready to be sponsored by a Committer.

@phohensee
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Apr 3, 2023

Going to push as commit 47e4dba.
Since your change was applied there have been 18 commits pushed to the master branch:

  • ac655ba: 8304880: [PPC64] VerifyOops code in C1 doesn't work with ZGC
  • 0f72c30: 8278434: timeouts in test java/time/test/java/time/format/TestZoneTextPrinterParser.java
  • 1253eb4: 8291638: Keep-Alive timeout of 0 should close connection immediately
  • f53661b: 8282227: Locale information for nb is not working properly
  • 590256d: 8275721: Name of UTC timezone in a locale changes depending on previous code
  • 8bc5ad1: 8304671: javac regression: Compilation with --release 8 fails on underscore in enum identifiers
  • a71545b: 8291226: Create Test Cases to cover scenarios for JDK-8278067
  • ec7f169: 8291637: HttpClient default keep alive timeout not followed if server sends invalid value
  • 59d8211: 8287541: Files.writeString fails to throw IOException for charset "windows-1252"
  • 6ba50fc: 8286287: Reading file as UTF-16 causes Error which "shouldn't happen"
  • ... and 8 more: https://git.openjdk.org/jdk17u-dev/compare/3b64bdeaba38beee93e240d9b3f236dd160e4425...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Apr 3, 2023
@openjdk openjdk bot closed this Apr 3, 2023
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Apr 3, 2023
@openjdk
Copy link

openjdk bot commented Apr 3, 2023

@phohensee @Glavo Pushed as commit 47e4dba.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@Glavo Glavo deleted the JDK-8278834 branch April 3, 2023 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport clean integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants