Closed as not planned
Closed as not planned
Description
Description
The pthread
function calls in gcc_stack_unix.c
currently do not check return values, which may lead to silent failures in stack attribute retrieval. This issue proposes adding assert()
statements to validate these function calls, ensuring that failures are detected early during development.
Affected File
src/runtime/cgo/gcc_stack_unix.c
Proposed Solution
- Include
<assert.h>
to useassert()
. - Wrap the following function calls with
assert()
to verify their return values:pthread_attr_init
pthread_getattr_np
pthread_attr_get_np
pthread_attr_getstack
- This ensures that the program fails fast in case of errors instead of continuing with invalid data.
Rationale
- Improves debugging by catching errors early.
- Prevents undefined behavior due to uninitialized or incorrect stack attributes.
Steps to Reproduce
- Run the existing code with a failing
pthread_attr_init
or related function. - Observe that errors might not be immediately visible without proper checks.
Expected Behavior
- The program should assert when
pthread
functions fail, providing clear debugging information.
Activity