@@ -174,7 +174,7 @@ char MPIR_attach_fifo[MPIR_MAX_PATH_LENGTH] = {0};
174
174
int MPIR_force_to_main = 0 ;
175
175
static void orte_debugger_init_before_spawn (orte_job_t * jdata );
176
176
177
- ORTE_DECLSPEC void * __opal_attribute_optnone__ MPIR_Breakpoint (void );
177
+ ORTE_DECLSPEC void __opal_attribute_optnone__ MPIR_Breakpoint (void );
178
178
179
179
/*
180
180
* Attempt to prevent the compiler from optimizing out
@@ -192,14 +192,26 @@ ORTE_DECLSPEC void* __opal_attribute_optnone__ MPIR_Breakpoint(void);
192
192
* See the following git issue for more discussion:
193
193
* https://github.com/open-mpi/ompi/issues/5501
194
194
*/
195
- static volatile void * volatile noop_mpir_breakpoint_ptr = NULL ;
195
+ volatile void * volatile noop_mpir_breakpoint_ptr = NULL ;
196
196
197
197
/*
198
198
* Breakpoint function for parallel debuggers
199
199
*/
200
- void * MPIR_Breakpoint (void )
200
+ void MPIR_Breakpoint (void )
201
201
{
202
- return noop_mpir_breakpoint_ptr ;
202
+ /*
203
+ * Actually do something with this pointer to make
204
+ * sure the compiler does not optimize out this function.
205
+ * The compiler should be forced to keep this
206
+ * function around due to the volatile void* type.
207
+ *
208
+ * This pointer doesn't actually do anything other than
209
+ * prevent unwanted optimization, and
210
+ * *should not* be used anywhere else in the code.
211
+ * So pointing this to the weeds should be OK.
212
+ */
213
+ noop_mpir_breakpoint_ptr = (volatile void * ) 0x42 ;
214
+ return ;
203
215
}
204
216
205
217
/* local objects */
0 commit comments