While investigating PR32785 I noticed a missing return statement in
worker_func, and compiling with -Wreturn-type showed another in
function_that_segfaults:
...
$ gcc gdb/testsuite/gdb.threads/infcall-from-bp-cond-simple.c -Wreturn-type
infcall-from-bp-cond-simple.c: In function ‘function_that_segfaults’:
infcall-from-bp-cond-simple.c:46:1: warning: \
control reaches end of non-void function [-Wreturn-type]
46 | }
| ^
infcall-from-bp-cond-simple.c: In function ‘worker_func’:
infcall-from-bp-cond-simple.c:58:1: warning: \
control reaches end of non-void function [-Wreturn-type]
58 | }
| ^
...
Fix these by adding the missing returns.
{
int *p = 0;
*p = 1; /* Segfault happens here. */
+ return 0;
}
int
worker_func (void *arg)
{
int a = 42; /* Breakpoint here. */
+ return NULL;
}
void