You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4273 Reporter: monate Assigned to:@pierreweis Status: closed (set by @pierreweis on 2008-09-08T12:35:31Z) Resolution: fixed Priority: normal Severity: crash Version: 3.09.3 Fixed in version: 3.10.0 Category: ~DO NOT USE (was: OCaml general) Monitored by: pascal_cuoq monate ertai
Bug description
Dear Caml'ers,
Calling Format.advance_left may raise Stack_overflow because it is not tail rec.
Here is a tentative fix :
let advance_left state =
let rec aux state =
match peek_queue state.pp_queue with
{elem_size = size; token = tok; length = len} ->
let size = int_of_size size in
if not
(size < 0 &&
(state.pp_right_total - state.pp_left_total < state.pp_space_left))
then begin
ignore(take_queue state.pp_queue);
format_pp_token state (if size < 0 then pp_infinity else size) tok;
state.pp_left_total <- len + state.pp_left_total;
aux state
end
in
try
aux state
with Empty_queue -> ();;
The text was updated successfully, but these errors were encountered:
Yes I did encounter this stack overflow.
Sadly, I cannot give you the example but here is a rough description.
The code causing the stack overflow is a pretty printer for memory states of an analyzer of one very large C code.
It uses a lot of nested %a and stack overflows after 12000 lines of output.
Doubling the stack size fixes the problem.
The patch prevents the stack overflow without changing the stack size.
Original bug ID: 4273
Reporter: monate
Assigned to: @pierreweis
Status: closed (set by @pierreweis on 2008-09-08T12:35:31Z)
Resolution: fixed
Priority: normal
Severity: crash
Version: 3.09.3
Fixed in version: 3.10.0
Category: ~DO NOT USE (was: OCaml general)
Monitored by: pascal_cuoq monate ertai
Bug description
Dear Caml'ers,
Calling Format.advance_left may raise Stack_overflow because it is not tail rec.
Here is a tentative fix :
let advance_left state =
let rec aux state =
match peek_queue state.pp_queue with
{elem_size = size; token = tok; length = len} ->
let size = int_of_size size in
if not
(size < 0 &&
(state.pp_right_total - state.pp_left_total < state.pp_space_left))
then begin
ignore(take_queue state.pp_queue);
format_pp_token state (if size < 0 then pp_infinity else size) tok;
state.pp_left_total <- len + state.pp_left_total;
aux state
end
in
try
aux state
with Empty_queue -> ();;
The text was updated successfully, but these errors were encountered: