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

linker error with scope(exit) with betterC #3479

Closed
CodeMyst opened this issue Jun 27, 2020 · 3 comments
Closed

linker error with scope(exit) with betterC #3479

CodeMyst opened this issue Jun 27, 2020 · 3 comments

Comments

@CodeMyst
Copy link

so i dont really know much about compilers or linkers but i managed to create a reproducible code snippet which breaks only when using ldc.

https://run.dlang.io/is/NH9MGM

extern(C) int main() {
    int a = 5;
    scope(exit) a = 6;

    create(0, 1, "2");

    return 0;
}

void create(uint a, uint b, string c) {
}

the error is:

onlineapp-2f059b3.o:onlineapp.d:DW.ref._d_eh_personality: error: undefined reference to '_d_eh_personality'
collect2: error: ld returned 1 exit status
Error: /usr/bin/cc failed with status: 1

if you uncomment either the scope(exit) line or the create line everything compilers and works ok.

i dont know how to go even further with finding the cause of the issue so just gonna drop this here. this might be something obvious or an actual compiler/linker bug.

@CodeMyst
Copy link
Author

also seems like marking create with nothrow fixes it

@kinke
Copy link
Member

kinke commented Jun 28, 2020

I've added this to https://issues.dlang.org/show_bug.cgi?id=20897.

kinke added a commit to kinke/ldc that referenced this issue Jun 28, 2020
kinke added a commit that referenced this issue Jun 29, 2020
@kinke
Copy link
Member

kinke commented Jun 29, 2020

Thx for the report.

@kinke kinke closed this as completed Jun 29, 2020
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 a pull request may close this issue.

2 participants