diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2024-10-02 19:09:18 +0200 |
---|---|---|
committer | Georg-Johann Lay <avr@gjlay.de> | 2024-10-02 19:09:18 +0200 |
commit | 77c3ef08e946306329070ea6415abe7d9e328cd6 (patch) | |
tree | 2f5bd4b27f08103aca44a3c8b51f52f90a0a4705 | |
parent | 524b9c2e6283d55dbe381dc463983d4fd7c9705a (diff) | |
download | gcc-77c3ef08e946306329070ea6415abe7d9e328cd6.zip gcc-77c3ef08e946306329070ea6415abe7d9e328cd6.tar.gz gcc-77c3ef08e946306329070ea6415abe7d9e328cd6.tar.bz2 |
testsuite/52641 - Make gcc.dg/strict-flex-array-3.c work on int != 32 bits.
PR testsuite/52641
gcc/testsuite/
* gcc.dg/strict-flex-array-3.c (expect) [AVR]: Use custom
version due to AVR-LibC limitations.
(stuff): Use __SIZEOF_INT__ instead of hard-coded values.
-rw-r--r-- | gcc/testsuite/gcc.dg/strict-flex-array-3.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/testsuite/gcc.dg/strict-flex-array-3.c b/gcc/testsuite/gcc.dg/strict-flex-array-3.c index f74ed96..064f779 100644 --- a/gcc/testsuite/gcc.dg/strict-flex-array-3.c +++ b/gcc/testsuite/gcc.dg/strict-flex-array-3.c @@ -17,6 +17,21 @@ } \ } while (0); +#ifdef __AVR__ +/* AVR-Libc doesn't support %zd, thus use %d for size_t. */ +#undef expect +#define expect(p, _v) do { \ + size_t v = _v; \ + if (p == v) \ + __builtin_printf ("ok: %s == %d\n", #p, p); \ + else \ + { \ + __builtin_printf ("WAT: %s == %d (expected %d)\n", #p, p, v); \ + FAIL (); \ + } \ +} while (0); +#endif /* AVR */ + struct trailing_array_1 { int a; int b; @@ -46,8 +61,8 @@ void __attribute__((__noinline__)) stuff( struct trailing_array_3 *trailing_0, struct trailing_array_4 *trailing_flex) { - expect(__builtin_object_size(normal->c, 1), 16); - expect(__builtin_object_size(trailing_1->c, 1), 4); + expect(__builtin_object_size(normal->c, 1), 4 * __SIZEOF_INT__); + expect(__builtin_object_size(trailing_1->c, 1), __SIZEOF_INT__); expect(__builtin_object_size(trailing_0->c, 1), 0); expect(__builtin_object_size(trailing_flex->c, 1), -1); } |