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 Bugzilla 24773: don't invoke destructors on uninitialized elements in stable sort #9049

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

s-ludwig
Copy link
Member

Uses a regular initialized temporary array when sorting elements with an elaborate assignment to avoid undefined behavior when destructors, postblits or copy constructors are invoked during the array assignment.

@dlang-bot
Copy link
Contributor

dlang-bot commented Sep 20, 2024

Thanks for your pull request, @s-ludwig!

Bugzilla references

Auto-close Bugzilla Severity Description
24773 normal Stable sort() invokes the destructor on uninitialized elements

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#9049"

@s-ludwig s-ludwig force-pushed the issue24773_stablesort_destructor branch from df307a1 to 3b15836 Compare September 20, 2024 09:17
Copy link
Contributor

@thewilsonator thewilsonator left a comment

Choose a reason for hiding this comment

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

Does this Fix issue 24773? If so please retitle the commit message "Fix bugzillla 24773: ...". Otherwise looks good.

@s-ludwig s-ludwig changed the title Bugzilla 24773 - don't invoke destructors on uninitialized elements in stable sort Fix Bugzilla 24773 - don't invoke destructors on uninitialized elements in stable sort Sep 20, 2024
@s-ludwig s-ludwig changed the title Fix Bugzilla 24773 - don't invoke destructors on uninitialized elements in stable sort Fix Bugzilla 24773: don't invoke destructors on uninitialized elements in stable sort Sep 20, 2024
@s-ludwig s-ludwig force-pushed the issue24773_stablesort_destructor branch from 3b15836 to 0915d7a Compare September 20, 2024 09:45
…s in stable sort

Uses a regular initialized temporary array when sorting elements with an elaborate assignment to avoid undefined behavior when destructors, postblits or copy constructors are invoked during the array assignment.
@s-ludwig s-ludwig force-pushed the issue24773_stablesort_destructor branch from 0915d7a to cfd577b Compare September 20, 2024 10:25
@dlang-bot dlang-bot merged commit 2168bec into dlang:master Sep 20, 2024
10 checks passed
@s-ludwig s-ludwig deleted the issue24773_stablesort_destructor branch September 20, 2024 12:09
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.

3 participants