Skip to content

Commit 3ee28a5

Browse files
authored
Merge pull request #6988 from awlauria/fix_mpir_standard_v3.0.x
v3.0.x: Conform MPIR_Breakpoint to MPIR standard.
2 parents 87dfebb + 71c4c19 commit 3ee28a5

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

orte/orted/orted_submit.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0};
172172
int MPIR_force_to_main = 0;
173173
static void orte_debugger_init_before_spawn(orte_job_t *jdata);
174174

175-
ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
175+
ORTE_DECLSPEC void __opal_attribute_optnone__ MPIR_Breakpoint(void);
176176

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

195195
/*
196196
* Breakpoint function for parallel debuggers
197197
*/
198-
void* MPIR_Breakpoint(void)
198+
void MPIR_Breakpoint(void)
199199
{
200-
return noop_mpir_breakpoint_ptr;
200+
/*
201+
* Actually do something with this pointer to make
202+
* sure the compiler does not optimize out this function.
203+
* The compiler should be forced to keep this
204+
* function around due to the volatile void* type.
205+
*
206+
* This pointer doesn't actually do anything other than
207+
* prevent unwanted optimization, and
208+
* *should not* be used anywhere else in the code.
209+
* So pointing this to the weeds should be OK.
210+
*/
211+
orte_noop_mpir_breakpoint_ptr = (volatile void *) 0x42;
212+
return;
201213
}
202214

203215
/* local objects */

0 commit comments

Comments
 (0)