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 17381 - Checked format string is permissive after floating point argument #7916

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

berni44
Copy link
Contributor

@berni44 berni44 commented Mar 24, 2021

On my computer there is no failure, but in the Online D Editor it reports failures since 2.074.1, but worked before.

I just added a unittest to find out on which computers this fails.

@berni44
Copy link
Contributor Author

berni44 commented Mar 25, 2021

Strange. Seems to work on all computers here but fails in the online editor...

PS: Works in the online editor too, when main is made pure. On my computer it works still, when pure is removed. Let's see, what the computers here report...

@berni44 berni44 closed this Mar 25, 2021
@berni44 berni44 reopened this Mar 27, 2021
@berni44
Copy link
Contributor Author

berni44 commented Mar 27, 2021

Meanwhile I found out, that the error was triggered by formatting floats not being CTFEable. Which isn't the case any more (at least for float and double), and hence it is correct that the unittest passes on all testers.

@berni44 berni44 closed this Mar 27, 2021
@berni44 berni44 reopened this Mar 27, 2021
@berni44 berni44 force-pushed the issue_17381 branch 2 times, most recently from 604a732 to 26bef18 Compare March 27, 2021 13:10
@berni44 berni44 marked this pull request as ready for review March 27, 2021 13:11
@berni44 berni44 closed this Mar 27, 2021
@berni44 berni44 reopened this Mar 27, 2021
@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @berni44! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the coverage diff by visiting the details link of the codecov check)
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
17381 normal Checked format string is permissive after floating point argument

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub run digger -- build "master + phobos#7916"

@berni44
Copy link
Contributor Author

berni44 commented Mar 27, 2021

The problem was the special handling of the ctfp-exception in checkFormatException, which elided the check if all arguments were used.

For fixing this, I used a trick: Formatting NaNs doesn't use snprintf, so I allowed them being formatted instead of throwing on all reals. checkFormatException uses Args.init and hence now always works with floats in CTFE.

@PetarKirov
Copy link
Member

The online editor only provides already released compiler versions, so any changes done in a pull request won't be visible in the editor, until a new version is released.

That said, as one of the maintainers of @dlang-tour, I am in favor of adding such feature, but it's not a small amount of work.

@berni44
Copy link
Contributor Author

berni44 commented Mar 28, 2021

The online editor only provides already released compiler versions, so any changes done in a pull request won't be visible in the editor, until a new version is released.

You can choose "dmd-nightly", which sounds like it should be compiled once a day from the github sources. But it's 2.091 currently - see bugreport.

And when choosing "all dmd compilers", it stops with 2.094.

@berni44
Copy link
Contributor Author

berni44 commented Mar 31, 2021

Rebased to restart the tests.

@dlang-bot dlang-bot merged commit 96ee071 into dlang:master Mar 31, 2021
@berni44 berni44 deleted the issue_17381 branch April 28, 2021 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants