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

fld and div failure inside a testset #23866

Closed
fredrikekre opened this issue Sep 24, 2017 · 8 comments
Closed

fld and div failure inside a testset #23866

fredrikekre opened this issue Sep 24, 2017 · 8 comments
Labels
bug Indicates an unexpected problem or unintended behavior upstream The issue is with an upstream dependency, e.g. LLVM

Comments

@fredrikekre
Copy link
Member

From #23862. Reduced to the following:

@testset begin
    @test fld(0.3,0.01) == 29.0
    @test div(0.3,0.01) == 29.0
end

The above two tests fail while inside a @testset:

julia> @testset begin
           @test fld(0.3,0.01) == 29.0
           @test div(0.3,0.01) == 29.0
       end
test set: Test Failed
  Expression: fld(0.3, 0.01) == 29.0
   Evaluated: 30.0 == 29.0
Stacktrace:
 [1] macro expansion at ./REPL[2]:2 [inlined]
 [2] macro expansion at ./test.jl:942 [inlined]
 [3] anonymous at ./<missing>:?
test set: Test Failed
  Expression: div(0.3, 0.01) == 29.0
   Evaluated: 30.0 == 29.0
Stacktrace:
 [1] macro expansion at ./REPL[2]:3 [inlined]
 [2] macro expansion at ./test.jl:942 [inlined]
 [3] anonymous at ./<missing>:?
Test Summary: | Fail  Total
test set      |    2      2
ERROR: Some tests did not pass: 0 passed, 2 failed, 0 errored, 0 broken.

Without the testset they pass just fine:

julia> @test fld(0.3,0.01) == 29.
Test Passed

julia> @test div(0.3,0.01) == 29.0
Test Passed
@fredrikekre fredrikekre added the bug Indicates an unexpected problem or unintended behavior label Sep 24, 2017
@yuyichao
Copy link
Contributor

Most likely LLVM issue?

julia> using Base.Test

julia> @testset begin
           @test fld(0.3,0.01) == 29.0
           @test div(0.3,0.01) == 29.0
       end
Test Summary: | Pass  Total
test set      |    2      2
Base.Test.DefaultTestSet("test set", Any[], 2, false)

julia> @test fld(0.3,0.01) == 29.0
Test Passed

julia> @test div(0.3,0.01) == 29.0
Test Passed

@fredrikekre
Copy link
Member Author

You are on a newer version than LLVM: libLLVM-3.9.1 (ORCJIT, haswell) I guess?

@yuyichao
Copy link
Contributor

Yes. 5.0

@JeffBezanson JeffBezanson added the upstream The issue is with an upstream dependency, e.g. LLVM label Sep 24, 2017
@giordano
Copy link
Contributor

giordano commented Sep 26, 2017

I'm not sure this is related, but I found another case of function having a different behavior inside a @testset on master:

julia> begin
           ptr = cfunction(x -> x*x, Cdouble, Tuple{Cdouble})
           g(x) = ccall(ptr, Cdouble, (Cdouble,), x)
           g(3.0)
       end
9.0

vs

julia> Base.Test.@testset begin
           ptr = cfunction(x -> x*x, Cdouble, Tuple{Cdouble})
           g(x) = ccall(ptr, Cdouble, (Cdouble,), x)
           g(3.0)
       end
Internal error: encountered unexpected error in runtime:
BoundsError(a=Array{Any, 1}[Expr(:return, Expr(:foreigncall, Expr(:block, SSAValue(1) = Expr(:call, Core.getfield, SlotNumber(id=1), :(:ptr))::Any, Expr(:if, Expr(:call, Core.isdefined, SSAValue(1), :(:contents))::Any, nothing, Expr(:block, <newvar #<3>>, SlotNumber(id=3))::Any)::Any, Expr(:call, Core.getfield, SSAValue(1), :(:contents))::Any)::Any, Float64, svec(Float64), :(:ccall), 1, SlotNumber(id=2))::Float64)::Any], i=(0,))
rec_backtrace at /home/mose/repo/julia/src/stackwalk.c:87
record_backtrace at /home/mose/repo/julia/src/task.c:246
jl_throw at /home/mose/repo/julia/src/task.c:568
jl_bounds_error_ints at /home/mose/repo/julia/src/rtutils.c:182
getindex at ./array.jl:768
_getfield_elim_pass! at ./inference.jl:5599
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
_getfield_elim_pass! at ./inference.jl:5583
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
_getfield_elim_pass! at ./inference.jl:5583
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
_getfield_elim_pass! at ./inference.jl:5583
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
getfield_elim_pass! at ./inference.jl:5576
optimize at ./inference.jl:3402
typeinf at ./inference.jl:3303
typeinf_frame at ./inference.jl:2984 [inlined]
typeinf_code at ./inference.jl:3066
jlcall_typeinf_code_794 at /home/mose/repo/julia/usr/lib/julia/sys.so (unknown line)
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
typeinf_ext at ./inference.jl:3105
jlcall_typeinf_ext_0 at /home/mose/repo/julia/usr/lib/julia/sys.so (unknown line)
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
jl_apply at /home/mose/repo/julia/src/julia.h:1451 [inlined]
jl_apply_with_saved_exception_state at /home/mose/repo/julia/src/rtutils.c:249
jl_type_infer at /home/mose/repo/julia/src/gf.c:263
jl_compile_for_dispatch at /home/mose/repo/julia/src/gf.c:1691
jl_compile_method_internal at /home/mose/repo/julia/src/julia_internal.h:334 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:381 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
macro expansion at ./REPL[1]:4 [inlined]
macro expansion at ./test.jl:942 [inlined]
anonymous at ./<missing> (unknown line)
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_toplevel_eval_flex at /home/mose/repo/julia/src/toplevel.c:628
jl_toplevel_eval_in at /home/mose/repo/julia/src/builtins.c:625
eval at ./repl/REPL.jl:3
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
eval_user_input at ./repl/REPL.jl:69
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
macro expansion at ./repl/REPL.jl:100 [inlined]
#1 at ./event.jl:96
jl_call_fptr_internal at /home/mose/repo/julia/src/julia_internal.h:366 [inlined]
jl_call_method_internal at /home/mose/repo/julia/src/julia_internal.h:385 [inlined]
jl_apply_generic at /home/mose/repo/julia/src/gf.c:1980
jl_apply at /home/mose/repo/julia/src/julia.h:1451 [inlined]
start_task at /home/mose/repo/julia/src/task.c:268
unknown function (ip: 0xffffffffffffffff)
test set: Error During Test
  Got an exception of type ErrorException outside of a @test
  error compiling g: unsupported or misplaced expression "block" in function g
  Stacktrace:
   [1] macro expansion at ./REPL[1]:4 [inlined]
   [2] macro expansion at ./test.jl:942 [inlined]
   [3] anonymous at ./<missing>:?
   [4] eval(::Module, ::Expr) at ./repl/REPL.jl:3
   [5] eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./repl/REPL.jl:69
   [6] macro expansion at ./repl/REPL.jl:100 [inlined]
   [7] (::getfield(Base.REPL, Symbol("##1#2")){Base.REPL.REPLBackend})() at ./event.jl:96
Test Summary: | Error  Total
test set      |     1      1
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.

With git-bisect I found this started to happen with #23698.

First reported on Discourse: https://discourse.julialang.org/t/function-erroring-inside-testset-but-not-outside/6064

@yuyichao
Copy link
Contributor

That's a different issue.

@giordano
Copy link
Contributor

Fine, I opened a new ticket: #23878.

@kshyatt
Copy link
Contributor

kshyatt commented Sep 30, 2017

Any update on this?

@yuyichao
Copy link
Contributor

yuyichao commented Oct 4, 2017

Dup of #14089

@yuyichao yuyichao closed this as completed Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior upstream The issue is with an upstream dependency, e.g. LLVM
Projects
None yet
Development

No branches or pull requests

5 participants