diff options
author | Martin Uecker <uecker@tugraz.at> | 2024-06-23 09:10:20 +0200 |
---|---|---|
committer | Martin Uecker <uecker@gcc.gnu.org> | 2024-07-09 23:21:04 +0200 |
commit | 5b46f196cdb62af0e611315ea411938d756a0ad1 (patch) | |
tree | 736d49286f282c96e2e3fd59a16c405bc4b440e3 | |
parent | 7825c07bbaf503c47ecedd87e3d64be003b24f2c (diff) | |
download | gcc-5b46f196cdb62af0e611315ea411938d756a0ad1.zip gcc-5b46f196cdb62af0e611315ea411938d756a0ad1.tar.gz gcc-5b46f196cdb62af0e611315ea411938d756a0ad1.tar.bz2 |
Fix test errors after r15-1394 for sizeof(int)==sizeof(long) [PR115545]
Some tests added to test the type of redeclarations of enumerators
in r15-1394 fail on architectures where sizeof(long) == sizeof(int).
Adapt tests to use long long and/or accept that long long is selected
as type for the enumerator.
PR testsuite/115545
gcc/testsuite/
* gcc.dg/pr115109.c: Adapt test.
* gcc.dg/c23-tag-enum-6.c: Adapt test.
* gcc.dg/c23-tag-enum-7.c: Adapt test.
-rw-r--r-- | gcc/testsuite/gcc.dg/c23-tag-enum-6.c | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/c23-tag-enum-7.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr115109.c | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/gcc/testsuite/gcc.dg/c23-tag-enum-6.c b/gcc/testsuite/gcc.dg/c23-tag-enum-6.c index 29aef7e..d8d304d 100644 --- a/gcc/testsuite/gcc.dg/c23-tag-enum-6.c +++ b/gcc/testsuite/gcc.dg/c23-tag-enum-6.c @@ -7,10 +7,10 @@ enum E : int { a = 1, b = 2 }; enum E : int { b = _Generic(a, enum E: 2), a = 1 }; enum H { x = 1 }; -enum H { x = 2UL + UINT_MAX }; /* { dg-error "outside the range" } */ +enum H { x = 2ULL + UINT_MAX }; /* { dg-error "outside the range" } */ enum K : int { z = 1 }; -enum K : int { z = 2UL + UINT_MAX }; /* { dg-error "outside the range" } */ +enum K : int { z = 2ULL + UINT_MAX }; /* { dg-error "outside the range" } */ enum F { A = 0, B = UINT_MAX }; enum F { B = UINT_MAX, A }; /* { dg-error "outside the range" } */ diff --git a/gcc/testsuite/gcc.dg/c23-tag-enum-7.c b/gcc/testsuite/gcc.dg/c23-tag-enum-7.c index d4c787c..974735b 100644 --- a/gcc/testsuite/gcc.dg/c23-tag-enum-7.c +++ b/gcc/testsuite/gcc.dg/c23-tag-enum-7.c @@ -4,23 +4,23 @@ #include <limits.h> // enumerators are all representable in int -enum E { a = 1UL, b = _Generic(a, int: 2) }; +enum E { a = 1ULL, b = _Generic(a, int: 2) }; static_assert(_Generic(a, int: 1)); static_assert(_Generic(b, int: 1)); -enum E { a = 1UL, b = _Generic(a, int: 2) }; +enum E { a = 1ULL, b = _Generic(a, int: 2) }; static_assert(_Generic(a, int: 1)); static_assert(_Generic(b, int: 1)); // enumerators are not representable in int -enum H { c = 1UL << (UINT_WIDTH + 1), d = 2 }; +enum H { c = 1ULL << (UINT_WIDTH + 1), d = 2 }; static_assert(_Generic(c, enum H: 1)); static_assert(_Generic(d, enum H: 1)); -enum H { c = 1UL << (UINT_WIDTH + 1), d = _Generic(c, enum H: 2) }; +enum H { c = 1ULL << (UINT_WIDTH + 1), d = _Generic(c, enum H: 2) }; static_assert(_Generic(c, enum H: 1)); static_assert(_Generic(d, enum H: 1)); // there is an overflow in the first declaration -enum K { e = UINT_MAX, f, g = _Generic(e, unsigned int: 0) + _Generic(f, unsigned long: 1) }; +enum K { e = UINT_MAX, f, g = _Generic(e, unsigned int: 0) + _Generic(f, unsigned long: 1, unsigned long long: 1) }; static_assert(_Generic(e, enum K: 1)); static_assert(_Generic(f, enum K: 1)); static_assert(_Generic(g, enum K: 1)); @@ -30,7 +30,7 @@ static_assert(_Generic(f, enum K: 1)); static_assert(_Generic(g, enum K: 1)); // there is an overflow in the first declaration -enum U { k = INT_MAX, l, m = _Generic(k, int: 0) + _Generic(l, long: 1) }; +enum U { k = INT_MAX, l, m = _Generic(k, int: 0) + _Generic(l, long: 1, long long: 1) }; static_assert(_Generic(k, enum U: 1)); static_assert(_Generic(l, enum U: 1)); static_assert(_Generic(m, enum U: 1)); diff --git a/gcc/testsuite/gcc.dg/pr115109.c b/gcc/testsuite/gcc.dg/pr115109.c index 4baee0f..8245ff7 100644 --- a/gcc/testsuite/gcc.dg/pr115109.c +++ b/gcc/testsuite/gcc.dg/pr115109.c @@ -3,6 +3,6 @@ #include <limits.h> -enum E { a = 1UL << (ULONG_WIDTH - 5), b = 2 }; -enum E { a = 1ULL << (ULONG_WIDTH - 5), b = _Generic(a, enum E: 2) }; +enum E { a = 1ULL << (ULLONG_WIDTH - 5), b = 2 }; +enum E { a = 1ULL << (ULLONG_WIDTH - 5), b = _Generic(a, enum E: 2) }; |