Skip to content

Commit

Permalink
[#1049] Fix gtm_jlong_t return type handling on 32-bit armv6l (regres…
Browse files Browse the repository at this point in the history
…sion in 9f916f6)

Background
----------
* The `java/callouts` subtest failed on armv6l with the following diff.

  ```diff
  7a8,67
  > 16c16
  > < Job returned -336177440569076945
  > ---
  > > Job returned -1277316960
  .
  .
  ```

Issue
-----
* Before 9f916f6, on 32-bit armv6l, a `ydb_jlong` type return value was handled in `sr_unix/op_fnfgncal.c`
  by converting the 8-byte contents of the pointer to the return value. This was done whether `starred`
  was TRUE or not. That is, the handling was the same for `gtm_jlong_t` and `gtm_jlong_t *`.

* But after 9f916f6, on 32-bit armv6l, a `ydb_jlong` type return value was handled differently for
  `gtm_jlong_t` and `gtm_jlong_t *`. Just like it was done on 64-bit systems. While the different
  handling is correct and needed for 64-bit systems, it is incorrect for 32-bit systems.

Fix
---
* The fix is to restore the same handling for `gtm_jlong_t` and `gtm_jlong_t *` for 32-bit systems.
  That is, there should be no `if (starred)` logic in the `#ifndef GTM64` case for `case ydb_jlong:`
  in `sr_unix/op_fnfgncal.c` like is there for the `#ifdef GTM64` case..
  • Loading branch information
nars1 committed Feb 19, 2024
1 parent e498f57 commit b01270b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions sr_unix/op_fnfgncal.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,18 @@ STATICFNDEF void extarg2mval(void *src, enum ydb_types typ, mval *dst, boolean_t
MV_FORCE_MVAL(dst, s_int_num);
break;
case ydb_jlong:
/* On 64-bit systems, "gtm_jlong_t *" is passed in using a pointer to the actual 8-byte value
* whereas a "gtm_jlong_t" is passed in as is. On 32-bit systems though, both "gtm_jlong_t"
* and "gtm_jlong_t *" are passed in using a pointer to the actual 8-byte value.
*/
# ifdef GTM64
if (starred)
s_int64_num = *((ydb_int64_t*)src);
s_int64_num = *((ydb_int64_t *)src);
else
s_int64_num = (ydb_int64_t)(intszofptr_t)src;
s_int64_num = (ydb_int64_t)src;
# else
s_int64_num = *((ydb_int64_t *)src);
# endif
MV_FORCE_64MVAL(dst, s_int64_num);
break;
case ydb_jfloat:
Expand Down

0 comments on commit b01270b

Please sign in to comment.