Skip to content

Unusual backtrace line numbers with macros #1334

@staticfloat

Description

@staticfloat

I've noticed that Julia's backtrace line numbers don't alway make sense. For instance, in the following short program (named lapack_perf.jl) and ignoring the actual errors in the code:

reps  = 10
n     = 100
srand(1234321)
a     = rand(n,n)
apd   = a'*a

function test_chold{T<:Number}(apd::Matrix{T})
    times = zeros(10)
    cholds = T[]
    times = [@elapsed push(cholds, chold(apd)) for k = reps]

    # return so it doesn't get optimized away
    cholds
end


print( test_chold(apd) )

I get the following backtrace:

$ julia lapack_perf.jl 
no method convert(Type{Float64},CholeskyDense{Float64})
 in method_missing at base.jl:70
 in push at array.jl:708
 in test_chold at /Users/sabae/Desktop/lapack_perf.jl:49
 in load_now at util.jl:231
 in load_now at util.jl:245
 in require at util.jl:174
 in process_options at client.jl:178
 in _start at client.jl:232
at /Users/sabae/Desktop/lapack_perf.jl:17
 in load_now at util.jl:231
 in load_now at util.jl:245
 in require at util.jl:174
 in process_options at client.jl:178
 in _start at client.jl:232
 in load_now at util.jl:256
 in require at util.jl:174
 in process_options at client.jl:178
 in _start at client.jl:232

This all looks fine and good until we see the in test_chold at /Users/sabae/Desktop/lapack_perf.jl:49 line; Clearly this file doesn't have a line 49.

EDIT: This is due to macros, as @dmbates states. Is there a better way to effect line-printing with macros (which are very helpful and therefore likely to be used extensively)?

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions