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

Use init rather than ms extension syntax #55475

Merged
merged 1 commit into from
Jul 12, 2021
Merged

Conversation

am11
Copy link
Member

@am11 am11 commented Jul 11, 2021

Fixes gcc build.

Clang also gives the error as gcc when calling ctor function explicitly, but clang emits warning with -fms-extensions:

warning: explicit constructor calls are a Microsoft extension

gcc just does not support this extension (even with -fms-extensions). So lets fix it by rewriting it in ISO C++ syntax.

cc @BruceForstall, @janvorli

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jul 11, 2021
@am11
Copy link
Member Author

am11 commented Jul 11, 2021

With decltype, it apparently didn't clear head/tail or re-instantiated the list which was corrupting crossgen2. I have added a debug-only init method to simplify things.

@am11 am11 changed the title Use decltype rather than ms extension syntax Use init rather than ms extension syntax Jul 11, 2021
@jkoritzinsky
Copy link
Member

jkoritzinsky commented Jul 11, 2021

@am11 would doing a placement new + decltype work instead of adding the Init method?

Something like the following:

new (&ig->igBlocks) decltype(ig->igBlocks)(emitComp->getAllocator(CMK_LoopOpt))

@am11 am11 force-pushed the fix/gcc-build branch 2 times, most recently from f3f14dd to 8e60c0d Compare July 11, 2021 20:29
@am11
Copy link
Member Author

am11 commented Jul 11, 2021

Indeed, it is much cleaner. I was too pressed on making explicit ctor work with decltype, didn't thought of other (size_t) ctros. :)

@am11
Copy link
Member Author

am11 commented Jul 11, 2021

Looks like MSVC didn't resolve the correct type with decltype (it is resolving the type of Allocator rather than list<T,Allocator>).

@am11
Copy link
Member Author

am11 commented Jul 11, 2021

Reverted to init approach for now, which makes all compilers happy. :)

Copy link
Member

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

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

init shouldn't really be under DEBUG, but that's fine for now.

Sorry for the trouble...

@BruceForstall BruceForstall merged commit a459019 into dotnet:main Jul 12, 2021
@am11 am11 deleted the fix/gcc-build branch July 12, 2021 01:08
@ghost ghost locked as resolved and limited conversation to collaborators Aug 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants