If the flag '-m64' is used on a 32-bit architecture/machine having int32_t set to 'long', then these int32_t are forced to 64-bit ... So, ignore the effect of -m64 on these archs and ignore '64-bit only' tests on them. Reported-by: Uwe Kleine-König <uwe@xxxxxxxxxxxxxxxxx> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- target.c | 1 + validation/call-inlined.c | 1 + validation/cast-kinds-check.c | 1 + validation/cast-weirds.c | 1 + validation/compound-assign-type.c | 2 ++ validation/constant-suffix-64.c | 1 + validation/enum-bounds.c | 1 + validation/enum-sign-gcc.c | 1 + validation/expand/builtin-expect.c | 1 + validation/linear/bitfield-size.c | 1 + validation/linear/bool-cast-lp64.c | 1 + validation/linear/bool-cast.c | 1 + validation/linear/call-complex-pointer.c | 1 + validation/linear/cast-constants.c | 1 + validation/linear/degen-array.c | 1 + validation/linear/degen-function.c | 1 + validation/linear/deref-ptr-ptr.c | 1 + validation/linear/logical.c | 1 + validation/optim/cast-kinds.c | 1 + 19 files changed, 20 insertions(+) diff --git a/target.c b/target.c index f1f2a1d94..c2ab55490 100644 --- a/target.c +++ b/target.c @@ -86,6 +86,7 @@ void init_target(void) case MACH_PPC32: case MACH_MIPS32: case MACH_RISCV32: + arch_m64 = ARCH_LP32; int32_ctype = &long_ctype; uint32_ctype = &ulong_ctype; break; diff --git a/validation/call-inlined.c b/validation/call-inlined.c index b907ded60..3612c5c42 100644 --- a/validation/call-inlined.c +++ b/validation/call-inlined.c @@ -20,6 +20,7 @@ const char *qus(void) { return lstrip(messg); } /* * check-name: call-inlined * check-command: test-linearize -Wno-decl -m64 $file + * check-assert: sizeof(void*) == 8 * * check-output-start foo: diff --git a/validation/cast-kinds-check.c b/validation/cast-kinds-check.c index 7eb1ca1c8..9bab61688 100644 --- a/validation/cast-kinds-check.c +++ b/validation/cast-kinds-check.c @@ -3,6 +3,7 @@ /* * check-name: cast-kinds check * check-command: sparse -m64 -v -Wno-pointer-to-int-cast $file + * check-assert: sizeof(long == 8) * * check-error-start optim/cast-kinds.c:5:45: warning: cast drops bits diff --git a/validation/cast-weirds.c b/validation/cast-weirds.c index 7d0288829..a753c2989 100644 --- a/validation/cast-weirds.c +++ b/validation/cast-weirds.c @@ -10,6 +10,7 @@ static void * uint_2_vptr(uint a) { return (void *)a; } /* * check-name: cast-weirds * check-command: sparse -m64 $file + * check-assert: sizeof(void *) == 8 * * check-error-start cast-weirds.c:4:48: warning: non size-preserving integer to pointer cast diff --git a/validation/compound-assign-type.c b/validation/compound-assign-type.c index e13dcfcd2..2e06eba25 100644 --- a/validation/compound-assign-type.c +++ b/validation/compound-assign-type.c @@ -7,6 +7,8 @@ static unsigned int foo(unsigned int x, long a) /* * check-name: compound-assign-type * check-command: test-linearize -m64 $file + * check-assert: sizeof(long) == 8 + * * check-output-ignore * * check-output-excludes: divu\\.32 diff --git a/validation/constant-suffix-64.c b/validation/constant-suffix-64.c index e65706b02..672263318 100644 --- a/validation/constant-suffix-64.c +++ b/validation/constant-suffix-64.c @@ -7,6 +7,7 @@ static unsigned long b = BIGUL; /* * check-name: constant-suffix * check-command: sparse -m64 -Wconstant-suffix $file + * check-assert: sizeof(long) == 8 * * check-error-start constant-suffix-64.c:4:26: warning: constant 0xfffff00000000000U is so big it is unsigned long diff --git a/validation/enum-bounds.c b/validation/enum-bounds.c index 64ecd8bb4..49f7a1ed8 100644 --- a/validation/enum-bounds.c +++ b/validation/enum-bounds.c @@ -21,4 +21,5 @@ _Static_assert([typeof(IMM2)] == [long], ""); /* * check-name: enum-bounds * check-command: sparse -m64 $file + * check-assert: sizeof(long) == 8 */ diff --git a/validation/enum-sign-gcc.c b/validation/enum-sign-gcc.c index 5aa7983c1..03fa35907 100644 --- a/validation/enum-sign-gcc.c +++ b/validation/enum-sign-gcc.c @@ -60,4 +60,5 @@ _Static_assert(is_unsigned(D) == 1, "enum D"); /* * check-name: enum-sign-gcc * check-command: sparse -m64 $file + * check-assert: sizeof(long) == 8 */ diff --git a/validation/expand/builtin-expect.c b/validation/expand/builtin-expect.c index f4e0664bb..1b0c7c180 100644 --- a/validation/expand/builtin-expect.c +++ b/validation/expand/builtin-expect.c @@ -36,6 +36,7 @@ void *fptr(void *a) /* * check-name: builtin-expect * check-command: test-linearize -m64 -Wno-decl $file + * check-assert: sizeof(long) == 8 * * check-output-start flia: diff --git a/validation/linear/bitfield-size.c b/validation/linear/bitfield-size.c index 841bdd0a6..dcda930dc 100644 --- a/validation/linear/bitfield-size.c +++ b/validation/linear/bitfield-size.c @@ -40,6 +40,7 @@ void scpy(struct s *d, const struct s *s) /* * check-name: bitfield-size * check-command: test-linearize -m64 -Wno-decl -fdump-ir $file + * check-assert: sizeof(void *) == 8 * * check-output-start upostinc: diff --git a/validation/linear/bool-cast-lp64.c b/validation/linear/bool-cast-lp64.c index 9b2a020ae..caf0e6787 100644 --- a/validation/linear/bool-cast-lp64.c +++ b/validation/linear/bool-cast-lp64.c @@ -12,6 +12,7 @@ static _Bool ffun_e(void) { return (_Bool)ffun; } /* * check-name: bool-cast-pointer * check-command: test-linearize -m64 -fdump-ir $file + * check-assert: sizeof(void *) == 8 * * check-output-ignore * check-output-excludes: ptrtu\\. diff --git a/validation/linear/bool-cast.c b/validation/linear/bool-cast.c index 0438a94f6..1716d18b2 100644 --- a/validation/linear/bool-cast.c +++ b/validation/linear/bool-cast.c @@ -24,6 +24,7 @@ static _Bool fdbl_e(dbl a) { return (_Bool)a; } /* * check-name: bool-cast * check-command: test-linearize -m64 -fdump-ir=linearize $file + * check-assert: sizeof(void*) == 8 && sizeof(long) == 8 && sizeof(double) == 8 * * check-output-ignore * check-output-excludes: cast\\. diff --git a/validation/linear/call-complex-pointer.c b/validation/linear/call-complex-pointer.c index dc0ab07b3..2be35c5be 100644 --- a/validation/linear/call-complex-pointer.c +++ b/validation/linear/call-complex-pointer.c @@ -6,6 +6,7 @@ int foo(int p, int (*f0)(int), int (*f1)(int), int arg) /* * check-name: call-complex-pointer * check-command: test-linearize -m64 -Wno-decl $file + * check-assert: sizeof(void *) == 8 * * check-output-start foo: diff --git a/validation/linear/cast-constants.c b/validation/linear/cast-constants.c index c1fdab41e..2aaee2b44 100644 --- a/validation/linear/cast-constants.c +++ b/validation/linear/cast-constants.c @@ -53,6 +53,7 @@ static double float_2_double(void) { return (double)1.123F; } /* * check-name: cast-constants.c * check-command: test-linearize -m64 $file + * check-assert: sizeof(void *) == 8 && sizeof(long) == 8 && sizeof(double) == 8 * * check-output-start uint_2_int: diff --git a/validation/linear/degen-array.c b/validation/linear/degen-array.c index b8a6f4f66..32230dde3 100644 --- a/validation/linear/degen-array.c +++ b/validation/linear/degen-array.c @@ -7,6 +7,7 @@ int *fd(int i) { return a; } /* * check-name: degen-array * check-command: test-linearize -m64 -Wno-decl $file + * check-assert: sizeof(void *) == 8 * * check-output-start fa: diff --git a/validation/linear/degen-function.c b/validation/linear/degen-function.c index a7cff443c..e0b05e5f4 100644 --- a/validation/linear/degen-function.c +++ b/validation/linear/degen-function.c @@ -9,6 +9,7 @@ fun_t f1(void) { return *fun; } /* * check-name: degen-function * check-command: test-linearize -m64 -Wno-decl -fdump-ir=linearize $file + * check-assert: sizeof(void *) == 8 * * check-output-start fa: diff --git a/validation/linear/deref-ptr-ptr.c b/validation/linear/deref-ptr-ptr.c index 531d36370..1342990c4 100644 --- a/validation/linear/deref-ptr-ptr.c +++ b/validation/linear/deref-ptr-ptr.c @@ -6,6 +6,7 @@ char *foo(char **pfmt) /* * check-name: deref-ptr-ptr * check-command: test-linearize -m64 -Wno-decl $file + * check-assert: sizeof(void *) == 8 * * check-output-excludes: load[^.] * check-output-contains: load\\. diff --git a/validation/linear/logical.c b/validation/linear/logical.c index b190f6083..81a9ff42e 100644 --- a/validation/linear/logical.c +++ b/validation/linear/logical.c @@ -19,6 +19,7 @@ int ad(int i, struct S *b) { return i && b->d; } /* * check-name: logical * check-command: test-linearize -m64 -fdump-ir -Wno-decl $file + * check-assert: sizeof(void *) == 8 && sizeof(long) == 8 && sizeof(double) == 8 * * check-output-start os: diff --git a/validation/optim/cast-kinds.c b/validation/optim/cast-kinds.c index b144dc7ef..0ba8a156d 100644 --- a/validation/optim/cast-kinds.c +++ b/validation/optim/cast-kinds.c @@ -56,6 +56,7 @@ static double double_2_double(double a) { return a; } /* * check-name: cast-kinds * check-command: test-linearize -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -m64 $file + * check-assert: sizeof(void *) == 8 && sizeof(long) == 8 && sizeof(double) == 8 * * check-output-start uint_2_int: -- 2.20.0