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

Exception causes assignment on previous line to be ignored #8277

Closed
danluu opened this issue Sep 8, 2014 · 2 comments
Closed

Exception causes assignment on previous line to be ignored #8277

danluu opened this issue Sep 8, 2014 · 2 comments
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@danluu
Copy link
Contributor

danluu commented Sep 8, 2014

Here are two functions I'd expect to behave identically:

function wheee0()
    i = 0
    while true
        try
            if i == 0
                print(".")
            end
            i += 1
            peakflops(1954784290346684782)
        catch
        end
    end
end

function wheee1()
    i = 0
    while true
        try
            i += 1
            if i == 1
                print(".")
            end
            peakflops(1954784290346684782)
        catch
        end
    end
end

When I run wheee0(), i never increments and my screen gets filled with .. When I run wheee1(), I get a single ., as expected.

Additionally, accessing i inside the while loop, (either inside the catch block of after the entire try/catch expression) causes wheee0 to behave as expected. Accessing i after the while loop has no effect.

I ran into this while trying to create a small, reproducible, test case for some strange behavior on a bad peakflops call, but replacing peakflops with something else that throws an exception (or just throwing an exception with throw) doesn't seem to change the behavior here.

@JeffBezanson JeffBezanson added the bug Indicates an unexpected problem or unintended behavior label Sep 9, 2014
@JeffBezanson JeffBezanson self-assigned this Oct 1, 2014
@JeffBezanson
Copy link
Member

cc @JuliaBackports

JeffBezanson added a commit that referenced this issue Oct 3, 2014
the fix is to propagate isVolatile correctly in codegen

Backport of 39d9c8a
@ivarne
Copy link
Member

ivarne commented Oct 3, 2014

Backported in 0cdc92e

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
Projects
None yet
Development

No branches or pull requests

3 participants