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

fix Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O #5650

Merged
merged 1 commit into from Apr 12, 2016

Conversation

WalterBright
Copy link
Member

@dlang-bot
Copy link
Contributor

Fix Bugzilla Description
15861 [REG 2.069] Wrong double-to-string conversion with -O

@yebblies
Copy link
Member

That's not a helpful test case. Can't you reduce it now that you know which sub-part of the code it was in?

@WalterBright
Copy link
Member Author

As will all most optimizer problems, they depend on a very specific path through the system, which is pretty hard to reduce. In this case, it'd likely take several hours work. Even then, such test cases tend to be fragile, as some other change somewhere else in the compiler will invalidate them.

This sort of thing is why "fuzz testers" are effective, but we don't have a fuzz tester. Wanna make one?

@yebblies
Copy link
Member

As will all most optimizer problems, they depend on a very specific path through the system, which is pretty hard to reduce. In this case, it'd likely take several hours work. Even then, such test cases tend to be fragile, as some other change somewhere else in the compiler will invalidate them.

I asked because sometimes the problem construct is obvious once the bug has been found. That makes me think we're better off with no test case than a useless test case, or putting it in phobos instead. We shouldn't be adding more phobos-dependent test cases.

This sort of thing is why "fuzz testers" are effective, but we don't have a fuzz tester. Wanna make one?

I've made several, but none specifically for the optimizer. We really need the ability to create elem-to-elem test cases.

@WalterBright
Copy link
Member Author

I put the test case in its own file, because it depends on phobos. I understand the value of a test suite that does not depend on Phobos, because code gen bugs causing Phobos to fail are hard to debug.

The optimization I removed was simply wrong. A double move cannot be replaced with two float moves. It's essentially putting random data into a float register, and since some bit patterns are not always supported, documented, or behave portably between FPUs, unpredictable things can happen. Such things are hard to reliably detect with a test case.

@yebblies
Copy link
Member

My concern is that the only useful thing we'll be able to do with the test case in the future is delete it. It's unlikely to get reduced in the future, and will be very sensitive to changes in both dmd and phobos. I feel like it doesn't actually add any value, and we'd be better off not having it at all.

Anyway, the compiler change LGTM so if you're dead set on keeping the test case feel free to toggle auto-merge on.

@WalterBright
Copy link
Member Author

Auto-merge toggled on

@9rnsr
Copy link
Contributor

9rnsr commented Apr 12, 2016

Why this PR is based on master? Does it mean this regression fix needs to be delayed until 2.072.0 release?

@WalterBright WalterBright merged commit 74ed684 into dlang:master Apr 12, 2016
@CyberShadow
Copy link
Member

@WalterBright @yebblies @9rnsr Here is a reduced test case:

void main()
{
    double val = 4286853117.;

    (){
        assert(val == 4286853117.);
    }();
}

Maybe you could include it too when you put this on stable.

Also feel free to ping me if you'd like something reduced or bisected :)

@WalterBright
Copy link
Member Author

@CyberShadow thank you, this is awesome. I'll do a new PR to replace the test case with yours.

@WalterBright WalterBright deleted the fix15861 branch April 12, 2016 21:59
9rnsr pushed a commit to 9rnsr/dmd that referenced this pull request Apr 13, 2016
fix Issue 15861 - [REG 2.069] Wrong double-to-string conversion with -O
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants