CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
// RUN: %clang_cc1 -verify %s
|
|
|
|
/* WG14 N736: yes
|
|
* preprocessor arithmetic done in intmax_t/uintmax_t
|
|
*/
|
|
|
|
// There is not a standard requirement that this relationships holds. If these
|
|
// asserts fail, it means we have another test scenario to consider.
|
|
_Static_assert(__INTMAX_MAX__ == __LONG_LONG_MAX__,
|
|
"intmax_t is not the same width as long long?");
|
|
_Static_assert((-__INTMAX_MAX__ - 1) == (-__LONG_LONG_MAX__ - 1LL),
|
|
"intmax_t is not the same width as long long?");
|
|
_Static_assert(__UINTMAX_MAX__ == (__LONG_LONG_MAX__ * 2ULL + 1ULL),
|
|
"uintmax_t is not the same width as unsigned long long?");
|
|
|
|
// Test that arithmetic on the largest positive signed intmax_t works.
|
|
#if 9223372036854775807LL + 0LL != 9223372036854775807LL
|
|
#error "uh oh"
|
|
#endif
|
|
|
|
// Same for negative.
|
|
#if -9223372036854775807LL - 1LL + 0LL != -9223372036854775807LL - 1LL
|
|
#error "uh oh"
|
|
#endif
|
|
|
|
// Then test the same for unsigned
|
|
#if 18446744073709551615ULL + 0ULL != 18446744073709551615ULL
|
|
#error "uh oh"
|
|
#endif
|
|
|
|
// Test that unsigned overflow causes silent wraparound.
|
|
#if 18446744073709551615ULL + 1ULL != 0 // Silently wraps to 0.
|
|
#error "uh oh"
|
|
#endif
|
|
|
|
#if 0ULL - 1ULL != 18446744073709551615ULL // Silently wraps to 0xFFFF'FFFF'FFFF'FFFF.
|
|
#error "uh oh"
|
|
#endif
|
|
|
|
// Now test that signed arithmetic that pushes us over a limit is properly
|
|
// diagnosed.
|
|
#if 9223372036854775807LL + 1LL // expected-warning {{integer overflow in preprocessor expression}}
|
|
#endif
|
|
|
|
#if -9223372036854775807LL - 2LL // expected-warning {{integer overflow in preprocessor expression}}
|
|
#endif
|
|
|