This fixes the test failures introduced by the fix for PR115109.
Tested on x86_64 and also tested with -m32. 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. gcc/testsuite/Changelog: PR testsuite/115545 * gcc.dg/pr115109.c: Adapt test. * gcc.dg/c23-tag-enum-6.c: Adapt test. * gcc.dg/c23-tag-enum-7.c: Adapt test. diff --git a/gcc/testsuite/gcc.dg/c23-tag-enum-6.c b/gcc/testsuite/gcc.dg/c23-tag-enum-6.c index 29aef7ee3fd..d8d304d9b3d 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 d4c787c8f71..974735bf2ef 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 4baee0f3445..8245ff7fadb 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) };