This is an archive of the discontinued LLVM Phabricator instance.

Allow 32-bit pointer extensions to be used without -fms-extensions
AbandonedPublic

Authored by davezarzycki on May 9 2020, 7:34 AM.

Details

Summary

One should not need to use -fms-extensions in order to use 32-bit pointers on 64-bit platforms.

Diff Detail

Event Timeline

davezarzycki created this revision.May 9 2020, 7:34 AM
rnk added a comment.May 9 2020, 8:12 AM

Needs a test.

I believe these are only implemented for x86 in LLVM. What happens if you try to use this on non-x86? I wouldn't be surprised if we crash, but we should probably produce a proper error and test it.

In D79673#2028204, @rnk wrote:

Needs a test.

I believe these are only implemented for x86 in LLVM. What happens if you try to use this on non-x86? I wouldn't be surprised if we crash, but we should probably produce a proper error and test it.

I just tested top-of-tree clang -fms-extensions -target arm64-unknown-linux (sans this patch) and apparently the attributes are ignored, which could cause crashes at run time if a later compiler actually honors this attributes on non-x86 targets and people try to mix object files created by older and newer compilers.

I agree that the bugs you point out are worth fixing. That being said, I'm not looking to fix all of the bugs with these attributes with this patch. If it's okay, I'd like to focus on exposing the feature outside of -fms-extensions. If people want to ignore the Microsoft extension and design how this feature "should" work, that's fine too.

davezarzycki abandoned this revision.May 15 2020, 3:23 AM

I'm going to abandon this change for now. The problem is that the MS extensions are not as pervasive through the language as I wanted. For example, I'd really like them to work on aggregate types. This would allow all of the pointers to said types to not need annotation, unlike the current MS model.