Re: Bug interactive: internal error: interpretBCO: unknown or unimplemented opcodes

2007-01-16 Thread Simon Marlow

Matthew Sackman wrote:


interactive: internal error: interpretBCO: unknown or unimplemented opcode 
20196
(GHC version 6.6 for i386_unknown_linux)
Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Aborted


Thanks for the report - this bug has already been fixed, see

  http://hackage.haskell.org/trac/ghc/ticket/1013

Cheers,
Simon
___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


Bug interactive: internal error: interpretBCO: unknown or unimplemented opcodes

2007-01-15 Thread Matthew Sackman
Hi,

Please find code attached. Please CC me on replies as I'm not
subscribed. I would have added this via trac but couldn't log in (was
endlessly prompted for username/password and guest/guest didn't make it
go away).

This is to do with strictness modifiers: if you remove all the ! from
the code then the bug vanishes.

Also, the following works fine:

buildOctTree (Vec 0 0 0) 10 10 10 [(a,(Vec a a a)) | a - [(-4.0),(-2.0)..4.0]]

Also, having done that, the problematic expressions work fine - the bug
only appears if the expression below is run as the first call to
buildOctTree in the ghci session.

This is on a P4, 2GB RAM, Debian unstable, ghc 6.6 (both hand rolled and
from debian).

uname -a =
   Linux smudge 2.6.18-2-686 #1 SMP Wed Nov 8 19:52:12 UTC 2006 i686 GNU/Linux

 ghci -v OctTree
   ___ ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |  GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __  / /___| |  http://www.haskell.org/ghc/
\/\/ /_/\/|_|  Type :? for help.

Using package config file: /usr/lib/ghc-6.6/package.conf
wired-in package base mapped to base-2.0
wired-in package rts mapped to rts-1.0
wired-in package haskell98 mapped to haskell98-1.0
wired-in package template-haskell mapped to template-haskell-2.0
Hsc static flags: -static
Loading package base ... linking ... done.
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
*** Chasing dependencies:
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
Upsweep completely successful.
*** Deleting temp files:
Deleting: 
*** Chasing dependencies:
Stable obj: []
Stable BCO: []
unload: retaining objs []
unload: retaining bcos []
compile: input file OctTree.hs
*** Checking old interface for main:OctTree:
[1 of 1] Compiling OctTree  ( OctTree.hs, interpreted )
*** Parser:
*** Renamer/typechecker:
*** Desugar:
Result size = 1587
*** Simplify:
Result size = 2390
Result size = 2137
Result size = 2105
Result size = 2100
*** Tidy Core:
Result size = 2198
*** CorePrep:
Result size = 2646
*** ByteCodeGen:
*** Deleting temp files:
Deleting: 
Upsweep completely successful.
*** Deleting temp files:
Deleting: 
Ok, modules loaded: OctTree.
*OctTree buildOctTree (Vec 0 0 0) 10 10 10 [(a,(Vec a a a)) | a - 
[(-4.0),(-3.9)..4.0]]
*** Parser:
*** Desugar:
*** Simplify:
*** CorePrep:
*** ByteCodeGen:
interactive: internal error: interpretBCO: unknown or unimplemented opcode 
20196
(GHC version 6.6 for i386_unknown_linux)
Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Aborted

Matthew
-- 
Matthew Sackman
http://www.wellquite.org/
{-
 - OctTrees.hs: Implementation of OctTrees in Haskell
 - Copyright (C) 2006  Matthew Sackman
 -
 - This program is free software; you can redistribute it and/or
 - modify it under the terms of the GNU General Public License
 - as published by the Free Software Foundation; version 2
 - of the License only.
 - 
 - This program is distributed in the hope that it will be useful,
 - but WITHOUT ANY WARRANTY; without even the implied warranty of
 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 - GNU General Public License for more details.
 - 
 - You should have received a copy of the GNU General Public License
 - along with this program; if not, write to the Free Software
 - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 -}

module OctTree
(OctTree,
 buildOctTree,
 findInRadius
)
where

import Data.List

data Vector = Vec  !Double  !Double  !Double
  deriving (Show, Eq)

findDisplacement :: Vector - Vector - (Double, Vector)
findDisplacement (Vec ax ay az) (Vec bx by bz) =
(len, Vec dx dy dz)
where
  len = sqrt ((dx*dx) + (dy*dy) + (dz*dz))
  dx = (bx - ax)
  dy = (by - ay)
  dz = (bz - az)

--   lne usw
data OctTree value = OctTree !Vector !Vector !(OctTreeNode value)
 deriving (Show)

data OctTreeNode value = EmptyLeaf
--pos value
   | Leaf !Vector !(value)
   | Node
--   lne  lse  lsw  lnw
 !(OctTree value) !(OctTree value) !(OctTree value) !(OctTree value)
--   unw  usw  use  une
 !(OctTree value) !(OctTree value) !(OctTree value) !(OctTree value)
 deriving (Show)

buildOctTree :: (Show a) = Vector - Double - Double - Double - [(a,Vector)] - (OctTree a)
buildOctTree (Vec mx my mz) x_size y_size z_size values = foldl' (\t (v,pos) - insertValue t v pos) initial values
where
  initial = OctTree (Vec (mx+x) (my+y) (mz-z)) (Vec (mx-x) (my-y) (mz+z)) EmptyLeaf
  x = x_size /2
  y = y_size /2
  z =