Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repeatable segfault with quadgk and Unitful #19226

Closed
ggggggggg opened this issue Nov 4, 2016 · 6 comments
Closed

repeatable segfault with quadgk and Unitful #19226

ggggggggg opened this issue Nov 4, 2016 · 6 comments

Comments

@ggggggggg
Copy link
Contributor

The following code reliably causes a segfault on my computer when pasted to the REPL. The units of the endpoints don't agree, so this shouldn't work, but my impression is that any segfault is worth filing an issue for.

using Unitful
f(r,Rmax) = r/Rmax^2
quadgk(r->f(r, 4u"mm"),0u"mm", 4u"mm^2")

Versioninfo:

Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i5-2500S CPU @ 2.70GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)
@StefanKarpinski
Copy link
Member

True – segfaults from pure Julia code are always bugs. Thanks for reporting.

@ggggggggg
Copy link
Contributor Author

I'm not sure if it is the same bug or not but I can get output like this

julia(23195,0x7fff7c86b300) malloc: *** error for object 0x7fe1df13c200: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

signal (6): Abort trap: 6
while loading no file, in expression starting on line 0
__pthread_kill at /usr/lib/system/libsystem_kernel.dylib (unknown line)
Allocations: 12314640 (Pool: 12313040; Big: 1600); GC: 17
Abort trap: 6

with code at the following gist: https://gist.github.com/ggggggggg/105fbfaf762503c7f95cc2a8cdd6e81c

@yuyichao
Copy link
Contributor

yuyichao commented Nov 5, 2016

Dup of #17280?

@yuyichao
Copy link
Contributor

yuyichao commented Nov 5, 2016

And for the code in the gist I get a

ERROR: BoundsError: attempt to access 1029-element Array{Quantity{Float64, Dimensions:{𝐋^-1 𝐓}, Units:{mm^-1 ps}},1} at index [1030]
 in setindex!(::Array{Quantity{Float64, Dimensions:{𝐋^-1 𝐓}, Units:{mm^-1 ps}},1}, ::Quantity{Float64, Dimensions:{𝐋^-1 𝐓}, Units:{mm^-1 ps}}, ::Int64) at ./array.jl:474
 in collect_to!(::Array{Quantity{Float64, Dimensions:{𝐋^-1 𝐓}, Units:{mm^-1 ps}},1}, ::Base.Generator{StepRange{Quantity{Float64, Dimensions:{𝐋}, Units:{mm}},Quantity{Float64, Dimensions:{𝐋}, Units:{mm}}},##19#21}, ::Int64, ::Quantity{Float64, Dimensions:{𝐋}, Units:{mm}}) at ./array.jl:402
 in collect_to_with_first!(::Array{Quantity{Float64, Dimensions:{𝐋^-1 𝐓}, Units:{mm^-1 ps}},1}, ::Quantity{Float64, Dimensions:{𝐋^-1 𝐓}, Units:{mm^-1 ps}}, ::Base.Generator{StepRange{Quantity{Float64, Dimensions:{𝐋}, Units:{mm}},Quantity{Float64, Dimensions:{𝐋}, Units:{mm}}},##19#21}, ::Quantity{Float64, Dimensions:{𝐋}, Units:{mm}}) at ./array.jl:386
 in collect(::Base.Generator{StepRange{Quantity{Float64, Dimensions:{𝐋}, Units:{mm}},Quantity{Float64, Dimensions:{𝐋}, Units:{mm}}},##19#21}) at ./array.jl:367
 in trapz(::Function, ::StepRange{Quantity{Float64, Dimensions:{𝐋}, Units:{mm}},Quantity{Float64, Dimensions:{𝐋}, Units:{mm}}}) at ./REPL[15]:2
 in macro expansion; at ./REPL[38]:3 [inlined]
 in anonymous at ./<missing>:?

on master

@yuyichao
Copy link
Contributor

yuyichao commented Nov 5, 2016

I another word, the second issue is likely dup of #19203

@yuyichao
Copy link
Contributor

yuyichao commented Nov 5, 2016

The second case does not segfault for me on 0.5 but does raise a BoundsError with --check-bounds=yes. Close as dup of #17280 and #19203. If it still happens after you fix the OOB access/apply the fix of #19203 and infinite recursion, feel free to request for reopening or open a new bug.

@yuyichao yuyichao closed this as completed Nov 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants