-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Name collision between extern "C" functions can cause undefined behavior in safe code #24561
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
Comments
Hm this sounds like a bug, the compiler should be giving each of these |
On the nightlies it is an ICE:
|
Not sure if it is the same bug, but this also ICEs
|
I believe I'm having the same issue with nightly-2016-02-22. I posted a backtrace over here SkylerLipthay/interpolate_idents#7 and I'll be trying to debug this sometime soon. Unless the issue is very simple I won't have the ability to fix it, but I should be able to identify what the problem is. |
Closing in favor of #26201, that issue has a more up-to-date title. |
I'm generating
extern "C"
functions using macros. Since it's currently not possible to use$concat_ident
for function names, I can't give these functions unique names.I was hoping for rust's name mangling to take care of the issue; but unfortunately this doesn't work if the macro is used twice in the same function. This usually results in internal compiler errors for me, but on the playpen machine it's possible to produce undefined behavior in safe code:
Expected output:
b: 1
Actual output:
a: 1
playpen: application terminated abnormally with signal 4 (Illegal instruction)
The text was updated successfully, but these errors were encountered: