Skip to content

Compilation does not terminate #97

Closed
@pqwy

Description

@pqwy

More precisely, compilation time is exponential in the constant given to fun1 in this program:

let app fb x = fb x

let rec fun1 = function
  | 0 -> ()
  | n -> app (fun _ -> fun1 (pred n)) ()

let _ = app (fun () -> fun1 1000000) ()

Attaching gdb, the stack is 4144 deep, with this at the top:

#0  0x00000000006bc8a8 in caml_oldify_one ()
#1  0x00000000006bcaea in caml_oldify_mopup ()
#2  0x00000000006bcbb0 in caml_empty_minor_heap ()
#3  0x00000000006bcda9 in caml_minor_collection ()
#4  0x00000000006bb87a in caml_garbage_collection ()
#5  0x00000000006cd514 in caml_call_gc ()
#6  0x0000000000444491 in camlFreshening__func_decls_subst_closure_5785 () at middle_end/freshening.ml:286
#7  0x000000000044465c in camlFreshening__apply_function_decls_and_free_vars_closure_5991 ()
    at middle_end/freshening.ml:306
#8  0x0000000000475df5 in camlInline_and_simplify__simplify_set_of_closures_28040 ()
    at middle_end/inline_and_simplify.ml:571
#9  0x000000000047569e in camlInline_and_simplify__simplify_named_28045 () at middle_end/inline_and_simplify.ml:847
#10 0x00000000004783cc in camlInline_and_simplify__for_defining_expr_closure_29729 ()
    at middle_end/inline_and_simplify.ml:928
#11 0x000000000043307f in camlFlambda__loop_18560 () at middle_end/flambda.ml:834
#12 0x000000000047476d in camlInline_and_simplify__simplify_28048 () at middle_end/inline_and_simplify.ml:1186
#13 0x0000000000473ede in camlInline_and_simplify__simplify_function_closure_28679 ()
    at middle_end/inline_and_simplify.ml:626
#14 0x0000000000688654 in camlMap__fold_4315 () at map.ml:193
#15 0x0000000000476053 in camlInline_and_simplify__simplify_set_of_closures_28040 ()
    at middle_end/inline_and_simplify.ml:644
#16 0x000000000047569e in camlInline_and_simplify__simplify_named_28045 () at middle_end/inline_and_simplify.ml:847
#17 0x00000000004783cc in camlInline_and_simplify__for_defining_expr_closure_29729 ()
    at middle_end/inline_and_simplify.ml:928
#18 0x000000000043307f in camlFlambda__loop_18560 () at middle_end/flambda.ml:834
#19 0x000000000047476d in camlInline_and_simplify__simplify_28048 () at middle_end/inline_and_simplify.ml:1186
#20 0x0000000000473ede in camlInline_and_simplify__simplify_function_closure_28679 ()
    at middle_end/inline_and_simplify.ml:626
#21 0x0000000000688654 in camlMap__fold_4315 () at map.ml:193
#22 0x0000000000476053 in camlInline_and_simplify__simplify_set_of_closures_28040 ()
    at middle_end/inline_and_simplify.ml:644
#23 0x000000000047569e in camlInline_and_simplify__simplify_named_28045 () at middle_end/inline_and_simplify.ml:847
#24 0x00000000004783cc in camlInline_and_simplify__for_defining_expr_closure_29729 ()
    at middle_end/inline_and_simplify.ml:928
#25 0x000000000043307f in camlFlambda__loop_18560 () at middle_end/flambda.ml:834

Using version 4.03.0+dev11-2015-10-19, the one currently in opam.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions