Skip to content

Commit 2b1d35c

Browse files
authored
Merge pull request #6842 from awlauria/mpir_opt_v3.1.x
v3.1.x: Try to prevent the compiler from optimizing out MPIR_Breakpoint().
2 parents add0446 + 8284873 commit 2b1d35c

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

176176
ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
177177

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

186204
/* local objects */

0 commit comments

Comments
 (0)