Skip to content

Using Obj.repr in arrays leads to segfaults #17

@talex5

Description

@talex5

I tracked down a segfault to this generated code in Vk__Types__Pipeline_rasterization_state_create_info.ml:

      Gc.finalise_last
        (fun () ->
           let _kept_alive =
             [|(Obj.repr line_width'1);(Obj.repr depth_bias_slope_factor'1);(
               Obj.repr depth_bias_clamp'1);(Obj.repr
                                               depth_bias_constant_factor'1);(
               Obj.repr depth_bias_enable'1);(Obj.repr front_face'1);(
               Obj.repr cull_mode'1);(Obj.repr polygon_mode'1);(Obj.repr
                                                                  rasterizer_discard_enable'1);(
               Obj.repr depth_clamp_enable'1);(Obj.repr flags'1)|] in
           ()) res'1

The problem is that the first element (line_width'1) is a float, which causes caml_array_of_uniform_array to turn it into a float-array.

e.g.

OCaml version 5.3.0
Enter #help;; for help.

# [|Obj.repr 1.0;Obj.repr 1|];;
fish: Job 1, 'ocaml' terminated by signal SIGSEGV (Address boundary error)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions