Skip to content

Commit 6c9f4b6

Browse files
authored
Merge pull request #6841 from awlauria/mpir_opt_v3.0.x
v3.0.x: Try to prevent the compiler from optimizing out MPIR_Breakpoint().
2 parents 47b6097 + 9f82a1e commit 6c9f4b6

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
@@ -174,12 +174,30 @@ static void orte_debugger_init_before_spawn(orte_job_t *jdata);
174174

175175
ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
176176

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

185203
/* local objects */

0 commit comments

Comments
 (0)