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

compatibility between bytecode and native compilation #8041

Closed
vicuna opened this issue Mar 5, 2003 · 5 comments
Closed

compatibility between bytecode and native compilation #8041

vicuna opened this issue Mar 5, 2003 · 5 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Mar 5, 2003

Original bug ID: 1570
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Jérôme Kasparian
Version: ocaml 3.06
OS: MacOS X and Mandrake 8.1
Submission from: maclasim13.univ-lyon1.fr (134.214.98.65)

Hello,

It seems that an undocumented (refering to the ocaml 3.06 manual, pages 164-165)
incompatibility between bytecode and native compilation concerns the trapping of
Invalid_arguments exceptions.
The sample code below runs well under bytecode compilation and generates a bus
error when native compiled with ocamlopt.
This is true on MacOS X as well as on Linux Mandrake 8.1

Hope it helps !

Jérôme Kasparian

(* Sample code *)

let a = Array.make 4 4;;
try a.(-4)
with (Invalid_argument "Array.get") -> 0
;;

(* end of sample code *)

@vicuna
Copy link
Author

vicuna commented Mar 5, 2003

Comment author: administrator

It seems that an undocumented (refering to the ocaml 3.06 manual, pages
164-165)
incompatibility between bytecode and native compilation concerns the trapping
of
Invalid_arguments exceptions.

But it is documented that the exception raised for out-of-bounds array access
is different between byte code and native code.

The sample code below runs well under bytecode compilation and generates a
bus
error when native compiled with ocamlopt.
This is true on MacOS X as well as on Linux Mandrake 8.1

I cannot reproduce it under Mac OS X. Are you sure you didn't use the -unsafe
option ?

-- Damien

@vicuna
Copy link
Author

vicuna commented Mar 6, 2003

Comment author: administrator

Hello !
Thanks for the answer.

It seems that an undocumented (refering to the ocaml 3.06 manual,
pages
164-165)
incompatibility between bytecode and native compilation concerns the
trapping
of
Invalid_arguments exceptions.

But it is documented that the exception raised for out-of-bounds array
access
is different between byte code and native code.

The sample code below runs well under bytecode compilation and
generates a
bus
error when native compiled with ocamlopt.
This is true on MacOS X as well as on Linux Mandrake 8.1

I cannot reproduce it under Mac OS X. Are you sure you didn't use the
-unsafe
option ?

I used the default options, after the default installation of the
package.
I am running Mac OS X 10.2.4
Here is the output:

[maclasim13:Documents/Calculs/OG] jkaspari% ocamlopt test2.ml
[maclasim13:Documents/Calculs/OG] jkaspari% a.out
Bus error
[maclasim13:Documents/Calculs/OG] jkaspari% ocamlc test2.ml
[maclasim13:Documents/Calculs/OG] jkaspari% a.out
[maclasim13:Documents/Calculs/OG] jkaspari%

I also attach the file test2.ml

Friendly
Jérôme


let a = Array.make 4 4;;
try a.(-4)
with (Invalid_argument "Array.get") -> 0
;;


Jérôme Kasparian
Projet Téramobile
LASIM, université Claude Bernard Lyon 1
Bat A. Kastler
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
France
Téléphone +33 4 72 43 26 54, fax +33 4 72 44 58 71



@vicuna
Copy link
Author

vicuna commented Mar 6, 2003

Comment author: administrator

The sample code below runs well under bytecode compilation and
generates a bus
error when native compiled with ocamlopt.
This is true on MacOS X as well as on Linux Mandrake 8.1

I cannot reproduce it under Mac OS X.

I cannot reproduce the crash under Linux either. But it is true that
different exceptions are raised for out-of-bound accesses in bytecode
and in native-code.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Mar 11, 2003

Comment author: administrator

The sample code below runs well under bytecode compilation and generates a
bus
error when native compiled with ocamlopt.

OK, I finally reproduced the crash on Mac OS X. It occurs with ocaml 3.06,
but not with the working version, so it was fixed at some point, I'm not
sure when exactly.

-- Damien

@vicuna
Copy link
Author

vicuna commented Mar 11, 2003

Comment author: administrator

fixed at some point between 3.06 and 3.06+24

@vicuna vicuna closed this as completed Mar 11, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant