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

Verify error due to incorrect optimizations with null #8233

Closed
scabug opened this issue Feb 4, 2014 · 5 comments
Closed

Verify error due to incorrect optimizations with null #8233

scabug opened this issue Feb 4, 2014 · 5 comments

Comments

@scabug
Copy link

scabug commented Feb 4, 2014

Scala plugin sources (https://github.com/JetBrains/intellij-scala), we just tried to migrate to Scala 2.11.

Bad type on operand stack
Exception Details:
Location:
org/jetbrains/plugins/scala/lang/formatting/getDummyBlocks$.applyInner(Lcom/intellij/lang/ASTNode;Lcom/intellij/lang/ASTNode;Lorg/jetbrains/plugins/scala/lang/formatting/ScalaBlock;)Ljava/util/ArrayList; @378: invokespecial
Reason:
Type 'scala/runtime/Null$' (current frame, stack[6]) is not assignable to 'com/intellij/formatting/Alignment'
Current Frame:
bci: @378
flags: { }
locals: { 'org/jetbrains/plugins/scala/lang/formatting/getDummyBlocks$', 'com/intellij/lang/ASTNode', 'com/intellij/lang/ASTNode', 'org/jetbrains/plugins/scala/lang/formatting/ScalaBlock', 'org/jetbrains/plugins/scala/lang/formatting/settings/ScalaCodeStyleSettings', 'java/util/ArrayList', 'com/intellij/formatting/Alignment', top, top, top, top, 'com/intellij/lang/ASTNode', 'com/intellij/formatting/Indent', 'scala/Tuple2', 'scala/Tuple2', 'scala/runtime/Null$', 'com/intellij/formatting/Wrap', 'scala/Tuple2', 'scala/runtime/Null$', 'com/intellij/formatting/Wrap' }
stack: { 'java/util/ArrayList', uninitialized 360, uninitialized 360, 'org/jetbrains/plugins/scala/lang/formatting/ScalaBlock', 'com/intellij/lang/ASTNode', null, 'scala/runtime/Null$', 'com/intellij/formatting/Indent', 'com/intellij/formatting/Wrap', 'com/intellij/psi/codeStyle/CodeStyleSettings' }
Bytecode:
0000000: 2db6 003b 123d b600 43c0 003d 3a04 bb00
0000010: 2459 b700 2b3a 0504 b801 463a 06b2 014b
0000020: 2bb9 00a1 0100 b601 519a 003d 2bb9 0055
0000030: 0100 c600 b92b b900 5501 00b9 00a1 0100
0000040: b200 bb3a 0759 c700 0c57 1907 c600 0ea7
0000050: 009c 1907 b600 ab99 0094 2bb9 0047 0100
0000060: c101 5399 0088 b201 58b2 015d b601 60c0
0000070: 0162 3a08 2b3a 0919 09b9 00fc 0100 1301
0000080: 64b6 0167 9900 112a 1909 1908 b601 6bb2
0000090: 0066 a700 0a19 0819 09b6 016f 5719 092c
00000a0: 3a0a 59c7 000c 5719 0ac6 002b a700 0b19
00000b0: 0ab6 00ab 9a00 20bb 0171 5919 09b9 00cf
00000c0: 0100 3a09 b200 6604 b800 f8b7 0174 b601
00000d0: 789a ffa6 1908 bb01 7a59 2b2d 1904 1905
00000e0: 1906 b701 7db6 017e a700 ee2b 3a0b b201
00000f0: 832d 190b b601 873a 0c2a 190b b601 8b99
0000100: 0091 190b b900 4701 00c1 018d 9a00 84bb
0000110: 0171 5901 b200 e12d 190b 1904 2db6 00e5
0000120: b600 e9b7 0174 3a0e 190e c600 5c19 0eb6
0000130: 0191 c001 933a 0f19 0eb6 0196 c001 983a
0000140: 10bb 0171 5919 0f19 10b7 0174 3a11 1911
0000150: 3a0d 190d b601 91c0 0193 3a12 190d b601
0000160: 96c0 0198 3a13 1905 bb00 3359 2d19 0b01
0000170: 1912 190c 1913 2db6 003b b700 ecb6 00ef
0000180: b800 f8a7 002b bb01 9a59 190e b701 9dbf
0000190: 2a19 0bb6 018b 9900 1519 052a 190b 2db7
00001a0: 01a0 b600 60b8 00f8 a700 06b2 0066 5719
00001b0: 0b2c 3a14 59c7 000c 5719 14c6 001b a700
00001c0: 0b19 14b6 00ab 9a00 1019 0bb9 00cf 0100
00001d0: 3a0b 049a ff1b 1905 b0
Stackmap Table:
full_frame(@82,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Object[#323]},{Object[#321]})
same_frame(@90)
chop_frame(@102,1)
append_frame(@119,Top,Object[#354],Object[#38])
same_frame(@149)
same_locals_1_stack_item_frame(@156,Object[#4])
full_frame(@175,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Object[#354],Object[#38],Object[#38]},{Object[#38]})
same_frame(@183)
same_frame(@212)
full_frame(@235,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117]},{})
full_frame(@238,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Top,Top,Top,Object[#38]},{})
append_frame(@390,Object[#216],Top,Object[#369])
chop_frame(@400,2)
same_frame(@427)
same_locals_1_stack_item_frame(@430,Object[#4])
full_frame(@449,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Top,Top,Top,Object[#38],Object[#216],Top,Top,Top,Top,Top,Top,Top,Object[#38]},{Object[#38]})
same_frame(@457)
full_frame(@470,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117]},{})
: Bad type on operand stack
Exception Details:
Location:
org/jetbrains/plugins/scala/lang/formatting/getDummyBlocks$.applyInner(Lcom/intellij/lang/ASTNode;Lcom/intellij/lang/ASTNode;Lorg/jetbrains/plugins/scala/lang/formatting/ScalaBlock;)Ljava/util/ArrayList; @378: invokespecial
Reason:
Type 'scala/runtime/Null$' (current frame, stack[6]) is not assignable to 'com/intellij/formatting/Alignment'
Current Frame:
bci: @378
flags: { }
locals: { 'org/jetbrains/plugins/scala/lang/formatting/getDummyBlocks$', 'com/intellij/lang/ASTNode', 'com/intellij/lang/ASTNode', 'org/jetbrains/plugins/scala/lang/formatting/ScalaBlock', 'org/jetbrains/plugins/scala/lang/formatting/settings/ScalaCodeStyleSettings', 'java/util/ArrayList', 'com/intellij/formatting/Alignment', top, top, top, top, 'com/intellij/lang/ASTNode', 'com/intellij/formatting/Indent', 'scala/Tuple2', 'scala/Tuple2', 'scala/runtime/Null$', 'com/intellij/formatting/Wrap', 'scala/Tuple2', 'scala/runtime/Null$', 'com/intellij/formatting/Wrap' }
stack: { 'java/util/ArrayList', uninitialized 360, uninitialized 360, 'org/jetbrains/plugins/scala/lang/formatting/ScalaBlock', 'com/intellij/lang/ASTNode', null, 'scala/runtime/Null$', 'com/intellij/formatting/Indent', 'com/intellij/formatting/Wrap', 'com/intellij/psi/codeStyle/CodeStyleSettings' }
Bytecode:
0000000: 2db6 003b 123d b600 43c0 003d 3a04 bb00
0000010: 2459 b700 2b3a 0504 b801 463a 06b2 014b
0000020: 2bb9 00a1 0100 b601 519a 003d 2bb9 0055
0000030: 0100 c600 b92b b900 5501 00b9 00a1 0100
0000040: b200 bb3a 0759 c700 0c57 1907 c600 0ea7
0000050: 009c 1907 b600 ab99 0094 2bb9 0047 0100
0000060: c101 5399 0088 b201 58b2 015d b601 60c0
0000070: 0162 3a08 2b3a 0919 09b9 00fc 0100 1301
0000080: 64b6 0167 9900 112a 1909 1908 b601 6bb2
0000090: 0066 a700 0a19 0819 09b6 016f 5719 092c
00000a0: 3a0a 59c7 000c 5719 0ac6 002b a700 0b19
00000b0: 0ab6 00ab 9a00 20bb 0171 5919 09b9 00cf
00000c0: 0100 3a09 b200 6604 b800 f8b7 0174 b601
00000d0: 789a ffa6 1908 bb01 7a59 2b2d 1904 1905
00000e0: 1906 b701 7db6 017e a700 ee2b 3a0b b201
00000f0: 832d 190b b601 873a 0c2a 190b b601 8b99
0000100: 0091 190b b900 4701 00c1 018d 9a00 84bb
0000110: 0171 5901 b200 e12d 190b 1904 2db6 00e5
0000120: b600 e9b7 0174 3a0e 190e c600 5c19 0eb6
0000130: 0191 c001 933a 0f19 0eb6 0196 c001 983a
0000140: 10bb 0171 5919 0f19 10b7 0174 3a11 1911
0000150: 3a0d 190d b601 91c0 0193 3a12 190d b601
0000160: 96c0 0198 3a13 1905 bb00 3359 2d19 0b01
0000170: 1912 190c 1913 2db6 003b b700 ecb6 00ef
0000180: b800 f8a7 002b bb01 9a59 190e b701 9dbf
0000190: 2a19 0bb6 018b 9900 1519 052a 190b 2db7
00001a0: 01a0 b600 60b8 00f8 a700 06b2 0066 5719
00001b0: 0b2c 3a14 59c7 000c 5719 14c6 001b a700
00001c0: 0b19 14b6 00ab 9a00 1019 0bb9 00cf 0100
00001d0: 3a0b 049a ff1b 1905 b0
Stackmap Table:
full_frame(@82,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Object[#323]},{Object[#321]})
same_frame(@90)
chop_frame(@102,1)
append_frame(@119,Top,Object[#354],Object[#38])
same_frame(@149)
same_locals_1_stack_item_frame(@156,Object[#4])
full_frame(@175,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Object[#354],Object[#38],Object[#38]},{Object[#38]})
same_frame(@183)
same_frame(@212)
full_frame(@235,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117]},{})
full_frame(@238,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Top,Top,Top,Object[#38]},{})
append_frame(@390,Object[#216],Top,Object[#369])
chop_frame(@400,2)
same_frame(@427)
same_locals_1_stack_item_frame(@430,Object[#4])
full_frame(@449,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Top,Top,Top,Object[#38],Object[#216],Top,Top,Top,Top,Top,Top,Top,Object[#38]},{Object[#38]})
same_frame(@457)
full_frame(@470,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117]},{})

java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
org/jetbrains/plugins/scala/lang/formatting/getDummyBlocks$.applyInner(Lcom/intellij/lang/ASTNode;Lcom/intellij/lang/ASTNode;Lorg/jetbrains/plugins/scala/lang/formatting/ScalaBlock;)Ljava/util/ArrayList; @378: invokespecial
Reason:
Type 'scala/runtime/Null$' (current frame, stack[6]) is not assignable to 'com/intellij/formatting/Alignment'
Current Frame:
bci: @378
flags: { }
locals: { 'org/jetbrains/plugins/scala/lang/formatting/getDummyBlocks$', 'com/intellij/lang/ASTNode', 'com/intellij/lang/ASTNode', 'org/jetbrains/plugins/scala/lang/formatting/ScalaBlock', 'org/jetbrains/plugins/scala/lang/formatting/settings/ScalaCodeStyleSettings', 'java/util/ArrayList', 'com/intellij/formatting/Alignment', top, top, top, top, 'com/intellij/lang/ASTNode', 'com/intellij/formatting/Indent', 'scala/Tuple2', 'scala/Tuple2', 'scala/runtime/Null$', 'com/intellij/formatting/Wrap', 'scala/Tuple2', 'scala/runtime/Null$', 'com/intellij/formatting/Wrap' }
stack: { 'java/util/ArrayList', uninitialized 360, uninitialized 360, 'org/jetbrains/plugins/scala/lang/formatting/ScalaBlock', 'com/intellij/lang/ASTNode', null, 'scala/runtime/Null$', 'com/intellij/formatting/Indent', 'com/intellij/formatting/Wrap', 'com/intellij/psi/codeStyle/CodeStyleSettings' }
Bytecode:
0000000: 2db6 003b 123d b600 43c0 003d 3a04 bb00
0000010: 2459 b700 2b3a 0504 b801 463a 06b2 014b
0000020: 2bb9 00a1 0100 b601 519a 003d 2bb9 0055
0000030: 0100 c600 b92b b900 5501 00b9 00a1 0100
0000040: b200 bb3a 0759 c700 0c57 1907 c600 0ea7
0000050: 009c 1907 b600 ab99 0094 2bb9 0047 0100
0000060: c101 5399 0088 b201 58b2 015d b601 60c0
0000070: 0162 3a08 2b3a 0919 09b9 00fc 0100 1301
0000080: 64b6 0167 9900 112a 1909 1908 b601 6bb2
0000090: 0066 a700 0a19 0819 09b6 016f 5719 092c
00000a0: 3a0a 59c7 000c 5719 0ac6 002b a700 0b19
00000b0: 0ab6 00ab 9a00 20bb 0171 5919 09b9 00cf
00000c0: 0100 3a09 b200 6604 b800 f8b7 0174 b601
00000d0: 789a ffa6 1908 bb01 7a59 2b2d 1904 1905
00000e0: 1906 b701 7db6 017e a700 ee2b 3a0b b201
00000f0: 832d 190b b601 873a 0c2a 190b b601 8b99
0000100: 0091 190b b900 4701 00c1 018d 9a00 84bb
0000110: 0171 5901 b200 e12d 190b 1904 2db6 00e5
0000120: b600 e9b7 0174 3a0e 190e c600 5c19 0eb6
0000130: 0191 c001 933a 0f19 0eb6 0196 c001 983a
0000140: 10bb 0171 5919 0f19 10b7 0174 3a11 1911
0000150: 3a0d 190d b601 91c0 0193 3a12 190d b601
0000160: 96c0 0198 3a13 1905 bb00 3359 2d19 0b01
0000170: 1912 190c 1913 2db6 003b b700 ecb6 00ef
0000180: b800 f8a7 002b bb01 9a59 190e b701 9dbf
0000190: 2a19 0bb6 018b 9900 1519 052a 190b 2db7
00001a0: 01a0 b600 60b8 00f8 a700 06b2 0066 5719
00001b0: 0b2c 3a14 59c7 000c 5719 14c6 001b a700
00001c0: 0b19 14b6 00ab 9a00 1019 0bb9 00cf 0100
00001d0: 3a0b 049a ff1b 1905 b0
Stackmap Table:
full_frame(@82,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Object[#323]},{Object[#321]})
same_frame(@90)
chop_frame(@102,1)
append_frame(@119,Top,Object[#354],Object[#38])
same_frame(@149)
same_locals_1_stack_item_frame(@156,Object[#4])
full_frame(@175,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Object[#354],Object[#38],Object[#38]},{Object[#38]})
same_frame(@183)
same_frame(@212)
full_frame(@235,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117]},{})
full_frame(@238,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Top,Top,Top,Object[#38]},{})
append_frame(@390,Object[#216],Top,Object[#369])
chop_frame(@400,2)
same_frame(@427)
same_locals_1_stack_item_frame(@430,Object[#4])
full_frame(@449,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117],Top,Top,Top,Top,Object[#38],Object[#216],Top,Top,Top,Top,Top,Top,Top,Object[#38]},{Object[#38]})
same_frame(@457)
full_frame(@470,{Object[#2],Object[#38],Object[#38],Object[#51],Object[#61],Object[#36],Object[#117]},{})

at org.jetbrains.plugins.scala.lang.formatting.ScalaBlock.getSubBlocks(ScalaBlock.scala:119)
at com.intellij.formatting.InitialInfoBuilder.buildFrom(InitialInfoBuilder.java:176)
at com.intellij.formatting.InitialInfoBuilder.prepareToBuildBlocksSequentially(InitialInfoBuilder.java:94)
at com.intellij.formatting.FormatProcessor$WrapBlocksState.<init>(FormatProcessor.java:1298)
at com.intellij.formatting.FormatProcessor.<init>(FormatProcessor.java:174)
at com.intellij.formatting.FormatterImpl.buildProcessorAndWrapBlocks(FormatterImpl.java:431)
at com.intellij.formatting.FormatterImpl.adjustLineIndent(FormatterImpl.java:371)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$5.doPerform(CodeStyleManagerImpl.java:358)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$5.doPerform(CodeStyleManagerImpl.java:355)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerRunnable.perform(CodeStyleManagerRunnable.java:112)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.doAdjustLineIndentByOffset(CodeStyleManagerImpl.java:355)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.access$500(CodeStyleManagerImpl.java:60)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$3.compute(CodeStyleManagerImpl.java:318)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$3.compute(CodeStyleManagerImpl.java:315)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:116)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.adjustLineIndent(CodeStyleManagerImpl.java:315)
at com.intellij.codeInsight.editorActions.EnterHandler$DoEnterAction.run(EnterHandler.java:422)
at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteActionInner(EnterHandler.java:169)
at com.intellij.codeInsight.editorActions.EnterHandler.access$000(EnterHandler.java:53)
at com.intellij.codeInsight.editorActions.EnterHandler$1.run(EnterHandler.java:74)
at com.intellij.psi.impl.source.PostprocessReformattingAspect$2.compute(PostprocessReformattingAspect.java:107)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:116)
at com.intellij.psi.impl.source.PostprocessReformattingAspect.disablePostprocessFormattingInside(PostprocessReformattingAspect.java:104)
at com.intellij.codeInsight.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:71)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:54)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:984)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.execute(EditorWriteActionHandler.java:37)
at com.intellij.codeInsight.template.impl.editorActions.EnterHandler.executeWriteAction(EnterHandler.java:51)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(EditorWriteActionHandler.java:54)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:984)
at com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.execute(EditorWriteActionHandler.java:37)
at com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.java:83)
at com.intellij.openapi.command.impl.CommandProcessorImpl.executeCommand(CommandProcessorImpl.java:124)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:94)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:68)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$3.performAction(IdeKeyEventDispatcher.java:564)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:611)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:463)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:206)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:493)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:335)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
@scabug
Copy link
Author

scabug commented Feb 4, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8233?orig=1
Reporter: @Alefas
Affected Versions: 2.11.0-M8
See #7015

@scabug
Copy link
Author

scabug commented Feb 4, 2014

@retronym said:
Minimized:

scala> object Test { def bar(s: String) = s; def foo { val (a, b) = (null, ""); bar(a) }}
defined object Test

scala> Test
java.lang.VerifyError: (class: Test$, method: foo signature: ()V) Incompatible argument to function
  ... 32 elided

@scabug
Copy link
Author

scabug commented Feb 4, 2014

@retronym said:
Regressed in #7015 / 1b6661b8b586637ba5d54510c7bda1144acab23b

@scabug
Copy link
Author

scabug commented Feb 4, 2014

@retronym said:
Smaller:

class Test {
  def bar(s: String) = s; 
  def foo {
    val a: Null = Some[Null](null).get
    bar(a)
  }
}

@scabug
Copy link
Author

scabug commented Feb 4, 2014

@retronym said:
scala/scala#3462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants