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 23705 - dmd: src/dmd/backend/cgcod.d:734: Assertion sz >= 0 failed #14876

Merged
merged 1 commit into from
Feb 14, 2023

Conversation

RazvanN7
Copy link
Contributor

Targeting master as this manifests in non-release builds, although it might have negative effects on release builds also.

@dlang-bot
Copy link
Contributor

dlang-bot commented Feb 13, 2023

Thanks for your pull request and interest in making D better, @RazvanN7! 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
23705 critical dmd: src/dmd/backend/cgcod.d:734: Assertion `sz >= 0' failed.

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

@@ -725,12 +725,12 @@ tryagain:
@trusted
targ_size_t alignsection(targ_size_t base, uint alignment, int bias)
{
assert(cast(int)base <= 0);
assert(cast(long)base <= 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

targ_size_t is an alias to ulong, therefore casting to int gets a part of the number.

@ibuclaw
Copy link
Member

ibuclaw commented Feb 14, 2023

Isn't release logically deprecated? ICE is an ICE is an ICE. You should never be able to crash the compiler whatever you're doing.

@RazvanN7 RazvanN7 changed the base branch from master to stable February 14, 2023 10:37
@RazvanN7
Copy link
Contributor Author

Fair enough. Targeting stable now.

@RazvanN7 RazvanN7 closed this Feb 14, 2023
@RazvanN7 RazvanN7 reopened this Feb 14, 2023
@RazvanN7 RazvanN7 merged commit e88ae0d into dlang:stable Feb 14, 2023
@ibuclaw ibuclaw mentioned this pull request Feb 16, 2023

void main ()
{
ubyte [0x7fff_fffe] x;
Copy link
Member

@ibuclaw ibuclaw Mar 16, 2023

Choose a reason for hiding this comment

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

This test fails on many platforms - especially i686 and other 32-bit architectures - as there is no space for the frame pointer - does this fail with a smaller number?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so, but perhaps static if (size_t.sizeof > 4) could be added.

Copy link
Member

Choose a reason for hiding this comment

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

FAOD, GCC enforces that the maximum size for local variables to occupy the stack to be:

ubyte [(1 << (size_t.sizeof * 8 - 1)) - 64 * size_t.sizeof] x;

That is per function, not per variable.

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.

5 participants