Skip to content

Conversation

@am11
Copy link
Member

@am11 am11 commented Sep 9, 2021

This + #58871 fix all -Wmismatched-new-delete and -Wfree-nonheap-object reported by gcc11. I have removed the suppressions.

@ghost
Copy link

ghost commented Sep 9, 2021

I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label.

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Sep 9, 2021
@am11
Copy link
Member Author

am11 commented Sep 9, 2021

cc @janvorli, @josalem, @AaronRobinsonMSFT

I am leaving out Wplacement-new for now, as those are bit weird to reason about, e.g.

[ 28%] Building CXX object vm/eventing/eventpipe/CMakeFiles/eventpipe_objs.dir/runtime/src/native/eventpipe/ep.c.o
In file included from /runtime/src/coreclr/classlibnative/../vm/threads.h:157,
                 from /runtime/src/coreclr/classlibnative/../vm/simplerwlock.hpp:10,
                 from /runtime/src/coreclr/classlibnative/../vm/stubmgr.h:49,
                 from /runtime/src/coreclr/classlibnative/../vm/clsload.hpp:20,
                 from /runtime/src/coreclr/classlibnative/../vm/common.h:350,
                 from /runtime/src/coreclr/classlibnative/bcltype/arraynative.cpp:12:
/runtime/src/coreclr/classlibnative/../vm/stackingallocator.h: In member function 'void* StackingAllocator::UnsafeAllocNoThrow(unsigned int)':
/runtime/src/coreclr/classlibnative/../vm/stackingallocator.h:160:52: error: placement new constructing an object of type 'Sentinal' and size '16' in a region of type 'char*' and size '0' [-Werror=placement-new=]
  160 |         m_FirstBlock->m_Sentinal = new(m_FirstFree - sizeof(Sentinal)) Sentinal(m_FirstBlock->m_Sentinal);
      |                                        ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/runtime/src/coreclr/classlibnative/../vm/stackingallocator.h:200:23: note: at offset -16 from 'StackingAllocator::m_FirstFree' declared here
  200 |     char             *m_FirstFree;        // Pointer to first free byte in head block
      |                       ^~~~~~~~~~~

@am11 am11 changed the title Add delete operator to crst Add delete operator in crst Sep 9, 2021
@am11 am11 force-pushed the feature/address-warnings2 branch from d2721ad to 571c008 Compare September 9, 2021 16:40
@am11 am11 changed the title Add delete operator in crst Add delete operator in Crst class Sep 9, 2021
@AaronRobinsonMSFT AaronRobinsonMSFT added this to the 7.0.0 milestone Sep 9, 2021
@am11
Copy link
Member Author

am11 commented Sep 9, 2021

Failures are unrelated / known issues:
Win 11 is #58898, #58570 (comment)
Mono interpreter is #58893

@jkotas jkotas merged commit 8ea5d59 into dotnet:main Sep 10, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Oct 10, 2021
@am11 am11 deleted the feature/address-warnings2 branch April 3, 2023 23:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-VM-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants