Issue 1:
I have a consistent segfault in Nettle.jl on master. This happens on all three platforms.

in expression starting at /Users/travis/.julia/v0.7/Nettle/test/hash_tests.jl:4
jl_typemap_level_assoc_exact at /Users/osx/buildbot/slave/package_osx64/build/src/typemap.c:813
jl_typemap_assoc_exact at /Users/osx/buildbot/slave/package_osx64/build/src/./julia_internal.h:876 [inlined]
jl_lookup_generic_ at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2112
jl_apply_generic at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:2164
Type at /Users/travis/.julia/v0.7/Nettle/src/hash.jl:23
digest at /Users/travis/.julia/v0.7/Nettle/src/hash.jl:44
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1838
top-level scope at ./<missing>:40
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1838
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:811
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx64/build/src/ast.c:847
jl_load at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:854 [inlined]
jl_load_ at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:861
include at ./boot.jl:306 [inlined]
include_relative at ./loading.jl:1067
include at ./sysimg.jl:29
include at ./sysimg.jl:68
jl_fptr_trampoline at /Users/osx/buildbot/slave/package_osx64/build/src/gf.c:1838
do_call at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:324
eval_body at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:661
jl_interpret_toplevel_thunk_callback at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:759
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x11578354f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /Users/osx/buildbot/slave/package_osx64/build/src/interpreter.c:768
jl_toplevel_eval_flex at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:816
jl_parse_eval_all at /Users/osx/buildbot/slave/package_osx64/build/src/ast.c:847
jl_load at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:854 [inlined]
jl_load_ at /Users/osx/buildbot/slave/package_osx64/build/src/toplevel.c:861
include at ./boot.jl:306 [inlined]
include_relative at ./loading.jl:1067
include at ./sysimg.jl:29
exec_options at ./client.jl:327
_start at ./client.jl:455
true_main at /Users/travis/julia/bin/julia (unknown line)

The lowest "user code" stack frame seems to be hash.jl:23, which is:

ccall(hash_type.init, Void, (Ptr{Void},), state)

Issue 2:
In the following example I get a segfault at the ccall, but only if this line is inside the Container constructor. If this call is done in an own function there is no segfault.

[I used malloc in libc only as an example. This segfault happens for other C-functions, too.]

Minimal example:

lib = Libdl.dlopen("libc")

mutable struct Container
ptr :: Ptr{Cvoid}
method_ptr :: Ptr{Cvoid}
end

function call_with_func(container::Container)
container.ptr = ccall(container.method_ptr, Ptr{Cvoid}, (Csize_t,), 1024 )
return nothing
end

function Container()
container = Container(C_NULL, Libdl.dlsym(lib, :malloc))
# this works
# call_with_func(container)
# but the same code here (without own function) produces a segfault
container.ptr = ccall(container.method_ptr, Ptr{Cvoid}, (Csize_t,), 1024 )
return container
end

c = Container()
println("got pointer: ", c.ptr)

Julia-Version:

Julia Version 0.7.0-DEV.3183
Commit 4b74a74 (2017-12-25 07:17 UTC)
Platform Info:
OS: Linux (x86_64-redhat-linux)
CPU: Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.9.1 (ORCJIT, haswell)

Segfault information:

signal (11): Segmentation fault
in expression starting at /TEST/Desktop/mytest.jl:22
jl_typemap_level_assoc_exact at /TEST/julia/julia_trunk/src/typemap.c:810
jl_typemap_assoc_exact at /TEST/julia/julia_trunk/src/julia_internal.h:940 [inlined]
jl_lookup_generic_ at /TEST/julia/julia_trunk/src/gf.c:2026 [inlined]
jl_apply_generic at /TEST/julia/julia_trunk/src/gf.c:2078
Type at /TEST/Desktop/mytest.jl:18
jl_call_fptr_internal at /TEST/julia/julia_trunk/src/julia_internal.h:380 [inlined]
jl_call_method_internal at /TEST/julia/julia_trunk/src/julia_internal.h:399 [inlined]
jl_apply_generic at /TEST/julia/julia_trunk/src/gf.c:2081
do_call at /TEST/julia/julia_trunk/src/interpreter.c:323
eval_value at /TEST/julia/julia_trunk/src/interpreter.c:395
eval_body at /TEST/julia/julia_trunk/src/interpreter.c:509
jl_interpret_toplevel_thunk_callback at /TEST/julia/julia_trunk/src/interpreter.c:720
unknown function (ip: 0xfffffffffffffffe)
unknown function (ip: 0x7f9d6502ff8f)
unknown function (ip: 0xffffffffffffffff)
jl_interpret_toplevel_thunk at /TEST/julia/julia_trunk/src/interpreter.c:729
jl_toplevel_eval_flex at /TEST/julia/julia_trunk/src/toplevel.c:721
jl_parse_eval_all at /TEST/julia/julia_trunk/src/ast.c:803
jl_load at /TEST/julia/julia_trunk/src/toplevel.c:759
include at ./boot.jl:295 [inlined]
include_relative at ./loading.jl:503
jl_call_fptr_internal at /TEST/julia/julia_trunk/src/julia_internal.h:380 [inlined]
jl_call_method_internal at /TEST/julia/julia_trunk/src/julia_internal.h:399 [inlined]
jl_apply_generic at /TEST/julia/julia_trunk/src/gf.c:2081
include at ./sysimg.jl:26
jl_call_fptr_internal at /TEST/julia/julia_trunk/src/julia_internal.h:380 [inlined]
jl_call_method_internal at /TEST/julia/julia_trunk/src/julia_internal.h:399 [inlined]
jl_apply_generic at /TEST/julia/julia_trunk/src/gf.c:2081
process_options at ./client.jl:330
_start at ./client.jl:381
jl_call_fptr_internal at /TEST/julia/julia_trunk/src/julia_internal.h:380 [inlined]
jl_call_method_internal at /TEST/julia/julia_trunk/src/julia_internal.h:399 [inlined]
jl_apply_generic at /TEST/julia/julia_trunk/src/gf.c:2081
jl_apply at /TEST/julia/julia_trunk/ui/../src/julia.h:1474 [inlined]
true_main at /TEST/julia/julia_trunk/ui/repl.c:107
main at /TEST/julia/julia_trunk/ui/repl.c:237
__libc_start_main at /lib64/libc.so.6 (unknown line)
_start at ./julia (unknown line)
Allocations: 289698 (Pool: 289541; Big: 157); GC: 0