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 23900 - @safe is allowed in inline asm #15192

Merged
merged 4 commits into from
May 11, 2023
Merged

Conversation

ntrel
Copy link
Contributor

@ntrel ntrel commented May 6, 2023

No description provided.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @ntrel! 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
23900 major @safe is allowed in inline asm

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 + dmd#15192"

@@ -3593,7 +3593,9 @@ Statement statementSemanticVisit(Statement s, Scope* sc)
cas.error("`asm` statement is assumed to be impure - mark it with `pure` if it is not");
if (!(cas.stc & STC.nogc) && sc.func.setGC(cas.loc, "`asm` statement in %s `%s` is assumed to use the GC - mark it with `@nogc` if it does not"))
cas.error("`asm` statement is assumed to use the GC - mark it with `@nogc` if it does not");
if (!(cas.stc & (STC.trusted | STC.safe)))
if (cas.stc & STC.safe)
cas.error("`asm` statement cannot be marked `@safe`, use `@system` or `@trusted` instead");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deprecation first

@Dany12LU
Copy link

Dany12LU commented May 6, 2023

@ntrel Check this

, we should remove all this

@Dany12LU
Copy link

Dany12LU commented May 6, 2023

Do we really have to wait for D2.114 to deprecate this? This is not a feature by any means, this is a mistake of whoever implemented those checks from the beginning

@ntrel
Copy link
Contributor Author

ntrel commented May 6, 2023

This is not a feature by any means, this is a mistake of whoever implemented those checks from the beginning

Well they did write a test for asm @safe, so perhaps it was intentional. Either way people could be using it assuming the compiler can infer whether the instructions are safe or not.

@dkorpel
Copy link
Contributor

dkorpel commented May 6, 2023

Do we really have to wait for D2.114 to deprecate this? This is not a feature by any means, this is a mistake of whoever implemented those checks from the beginning

It's a deprecation starting with the next release. At 2.114 is will become an error.

@Dany12LU
Copy link

Dany12LU commented May 6, 2023

This deprecation maybe should be in the changelog?

@schveiguy
Copy link
Member

This deprecation maybe should be in the changelog?

Closing of the bug will be in the changelog. It gets added automatically.

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.

6 participants