Again, implicit kills the code!
See attached md file with my notes.
Using ubsan at wsjtx runtime,
there's a type mismatch in the f90 lib routines handling usec sleeping.
The C++ function `usleep_` expects to be given a pointer(reference) to a `int*8`,
but it is given a pointer to an `int*4` instead,
due to the implicit sizing in the f90 code calling `usleep_`.
See the back trace below.
I'm guessing that type casting the argument to usleep_ is sufficient,
but perhaps a module is order?
There are other calls to usleep, and they need attention too.
```
Running: /home/rrh/git-work/rrhtools/wsjt/build/jt9 -s WSJT-X -w 1 -m 3 -e /home/rrh/git-work/rrhtools/wsjt/build -a /home/rrh/.local/share/WSJT-X -t /tmp/WSJT-X
/home/rrh/Downloads/wsjtx_variants/roberthenry6bev-wsjt-rrh/lib/usleep.c:7:10: runtime error: load of misaligned address 0x7fffffff637c for type 'long unsigned int', which requires 8 byte alignment
0x7fffffff637c: note: pointer points here
a0 9d 7d 0c 30 75 00 00 90 63 ff ff ff 7f 00 00 00 40 ef ed ff 7f 00 00 50 67 ff ff ff 7f 00 00
^
#0 0x000000652a7e in usleep_ /home/rrh/Downloads/wsjtx_variants/roberthenry6bev-wsjt-rrh/lib/usleep.c:7
#1 0x0000004d633d in sleep_msec_ /home/rrh/Downloads/wsjtx_variants/roberthenry6bev-wsjt-rrh/lib/sec_midn.f90:8
#2 0x00000040d662 in jt9a_ /home/rrh/Downloads/wsjtx_variants/roberthenry6bev-wsjt-rrh/lib/jt9a.f90:40
#3 0x000000407078 in jt9 /home/rrh/Downloads/wsjtx_variants/roberthenry6bev-wsjt-rrh/lib/jt9.f90:211
#4 0x00000040d121 in main /home/rrh/Downloads/wsjtx_variants/roberthenry6bev-wsjt-rrh/lib/jt9.f90:6
#5 0x7ffff402a574 (/lib/x86_64-linux-gnu/libc.so.6+0x2a574) (BuildId: bc071219b774e887d2477b96fa792af74144ff37)
#6 0x7ffff402a627 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a627) (BuildId: bc071219b774e887d2477b96fa792af74144ff37)
#7 0x000000404b14 in _start (/home/rrh/git-work/rrhtools/wsjt/build/jt9+0x404b14)
```
Here's my diffs:
```
diff --git a/lib/sleep_msec.f90 b/lib/sleep_msec.f90
index 1a8dbe4f9..e94010392 100644
--- a/lib/sleep_msec.f90
+++ b/lib/sleep_msec.f90
@@ -1,4 +1,5 @@
subroutine sleep_msec(n)
- call usleep(n*1000)
+ use, intrinsic :: iso_fortran_env
+ call usleep(INT(n*1000, kind=INT64))
return
end subroutine sleep_msec
diff --git a/lib/sec_midn.f90 b/lib/sec_midn.f90
index 0bbe62c2c..85ffa4cc0 100644
--- a/lib/sec_midn.f90
+++ b/lib/sec_midn.f90
@@ -4,8 +4,7 @@ real function sec_midn()
end function sec_midn
subroutine sleep_msec(n)
-
- call usleep(1000*n)
-
+ use, intrinsic :: ISO_FORTRAN_ENV, only: INT64
+ call usleep(int(1000*n, kind=INT64))
return
end subroutine sleep_msec
```
_______________________________________________
wsjt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wsjt-devel