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

Backtrace: comparison errors report line containing first error statement in function #1648

Closed
timholy opened this issue Dec 1, 2012 · 3 comments

Comments

@timholy
Copy link
Member

timholy commented Dec 1, 2012

function testline()
    strdata = "Hi there".data
    if isempty(strdata)
        error("It's empty")
    end
    if strdata[1:5] == "Hello"
        println("Makes no sense")
    end
end
julia> load("linenumber.jl")

julia> testline()
Not defined. Try .== or isequal.
 in testline at /tmp/linenumber.jl:4  # should be 6

If you comment out the if isempty block, then the line number for the error is correct.

It doesn't depend on referencing, as this too gets the line number wrong:

function testline()
    strdata = "Hi there".data
    if isempty(strdata)
        error("It's empty")
    end
    if strdata == 6
        println("Makes no sense")
    end
end

However, this doesn't:

function testline()
    strdata = "Hi there".data
    if isempty(strdata)
        error("It's empty")
    end
    foo(strdata)
end

With a few further tests I concluded that it seems to report the line number of the first error statement in the function.

@JeffBezanson
Copy link
Member

Wow, then the problem in #922 is worse than I thought. LLVM will merge two calls to error even when they have different arguments. The problem goes away if CFGSimplificationPass is disabled.

@JeffBezanson
Copy link
Member

Fortunately, adding a superfluous second argument continues to successfully game the system.

@timholy
Copy link
Member Author

timholy commented Dec 1, 2012

Game away! Many thanks.

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

2 participants