@@ -172,7 +172,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0};
172
172
int MPIR_force_to_main = 0 ;
173
173
static void orte_debugger_init_before_spawn (orte_job_t * jdata );
174
174
175
- ORTE_DECLSPEC void * __opal_attribute_optnone__ MPIR_Breakpoint (void );
175
+ ORTE_DECLSPEC void __opal_attribute_optnone__ MPIR_Breakpoint (void );
176
176
177
177
/*
178
178
* Attempt to prevent the compiler from optimizing out
@@ -190,14 +190,26 @@ ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
190
190
* See the following git issue for more discussion:
191
191
* https://github.com/open-mpi/ompi/issues/5501
192
192
*/
193
- static volatile void * volatile noop_mpir_breakpoint_ptr = NULL ;
193
+ volatile void * volatile orte_noop_mpir_breakpoint_ptr = NULL ;
194
194
195
195
/*
196
196
* Breakpoint function for parallel debuggers
197
197
*/
198
- void * MPIR_Breakpoint (void )
198
+ void MPIR_Breakpoint (void )
199
199
{
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 ;
201
213
}
202
214
203
215
/* local objects */
0 commit comments