You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Null checks in incorrect order in Cordb::Terminate #47463
If the variable was actually null, dereferencing it leads to undefined behaviour, so a compiler is free to assume that wont happen. A recent compiler might therefore remove the null check on line 1125 entirely. We should probably null-check m_rcEventThread everywhere, or remove the null-checks.
Activity
ghost added
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Just been looking at this for fun. I'm a beginner in this repo, so apologies if I'm doing something wrong.
I think the null check on line 1125 is superfluous because m_rcEventThread will always be null if m_initialized is false, and can be removed. and m_initialize is tested at the start of the function.
Would it be bad/good to turn m_initialized into a function IsIntialized() which tested !m_rcEventThread, or just use m_rcEventThread and remove m_initialized completely? And shouldn't it be called m_pEventThread?
other observations:
m_initialized uses a mix of lower case bool on initialization and uppercase BOOL in other parts. should be FALSE in ctor.
m_rcEventThread is not initialized to null in neither the ctor nor header. Is that for speed?
If anyone can help me find an automated test that covers this area - please tell me, as I'm failing to find one.
Other uses of m_rcEventThread are untested, and do not test m_initialized such as Cordb::RemoveProcess
I think the null check on line 1125 is superfluous because m_rcEventThread will always be null if m_initialized is false, and can be removed. and m_initialize is tested at the start of the function.
@GilesDMiddleton Agreed. I think the if check can be safely removed.
If anyone can help me find an automated test that covers this area - please tell me, as I'm failing to find one.
This part of the product is tested in a private repo.
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
Activity
tommcdon commentedon Jan 26, 2021
@omajid would you be interested in submitting a PR for this issue?
omajid commentedon Jan 26, 2021
Sure. I am not sure of the best fix: should I add additional guards for
NULL?GilesDMiddleton commentedon Apr 18, 2021
Just been looking at this for fun. I'm a beginner in this repo, so apologies if I'm doing something wrong.
I think the null check on line 1125 is superfluous because m_rcEventThread will always be null if m_initialized is false, and can be removed. and m_initialize is tested at the start of the function.
Would it be bad/good to turn m_initialized into a function IsIntialized() which tested !m_rcEventThread, or just use m_rcEventThread and remove m_initialized completely? And shouldn't it be called m_pEventThread?
other observations:
m_initialized uses a mix of lower case bool on initialization and uppercase BOOL in other parts. should be FALSE in ctor.
m_rcEventThread is not initialized to null in neither the ctor nor header. Is that for speed?
If anyone can help me find an automated test that covers this area - please tell me, as I'm failing to find one.
Other uses of m_rcEventThread are untested, and do not test m_initialized such as
Cordb::RemoveProcessAaronRobinsonMSFT commentedon Mar 10, 2022
@GilesDMiddleton Agreed. I think the
ifcheck can be safely removed.This part of the product is tested in a private repo.
dotnet-policy-service commentedon Oct 19, 2026
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This process is part of our issue cleanup automation.
dotnet-policy-service commentedon Oct 19, 2026
Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.
This process is part of our issue cleanup automation.
Remove redundant event thread null check in Cordb::Terminate (dotnet#…