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 glibc assert: __assert -> __assert_fail #4667

Merged
merged 2 commits into from
May 24, 2024

Conversation

Connor-GH
Copy link
Contributor

ldc2 returns SIGSEGV instead of SIGABRT for any value of
assert in betterC (or -checkaction=C or defaultlib="" ...)
due to some improper usage of __assert. As per the C compilers,
(gcc, clang, etc.), __assert_fail should be used for C asserts.

See my related PR for DMD:

dlang/dmd#16515

Previously, glibc would use __assert, which causes a segmentation fault due to
strange internal behavior between D and C compilers. It is better practice to use
__assert_fail. See #16515 of dlang/dmd.
@Connor-GH
Copy link
Contributor Author

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.

otherwise looks good

gen/runtime.cpp Outdated Show resolved Hide resolved
gen/llvmhelpers.cpp Outdated Show resolved Hide resolved
@kinke
Copy link
Member

kinke commented May 23, 2024

Is there an upstream test for this?

@thewilsonator
Copy link
Contributor

No there is not

@thewilsonator thewilsonator merged commit c497e0a into ldc-developers:master May 24, 2024
19 checks passed
kinke added a commit to kinke/ldc that referenced this pull request Jun 12, 2024
Introduced in ldc-developers#4667 and reported in the announce dlang forum.
kinke added a commit that referenced this pull request Jun 13, 2024
Introduced in #4667 and reported in the announce dlang forum.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants