Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
ocamlopt -g misses optimizations #5313
Original bug ID: 5313
$ cat opt.ml
$ /opt/ocaml-3.12.1/bin/ocamlopt -dlambda -c opt.ml
$ /opt/ocaml-3.12.1/bin/ocamlopt -g -dlambda -c opt.ml
When using -g int ref is allocated on the heap. This is rather surprising - I expected -g to only add debugging symbols and not prevent optimizations.
Comment author: @ygrek
Yes, this exact use case is fixed, thanks!
But I am not sure that using -g will not prevent other optimizations cause looking at the code it seems that some optimization passes take -g option into the consideration. Actually, initially I wanted to clarify the meaning of -g and this specific example was the easiest to spot. So is it expected for -g to influence the generated code?