Skip to content

v3.0.x: Conform MPIR_Breakpoint to MPIR standard. #6988

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

Merged
merged 2 commits into from
Sep 19, 2019
Merged
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
20 changes: 16 additions & 4 deletions orte/orted/orted_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0};
int MPIR_force_to_main = 0;
static void orte_debugger_init_before_spawn(orte_job_t *jdata);

ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
ORTE_DECLSPEC void __opal_attribute_optnone__ MPIR_Breakpoint(void);

/*
* Attempt to prevent the compiler from optimizing out
Expand All @@ -190,14 +190,26 @@ ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
* See the following git issue for more discussion:
* https://github.com/open-mpi/ompi/issues/5501
*/
static volatile void* volatile noop_mpir_breakpoint_ptr = NULL;
volatile void* volatile orte_noop_mpir_breakpoint_ptr = NULL;

/*
* Breakpoint function for parallel debuggers
*/
void* MPIR_Breakpoint(void)
void MPIR_Breakpoint(void)
{
return noop_mpir_breakpoint_ptr;
/*
* Actually do something with this pointer to make
* sure the compiler does not optimize out this function.
* The compiler should be forced to keep this
* function around due to the volatile void* type.
*
* This pointer doesn't actually do anything other than
* prevent unwanted optimization, and
* *should not* be used anywhere else in the code.
* So pointing this to the weeds should be OK.
*/
orte_noop_mpir_breakpoint_ptr = (volatile void *) 0x42;
return;
}

/* local objects */
Expand Down