You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Matias Bjarland (JIRA)" <ji...@apache.org> on 2015/08/07 13:47:45 UTC

[jira] [Comment Edited] (GROOVY-7542) CompileStatic class generation bug "register with message: rightShiftUnsigned and arguments X"

    [ https://issues.apache.org/jira/browse/GROOVY-7542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14661692#comment-14661692 ] 

Matias Bjarland edited comment on GROOVY-7542 at 8/7/15 11:46 AM:
------------------------------------------------------------------

An additional nugget of information on this issue. Pasting in my original (non simplified...kind of...left out the lengthy 'table' def) code: 

{code:language=groovy}
@CompileStatic
long crc64(File file) {
  long register = 0xfac432b10cd5e44aL
  def table = []

  int KB = 1024
  int MB = 1024*KB

  file.eachByte(MB) { byte[] buf, int bytesRead ->
    buf[0..(bytesRead-1)].each { long element -> 
      long tmp = register

      int t = (int) (tmp >>> 56 ^ element)
      tmp <<= 8
      tmp ^= table[t]    

      register = tmp
    } 
  }

  register
}
{code}

assigning the variable 'register' to  'tmp' and then performing the shift operations on 'tmp' resolves the issue. Performing the operations directly on 'register' above causes the same error as in the issue description. 


was (Author: mbjarland):
An additional nugget of information on this issue. Pasting in my original (non simplified...kind of...left out the lengthy 'table' def) code: 

{code:language=groovy}
@CompileStatic
long crc64(File file) {
  long register = 0xfac432b10cd5e44aL
  def table = []

  int KB = 1024
  int MB = 1024*KB

  file.eachByte(MB) { byte[] buf, int bytesRead ->
    buf[0, bytesRead-1].each { long element -> 
      long tmp = register

      int t = (int) (tmp >>> 56 ^ element)
      tmp <<= 8
      tmp ^= table[t]    

      register = tmp
    } 
  }

  register
}
{code}

assigning the variable 'register' to  'tmp' and then performing the shift operations on 'tmp' resolves the issue. Performing the operations directly on 'register' above causes the same error as in the issue description. 

> CompileStatic class generation bug "register with message: rightShiftUnsigned and arguments X"
> ----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7542
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7542
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static compilation
>    Affects Versions: 2.4.4
>         Environment: Groovy Version: 2.4.4 JVM: 1.7.0_55 Vendor: Oracle Corporation OS: Linux
>            Reporter: Matias Bjarland
>
> Error caused by the following code snippet (was in the process of coding a crc64 algorithm): 
> {code:language=groovy}
> import groovy.transform.CompileStatic 
> test()
> @CompileStatic
> def test() {
>   long register = 0xfac432b10cd5e44aL  
>   
>   [1,2,3].each { int element -> 
>     int t = (int) (register >>> 56 ^ (long) element) & 0xff
>   }  
> }
> {code}
> execution example: 
> {code}
> $ groovy test.groovy 
> Caught: BUG! exception in phase 'class generation' in source unit '/home/mbjarland/test.groovy' At line 11 column 20
> On receiver: register with message: rightShiftUnsigned and arguments: 56
> This method should not have been called. Please try to create a simple example reproducing this error and filea bug report at https://issues.apache.org/jira/browse/GROOVY
> BUG! exception in phase 'class generation' in source unit '/home/mbjarland/projects/kohler.project/projects/full-publish/test.groovy' At line 11 column 20
> On receiver: register with message: rightShiftUnsigned and arguments: 56
> This method should not have been called. Please try to create a simple example reproducing this error and filea bug report at https://issues.apache.org/jira/browse/GROOVY
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)