Skip to content

Commit 00106f5

Browse files
committed
Try to prevent the compiler from optimizing out MPIR_Breakpoint().
Signed-off-by: Austen Lauria <[email protected]>
1 parent 5bd90ee commit 00106f5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

orte/orted/orted_submit.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,30 @@ static void orte_debugger_init_before_spawn(orte_job_t *jdata);
176176

177177
ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
178178

179+
/*
180+
* Attempt to prevent the compiler from optimizing out
181+
* MPIR_Breakpoint().
182+
*
183+
* Some older versions of automake can add -O3 to every
184+
* file via CFLAGS (which was demonstrated in automake v1.13.4),
185+
* so there is a possibility that the compiler will see
186+
* this function as a NOOP and optimize it out on older versions.
187+
* While using the current/recommended version of automake
188+
* does not do this, the following will help those
189+
* stuck with an older version, as well as guard against
190+
* future regressions.
191+
*
192+
* See the following git issue for more discussion:
193+
* https://github.com/open-mpi/ompi/issues/5501
194+
*/
195+
static volatile void* volatile noop_mpir_breakpoint_ptr = NULL;
196+
179197
/*
180198
* Breakpoint function for parallel debuggers
181199
*/
182200
void* MPIR_Breakpoint(void)
183201
{
184-
return NULL;
202+
return noop_mpir_breakpoint_ptr;
185203
}
186204

187205
/* local objects */

0 commit comments

Comments
 (0)