[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 09/12] libpoke: Fix a bug and add assertions to pvm_make_*
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH 09/12] libpoke: Fix a bug and add assertions to pvm_make_* |
Date: |
Thu, 27 May 2021 13:55:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Nice catch.
This is OK for both master and maint/poke-1.
Thanks!
> 2021-05-23 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
>
> * libpoke/pkl-gen.pks (struct_constructor): s/uint<64>/ulong<64>.
> * libpoke/pvm-val.c (pvm_make_int): Add assertion for `size` argument.
> (pvm_make_uint): Likewise.
> (pvm_make_long): Likewise.
> (pvm_make_ulong): Likewise.
> ---
> ChangeLog | 8 ++++++++
> libpoke/pkl-gen.pks | 2 +-
> libpoke/pvm-val.c | 4 ++++
> 3 files changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 08cbe123..77bc4ca7 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,11 @@
> +2021-05-23 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
> +
> + * libpoke/pkl-gen.pks (struct_constructor): s/uint<64>/ulong<64>.
> + * libpoke/pvm-val.c (pvm_make_int): Add assertion for `size` argument.
> + (pvm_make_uint): Likewise.
> + (pvm_make_long): Likewise.
> + (pvm_make_ulong): Likewise.
> +
> 2021-05-22 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
>
> * libpoke/pkl-rt.pk (_pkl_escape_string): New function.
> diff --git a/libpoke/pkl-gen.pks b/libpoke/pkl-gen.pks
> index 70f69485..1bd48fd1 100644
> --- a/libpoke/pkl-gen.pks
> +++ b/libpoke/pkl-gen.pks
> @@ -1343,7 +1343,7 @@
> ;; with its size.
> .c if (PKL_AST_TYPE_S_PINNED_P (@type_struct))
> .c {
> - push uint<64>0 ; ... ENAME EVAL EBOFF
> + push ulong<64>0 ; ... ENAME EVAL EBOFF
> dup ; ... ENAME EVAL EBOFF NEBOFF
> .c }
> .c else
> diff --git a/libpoke/pvm-val.c b/libpoke/pvm-val.c
> index 217d6703..b938c3ea 100644
> --- a/libpoke/pvm-val.c
> +++ b/libpoke/pvm-val.c
> @@ -43,24 +43,28 @@ static pvm_val any_type;
> pvm_val
> pvm_make_int (int32_t value, int size)
> {
> + assert (0 < size && size <= 32);
> return PVM_MAKE_INT (value, size);
> }
>
> pvm_val
> pvm_make_uint (uint32_t value, int size)
> {
> + assert (0 < size && size <= 32);
> return PVM_MAKE_UINT (value, size);
> }
>
> pvm_val
> pvm_make_long (int64_t value, int size)
> {
> + assert (0 < size && size <= 64);
> return PVM_MAKE_LONG_ULONG (value, size, PVM_VAL_TAG_LONG);
> }
>
> pvm_val
> pvm_make_ulong (uint64_t value, int size)
> {
> + assert (0 < size && size <= 64);
> return PVM_MAKE_LONG_ULONG (value, size, PVM_VAL_TAG_ULONG);
> }
- [PATCH 06/12] libpoke: Fix trivial errors, (continued)
- [PATCH 06/12] libpoke: Fix trivial errors, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 07/12] libpoke: Add `__pkl_unsafe_string_set` builtin, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 08/12] libpoke: Fix printf %v for strings to give valid literals, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 09/12] libpoke: Fix a bug and add assertions to pvm_make_*, Mohammad-Reza Nabipoor, 2021/05/25
- Re: [PATCH 09/12] libpoke: Fix a bug and add assertions to pvm_make_*,
Jose E. Marchesi <=
- [PATCH 10/12] libpoke: Add skeleton for string properties instructions, Mohammad-Reza Nabipoor, 2021/05/25
- [PATCH 11/12] libpoke: Add `format`, Mohammad-Reza Nabipoor, 2021/05/25
- Re: [PATCH 11/12] libpoke: Add `format`, Jose E. Marchesi, 2021/05/29
[PATCH 12/12] pvm.jitter: Wrap std string functions, Mohammad-Reza Nabipoor, 2021/05/25