mpy-cross viper incompatibility with OBJ_REPR_B
Port, board and/or hardware
unix port, obj_repr_b, x86 (32-bit)
MicroPython version
based on v1.27.0-preview-154-g44986b1f04
Reproduction
- Make a 32-bit REPR_B "standard" or "coverage" build (from e.g., #17688)
- Run
RUN_TESTS_MPY_CROSS_FLAGS="--mpy-cross-flags=\"-march=x86 -msmall-int-bits=30\"" make -C ports/unix/ VARIANT=standard test_full_no_native# orVARIANT=coverage, depending
Expected behaviour
Tests pass
Observed behaviour
12 tests failed: micropython/native_gen.py micropython/native_misc.py micropython/native_try.py micropython/viper_import.py micropython/native_try_deep.py micropython/native_while.py micropython/native_with.py micropython/viper_misc3.py micropython/native_closure.py micropython/native_const.py micropython/native_for.py micropython/viper_with.py
I didn't dig deeply because native & viper were not important to my use case but I think that there are some assumptions about the encoding of small integer values as discussed in a related PR: https://github.com/micropython/micropython/pull/17688#issuecomment-3075383706
} else if (si->vtype == VTYPE_INT || si->vtype == VTYPE_UINT) {
ASM_MOV_REG_IMM(emit->as, reg_dest, (uintptr_t)MP_OBJ_NEW_SMALL_INT(si->data.u_imm));
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
uctypes incompatibility with OBJ_REPR_B
Port, board and/or hardware
unix, 32-bit, obj_repr_b
MicroPython version
based on v1.27.0-preview-154-g44986b1f04
Reproduction
- Make a build with OBJ_REPR_B
- Look at the uctypes constants
Expected behaviour
All the constants are distinct
Observed behaviour
Some of the constants are duplicates
>>> import uctypes
>>> assert uctypes.INT8 != uctypes.BFINT8
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AssertionError:
Additional Information
See more discussion at https://github.com/micropython/micropython/pull/17688#discussion_r2357500386
Patch to add a REPR_B coverage build to ci.sh:
diff --git a/tools/ci.sh b/tools/ci.sh
index 901059991e..5afe089ccb 100755
--- a/tools/ci.sh
+++ b/tools/ci.sh
@@ -543,6 +543,14 @@ CI_UNIX_OPTS_SANITIZE_UNDEFINED=(
LDFLAGS_EXTRA="-fsanitize=undefined -fno-sanitize=nonnull-attribute"
)
+CI_UNIX_OPTS_REPR_B=(
+ VARIANT=coverage
+ CFLAGS_EXTRA="-DMICROPY_OBJ_REPR=MICROPY_OBJ_REPR_B -Dmp_int_t=int32_t -Dmp_uint_t=uint32_t"
+ MICROPY_FORCE_32BIT=1
+ RUN_TESTS_MPY_CROSS_FLAGS="--mpy-cross-flags=\"-march=x86 -msmall-int-bits=30\""
+
+)
+
function ci_unix_build_helper {
make ${MAKEOPTS} -C mpy-cross
make ${MAKEOPTS} -C ports/unix "$@" submodules
@@ -688,6 +696,15 @@ function ci_unix_32bit_setup {
python3 --version
}
+function ci_unix_coverage_repr_b_build {
+ ci_unix_build_helper "${CI_UNIX_OPTS_REPR_B[@]}"
+ ci_unix_build_ffi_lib_helper gcc -m32
+}
+
+function ci_unix_coverage_repr_b_run_tests {
+ ci_unix_run_tests_helper "${CI_UNIX_OPTS_REPR_B[@]}"
+}
+
function ci_unix_coverage_32bit_build {
ci_unix_build_helper VARIANT=coverage MICROPY_FORCE_32BIT=1
ci_unix_build_ffi_lib_helper gcc -m32
--
2.47.3
Code of Conduct
Yes, I agree