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
"Fatal error: Assignment of a float to a specialised non-float array" in virtual method #7426
Comments
Comment author: @gasche To devs: this means that we need to add more object-oriented programs to the testsuite. |
Comment author: omion I encountered the same error with a trivial program: returns with the error:
Tested with 4.04.0 for Windows x64 and Linux armv7. As tempodox states, ocamlc, 4.04.0 without flambda, and 4.03.0 compile fine. |
Comment author: @alainfrisch I wonder if Translclass shouldn't use Psetfield to write instance variables instead of Parraysetu. |
Comment author: @mshinwell @Frisch: Indeed. Do you know why the block is treated as an array at present? (My knowledge of the object compilation model is lacking.) |
Comment author: @alainfrisch
No, I don't know. |
Comment author: @garrigue The block has to be treated as an array, because the offset is only known at runtime (due to the dynamic nature of class inheritance). |
Comment author: @mshinwell I think I know what's going on here now, I will write a patch today. |
Comment author: @mshinwell Superceded by #965 |
Original bug ID: 7426
Reporter: tempodox
Status: closed (set by @mshinwell on 2016-12-12T10:57:23Z)
Resolution: duplicate
Priority: normal
Severity: block
Platform: Unix
OS: Mac OS X
OS Version: 10.11.6
Version: 4.04.0
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #7474
Related to: #7434 #7499
Monitored by: @gasche
Bug description
In 4.04.0+flambda, the following code produces an error from
ocamlopt
:class virtual abstract = object (_ : 'self) method virtual scaleby : float -> 'self end
class concrete value =
object
inherit abstract
val _value : float = value
method value = _value
method scaleby fac =
{< _value = fac *. _value >}
end
The error message is:
Fatal error: Assignment of a float to a specialised non-float array: (array.unsafe_set[addr]<>
copy/95 _value/92
Pmulfloat/103)
Fatal error: exception Misc.Fatal_error
Steps to reproduce
Put this code in an
ml
file and pass it toocamlopt
:class virtual abstract =
object (_ : 'self)
method virtual scaleby : float -> 'self
end
class concrete value =
object
inherit abstract
val _value : float = value
method value = _value
method scaleby fac =
{< _value = fac *. _value >}
end
Additional information
In 4.03+flambda, or
ocamlc
of 4.04+flambda, the same code compiles without error.The text was updated successfully, but these errors were encountered: