Skip to content

Commit 4a0dfee

Browse files
committed
valgrid suppress struct pack nanosleep
1 parent 9de584a commit 4a0dfee

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,18 @@ GCC ≥ 9 and Intel oneAPI have ISO_Fortran_binding.h
9393

9494
## Notes
9595

96+
### struct memory alignment
97+
98+
Some examples use scalar C struct.
99+
ISO_C_BINDING handles mapping struct to/from Fortran TYPE.
100+
For arrays of struct, compiler
101+
[pragma may be needed](https://stackoverflow.com/questions/53161673/data-alignment-inside-a-structure-in-intel-fortran).
102+
103+
Valgrind needed suppression to avoid memory alignment (uninitialized memory) warnings for C struct input to nanosleep.
96104
### MacOS
97105

98106
For MacOS with Apple's Clang and Homebrew GCC,
99-
it MAY be needed to have in ~/.zprofile like the following:
107+
it MAY be needed to have in ~/.zshrc like the following:
100108
(check directory / versions on your Mac)
101109

102110
```sh

memcheck.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ INCLUDE ${include}
8989
INCLUDE_LABEL ${include_label}
9090
EXCLUDE ${exclude}
9191
EXCLUDE_LABEL ${exclude_label}
92+
PARALLEL_LEVEL ${Ncpu}
9293
RETURN_VALUE ret
9394
CAPTURE_CMAKE_ERROR err
9495
DEFECT_COUNT count

src/sleep/reference/posix_nanosleep.f90

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module sleep_std
2+
!! https://man7.org/linux/man-pages/man2/nanosleep.2.html
23
use, intrinsic :: iso_c_binding, only : C_INT, C_LONG
34
implicit none
45

valgrind.supp

+9
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@
66
fun:objconstruct_C
77
fun:main
88
}
9+
{
10+
nanosleep-isinit-req
11+
Memcheck:Param
12+
nanosleep(req)
13+
fun:nanosleep
14+
fun:__sleep_std_MOD_sleep_ms
15+
fun:MAIN__
16+
fun:main
17+
}

0 commit comments

Comments
 (0)