Hi all,

in Groovy we have now the second case of someone discovering a bug that 
seems to be not a groovy bug. It seems to happen only on windows with a 
64bit environment. This makes it difficult to reproduce, since not many 
people bother with that it seems. So I am asking here for people to 
confirm the problem and maybe helping me to reducing the sample code.

Anyway, the bug is reported with several 64bit VMs.. namely 1.6.0u13 and 
1.6.0u11 or 12. A 32bit VM and the code works without problems. starting 
the program with -Xint and the problem goes away for 64bit too. Also 
Groovy 1.6.3 is required for this example, but I think any 1.6 Groovy 
will do... maybe even before. The sample is a groovy program:

> def binstr = { v, n=4 ->
>   def s = ("0"*n + Integer.toBinaryString(v))
>   return s.substring(s.size()-n)
> }
> 
> def uniqcols = { a, b, cols=4 ->
>     def l = [] as HashSet
>     0.upto(cols-1) { bitno ->
>       def bitmask = 1<<bitno
>       switch (bitno) {
>         case 0  : valu = ((a&bitmask) << 1)         | (b&bitmask)
>                   break
>         default : valu = ((a&bitmask) >> (bitno-1)) | ((b&bitmask) >> bitno)
>                   break
>        }
>       l << valu  // add value to set
>     }
>     // println l
>     return l.size()
> }
> 
> 3.upto(8) { n ->
>  def lastval = 2**n - 1
>  def spacefill = " "*(n+1)
>  def fmtstr = "%${n}d "
>  println "${fmtstr}"
> 
>  def File file = new File("k2m${n}.txt")
>  def PrintWriter writer = file.newPrintWriter()
> 
>  // heading
>  writer.print spacefill
>  0.upto(lastval) { i -> writer.print "${binstr(i,n)} " };
>  writer.println ""
> 
>  // data lines
>  0.upto(lastval) { i -> 
>   writer.print "${binstr(i,n)} "
>   0.upto(lastval) { j ->
>     writer.print String.format(fmtstr, n-uniqcols(i,j,n))
>   }
>   writer.println ""
>  }
>  writer.close()  // files 3 to 5 empty without this!
> }


what fails is the String.format call, that deep down in Groovy will call 
  a System.arraycopy, which then fails with a ArrayOutOfBoundsException, 
without any further explanation about what happened. A clear error 
message would have helped to identify the problem already, but VM error 
messages have never been very detailed.

So anyway how can assist here?

bye blackdrag

-- 
Jochen "blackdrag" Theodorou
The Groovy Project Tech Lead (http://groovy.codehaus.org)
http://blackdragsview.blogspot.com/


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to