Skip to content

Conversation

@gc00
Copy link
Collaborator

@gc00 gc00 commented Dec 24, 2025

The first commit is a test program that will trigger mc_report_undefined_behavior_on_fail for MCCondEnqueue. When McMini is run on this example, the "PENDING TRANSITIONS" is not correct. Hence, the user would be confused on what was the error.

The second commit fixes the logic in MCCondEnqueue.cpp to correctly display the PENDING TRANSITIONS. The commit message explains the bug and the fix:

MCCondEnqueue: mc_report_...: bad next transitions
 * Before calling mc_report_undefined_behavior_on_fail(),
   we need to call MCStack::setNextTranstion(), or else the
   "PENDING TRANSTIONS" displayed to the user will be incorrect.
 * While this fixes MCCondEnqueue, we will need to apply the same
   logic to the other transitions.
 * For testing, try condvar-two-mutexes.c, which has a bug in which
   the associated mutex of a condition variable is different from
   the mutex argument of pthread_cond_wait().

This is a draft, since we will need to apply the same fix to the logic of all of the transitions. (And perhaps we can add checks for correct usage of pthread_mutex_lock/unlock, while we're at it.

@gc00 gc00 added the type: bug-fix The PR resolves a bug. The bug need not be explicitly marked via an issue label Dec 24, 2025
@gc00 gc00 changed the title Improve re Improve mc_report_undefined_behavior_on_fail with correct PENDING TRANSITIONS Dec 24, 2025
@gc00 gc00 force-pushed the improve-report-on-fail branch 2 times, most recently from c7019de to 2b80e31 Compare December 25, 2025 01:14
 * Before calling mc_report_undefined_behavior_on_fail(),
   we need to call MCStack::setNextTranstion(), or else the
   "PENDING TRANSTIONS" displayed to the user will be incorrect.
 * While this fixes MCCondEnqueue, we will need to apply the same
   logic to the other transitions.
 * For testing, try condvar-two-mutexes.c, which has a bug in which
   the associated mutex of a condition variable is different from
   the mutex argument of pthread_cond_wait().
@gc00 gc00 force-pushed the improve-report-on-fail branch from 2b80e31 to 8c92288 Compare December 25, 2025 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug-fix The PR resolves a bug. The bug need not be explicitly marked via an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants