Skip to content

cconvert of map(pointer, String[...]) to Ptr{Ptr{Cchar}} fails on nightly #52025

Closed
@vchuravy

Description

@vchuravy

Found during CI on https://github.com/cesmix-mit/LAMMPS.jl

 ERROR: LoadError: TypeError: in RefArray, in A, expected A<:(AbstractArray{Ptr{Int8}}), got Type{Vector{Ptr{UInt8}}}
Stacktrace:
 [1] Ref{Ptr{Int8}}(a::Vector{Ptr{UInt8}})
   @ Base ./refpointer.jl:158
 [2] cconvert(::Type{Ptr{Ptr{Int8}}}, a::Vector{Ptr{UInt8}})
   @ Base ./refpointer.jl:176
 [3] lammps_open_no_mpi(argc::Int64, argv::Vector{Ptr{UInt8}}, ptr::Ptr{Nothing})
   @ LAMMPS.API ~/work/LAMMPS.jl/LAMMPS.jl/src/api.jl:53
 [4] LMP(args::Vector{String}, comm::Nothing)
   @ LAMMPS ~/work/LAMMPS.jl/LAMMPS.jl/src/LAMMPS.jl:69

The ccall is generated by Clang.jl and takes as an argument a Ptr{Ptr{Cchar}}

https://github.com/cesmix-mit/LAMMPS.jl/blob/126d9711e37fef035d5c7327d1181daf12b7b22a/src/api.jl#L53

and while the argsv = map(pointer, args) should probably be inside the GC.@preserve

https://github.com/cesmix-mit/LAMMPS.jl/blob/126d9711e37fef035d5c7327d1181daf12b7b22a/src/LAMMPS.jl#L59

this used to work.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions