Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,21 @@ if (CLR_CMAKE_HOST_UNIX)
# Disable frame pointer optimizations so profilers can get better call stacks
add_compile_options(-fno-omit-frame-pointer)

# Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
# using twos-complement representation (this is normally undefined according to the C++ spec).
add_compile_options(-fwrapv)
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0) OR
(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0))
Comment on lines +529 to +530
Copy link
Member

Choose a reason for hiding this comment

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

Any concern here about Clang on macOS? If so, this should use MATCHES instead of STREQUAL.

# Make signed overflow well-defined. Implies the following flags in clang-20 and above.
# -fwrapv - Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
# using twos-complement representation (this is normally undefined according to the C++ spec).
# -fwrapv-pointer - The same as -fwrapv but for pointers.
add_compile_options(-fno-strict-overflow)

# Suppress C++ strict aliasing rules. This matches our use of MSVC.
add_compile_options(-fno-strict-aliasing)
else()
# Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
# using twos-complement representation (this is normally undefined according to the C++ spec).
add_compile_options(-fwrapv)
endif()

if(CLR_CMAKE_HOST_APPLE)
# Clang will by default emit objc_msgSend stubs in Xcode 14, which ld from earlier Xcodes doesn't understand.
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/debug/di/rspriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -6404,8 +6404,8 @@ class CordbThread : public CordbBase, public ICorDebugThread,
// Lazily initialized.
EXCEPTION_RECORD * m_pExceptionRecord;

static const CorDebugUserState kInvalidUserState = CorDebugUserState(-1);
CorDebugUserState m_userState; // This is the current state of the
static const int kInvalidUserState = -1;
int m_userState; // This is the current state of the
// thread, at the time that the
// left side synchronized

Expand Down
12 changes: 6 additions & 6 deletions src/coreclr/debug/di/rsthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ CorDebugUserState CordbThread::GetUserState()
m_userState = pDAC->GetUserState(m_vmThreadToken);
}

return m_userState;
return (CorDebugUserState)m_userState;
}


Expand Down Expand Up @@ -887,7 +887,7 @@ HRESULT CordbThread::CreateStepper(ICorDebugStepper ** ppStepper)
//Returns true if current user state of a thread is USER_WAIT_SLEEP_JOIN
bool CordbThread::IsThreadWaitingOrSleeping()
{
CorDebugUserState userState = m_userState;
int userState = m_userState;
if (userState == kInvalidUserState)
{
//If m_userState is not ready, we'll read from DAC only part of it which
Expand Down Expand Up @@ -3721,14 +3721,14 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync()
LOG((LF_CORDB, LL_INFO10000, "CUT::SFCHFS: hijackCtx started as:\n"));
LogContext(GetHijackCtx());

// Save the thread's full context for all platforms except for x86 because we need the
// Save the thread's full context for all platforms except for x86 because we need the
// DT_CONTEXT_EXTENDED_REGISTERS to avoid getting incomplete information and corrupt the thread context
DT_CONTEXT context;
#ifdef TARGET_X86
#ifdef TARGET_X86
context.ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS;
#else
context.ContextFlags = DT_CONTEXT_FULL;
#endif
#endif

BOOL succ = DbiGetThreadContext(m_handle, &context);
_ASSERTE(succ);
Expand All @@ -3739,7 +3739,7 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync()
LOG((LF_CORDB, LL_ERROR, "CUT::SFCHFS: DbiGetThreadContext error=0x%x\n", error));
}

#ifdef TARGET_X86
#ifdef TARGET_X86
GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS;
#else
GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL;
Expand Down
Loading