| File: | root/firefox-clang/mfbt/tests/TestArrayUtils.cpp |
| Warning: | line 224, column 43 Addition of a null pointer (from variable 'derivedBegin') and a nonzero integer value results in undefined behavior |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public | |||
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, | |||
| 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ | |||
| 4 | ||||
| 5 | #include "mozilla/ArrayUtils.h" | |||
| 6 | #include "mozilla/Assertions.h" | |||
| 7 | ||||
| 8 | using mozilla::IsInRange; | |||
| 9 | ||||
| 10 | static void TestIsInRangeNonClass() { | |||
| 11 | void* nul = nullptr; | |||
| 12 | int* intBegin = nullptr; | |||
| 13 | int* intEnd = intBegin + 1; | |||
| 14 | int* intEnd2 = intBegin + 2; | |||
| 15 | ||||
| 16 | MOZ_RELEASE_ASSERT(IsInRange(nul, intBegin, intEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, intBegin, intEnd))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(IsInRange(nul, intBegin, intEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(nul, intBegin, intEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 16); do { } while (false); do { MOZ_CrashSequence(__null, 16 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 17 | MOZ_RELEASE_ASSERT(!IsInRange(nul, intEnd, intEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, intEnd, intEnd2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!IsInRange(nul, intEnd, intEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(nul, intEnd, intEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 17); do { } while (false); do { MOZ_CrashSequence(__null, 17 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 18 | ||||
| 19 | MOZ_RELEASE_ASSERT(IsInRange(intBegin, intBegin, intEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(intBegin, intBegin, intEnd))>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !(IsInRange(intBegin, intBegin, intEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(intBegin, intBegin, intEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 19); do { } while (false); do { MOZ_CrashSequence(__null, 19); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 20 | MOZ_RELEASE_ASSERT(!IsInRange(intEnd, intBegin, intEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(intEnd, intBegin, intEnd))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!IsInRange(intEnd, intBegin, intEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(intEnd, intBegin, intEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 20); do { } while (false); do { MOZ_CrashSequence(__null, 20 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 21 | ||||
| 22 | MOZ_RELEASE_ASSERT(IsInRange(intBegin, intBegin, intEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(intBegin, intBegin, intEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(intBegin, intBegin, intEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(intBegin, intBegin, intEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 22); do { } while (false); do { MOZ_CrashSequence(__null, 22); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 23 | MOZ_RELEASE_ASSERT(IsInRange(intEnd, intBegin, intEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(intEnd, intBegin, intEnd2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(IsInRange(intEnd, intBegin, intEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(intEnd, intBegin, intEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 23); do { } while (false); do { MOZ_CrashSequence(__null, 23 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 24 | MOZ_RELEASE_ASSERT(!IsInRange(intEnd2, intBegin, intEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(intEnd2, intBegin, intEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(intEnd2, intBegin, intEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(intEnd2, intBegin, intEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 24); do { } while (false); do { MOZ_CrashSequence(__null, 24); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 25 | ||||
| 26 | uintptr_t uintBegin = uintptr_t(intBegin); | |||
| 27 | uintptr_t uintEnd = uintptr_t(intEnd); | |||
| 28 | uintptr_t uintEnd2 = uintptr_t(intEnd2); | |||
| 29 | ||||
| 30 | MOZ_RELEASE_ASSERT(IsInRange(nul, uintBegin, uintEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, uintBegin, uintEnd))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(IsInRange(nul, uintBegin, uintEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(nul, uintBegin, uintEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 30); do { } while (false); do { MOZ_CrashSequence(__null, 30 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 31 | MOZ_RELEASE_ASSERT(!IsInRange(nul, uintEnd, uintEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, uintEnd, uintEnd2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!IsInRange(nul, uintEnd, uintEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(nul, uintEnd, uintEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 31); do { } while (false); do { MOZ_CrashSequence(__null, 31 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 32 | ||||
| 33 | MOZ_RELEASE_ASSERT(IsInRange(intBegin, uintBegin, uintEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(intBegin, uintBegin, uintEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(intBegin, uintBegin, uintEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(intBegin, uintBegin, uintEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 33); do { } while (false); do { MOZ_CrashSequence(__null, 33); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 34 | MOZ_RELEASE_ASSERT(!IsInRange(intEnd, uintBegin, uintEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(intEnd, uintBegin, uintEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(intEnd, uintBegin, uintEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(intEnd, uintBegin, uintEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 34); do { } while (false); do { MOZ_CrashSequence(__null, 34); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 35 | ||||
| 36 | MOZ_RELEASE_ASSERT(IsInRange(intBegin, uintBegin, uintEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(intBegin, uintBegin, uintEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(intBegin, uintBegin, uintEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(intBegin, uintBegin, uintEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 36); do { } while (false); do { MOZ_CrashSequence(__null, 36); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 37 | MOZ_RELEASE_ASSERT(IsInRange(intEnd, uintBegin, uintEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(intEnd, uintBegin, uintEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(intEnd, uintBegin, uintEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(intEnd, uintBegin, uintEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 37); do { } while (false); do { MOZ_CrashSequence(__null, 37); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 38 | MOZ_RELEASE_ASSERT(!IsInRange(intEnd2, uintBegin, uintEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(intEnd2, uintBegin, uintEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(intEnd2, uintBegin, uintEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(intEnd2, uintBegin, uintEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 38); do { } while (false); do { MOZ_CrashSequence(__null, 38); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 39 | } | |||
| 40 | ||||
| 41 | static void TestIsInRangeVoid() { | |||
| 42 | int* intBegin = nullptr; | |||
| 43 | int* intEnd = intBegin + 1; | |||
| 44 | int* intEnd2 = intBegin + 2; | |||
| 45 | ||||
| 46 | void* voidBegin = intBegin; | |||
| 47 | void* voidEnd = intEnd; | |||
| 48 | void* voidEnd2 = intEnd2; | |||
| 49 | ||||
| 50 | MOZ_RELEASE_ASSERT(IsInRange(voidBegin, intBegin, intEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidBegin, intBegin, intEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidBegin, intBegin, intEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidBegin, intBegin, intEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 50); do { } while (false); do { MOZ_CrashSequence(__null, 50); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 51 | MOZ_RELEASE_ASSERT(!IsInRange(voidEnd, intBegin, intEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(voidEnd, intBegin, intEnd))>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !(!IsInRange(voidEnd, intBegin, intEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(voidEnd, intBegin, intEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 51); do { } while (false); do { MOZ_CrashSequence(__null, 51); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 52 | ||||
| 53 | MOZ_RELEASE_ASSERT(IsInRange(voidBegin, voidBegin, voidEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidBegin, voidBegin, voidEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidBegin, voidBegin, voidEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidBegin, voidBegin, voidEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 53); do { } while (false); do { MOZ_CrashSequence(__null, 53); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 54 | MOZ_RELEASE_ASSERT(!IsInRange(voidEnd, voidBegin, voidEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(voidEnd, voidBegin, voidEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(voidEnd, voidBegin, voidEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(voidEnd, voidBegin, voidEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 54); do { } while (false); do { MOZ_CrashSequence(__null, 54); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 55 | ||||
| 56 | MOZ_RELEASE_ASSERT(IsInRange(voidBegin, intBegin, intEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidBegin, intBegin, intEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidBegin, intBegin, intEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidBegin, intBegin, intEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 56); do { } while (false); do { MOZ_CrashSequence(__null, 56); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 57 | MOZ_RELEASE_ASSERT(IsInRange(voidEnd, intBegin, intEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidEnd, intBegin, intEnd2))>::isValid, "invalid assertion condition"); if ((__builtin_expect(!!(!(! !(IsInRange(voidEnd, intBegin, intEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidEnd, intBegin, intEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 57); do { } while (false); do { MOZ_CrashSequence(__null, 57); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 58 | MOZ_RELEASE_ASSERT(!IsInRange(voidEnd2, intBegin, intEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(voidEnd2, intBegin, intEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(voidEnd2, intBegin, intEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(voidEnd2, intBegin, intEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 58); do { } while (false); do { MOZ_CrashSequence(__null, 58); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 59 | ||||
| 60 | MOZ_RELEASE_ASSERT(IsInRange(voidBegin, voidBegin, voidEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidBegin, voidBegin, voidEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidBegin, voidBegin, voidEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidBegin, voidBegin, voidEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 60); do { } while (false); do { MOZ_CrashSequence(__null, 60); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 61 | MOZ_RELEASE_ASSERT(IsInRange(voidEnd, voidBegin, voidEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidEnd, voidBegin, voidEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidEnd, voidBegin, voidEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidEnd, voidBegin, voidEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 61); do { } while (false); do { MOZ_CrashSequence(__null, 61); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 62 | MOZ_RELEASE_ASSERT(!IsInRange(voidEnd2, voidBegin, voidEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(voidEnd2, voidBegin, voidEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(voidEnd2, voidBegin, voidEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(voidEnd2, voidBegin, voidEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 62); do { } while (false); do { MOZ_CrashSequence(__null, 62); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 63 | ||||
| 64 | uintptr_t uintBegin = uintptr_t(intBegin); | |||
| 65 | uintptr_t uintEnd = uintptr_t(intEnd); | |||
| 66 | uintptr_t uintEnd2 = uintptr_t(intEnd2); | |||
| 67 | ||||
| 68 | MOZ_RELEASE_ASSERT(IsInRange(voidBegin, uintBegin, uintEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidBegin, uintBegin, uintEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidBegin, uintBegin, uintEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidBegin, uintBegin, uintEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 68); do { } while (false); do { MOZ_CrashSequence(__null, 68); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 69 | MOZ_RELEASE_ASSERT(!IsInRange(voidEnd, uintBegin, uintEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(voidEnd, uintBegin, uintEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(voidEnd, uintBegin, uintEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(voidEnd, uintBegin, uintEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 69); do { } while (false); do { MOZ_CrashSequence(__null, 69); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 70 | ||||
| 71 | MOZ_RELEASE_ASSERT(IsInRange(voidBegin, uintBegin, uintEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidBegin, uintBegin, uintEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidBegin, uintBegin, uintEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidBegin, uintBegin, uintEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 71); do { } while (false); do { MOZ_CrashSequence(__null, 71); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 72 | MOZ_RELEASE_ASSERT(IsInRange(voidEnd, uintBegin, uintEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(voidEnd, uintBegin, uintEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(voidEnd, uintBegin, uintEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(voidEnd, uintBegin, uintEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 72); do { } while (false); do { MOZ_CrashSequence(__null, 72); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 73 | MOZ_RELEASE_ASSERT(!IsInRange(voidEnd2, uintBegin, uintEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(voidEnd2, uintBegin, uintEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(voidEnd2, uintBegin, uintEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(voidEnd2, uintBegin, uintEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 73); do { } while (false); do { MOZ_CrashSequence(__null, 73); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 74 | } | |||
| 75 | ||||
| 76 | struct Base { | |||
| 77 | int mX; | |||
| 78 | }; | |||
| 79 | ||||
| 80 | static void TestIsInRangeClass() { | |||
| 81 | void* nul = nullptr; | |||
| 82 | Base* baseBegin = nullptr; | |||
| 83 | Base* baseEnd = baseBegin + 1; | |||
| 84 | Base* baseEnd2 = baseBegin + 2; | |||
| 85 | ||||
| 86 | MOZ_RELEASE_ASSERT(IsInRange(nul, baseBegin, baseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, baseBegin, baseEnd))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(IsInRange(nul, baseBegin, baseEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(nul, baseBegin, baseEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 86); do { } while (false); do { MOZ_CrashSequence(__null, 86 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 87 | MOZ_RELEASE_ASSERT(!IsInRange(nul, baseEnd, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, baseEnd, baseEnd2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!IsInRange(nul, baseEnd, baseEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(nul, baseEnd, baseEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 87); do { } while (false); do { MOZ_CrashSequence(__null, 87 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 88 | ||||
| 89 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, baseBegin, baseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, baseBegin, baseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, baseBegin, baseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, baseBegin, baseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 89); do { } while (false); do { MOZ_CrashSequence(__null, 89); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 90 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, baseBegin, baseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, baseBegin, baseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd, baseBegin, baseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd, baseBegin, baseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 90); do { } while (false); do { MOZ_CrashSequence(__null, 90); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 91 | ||||
| 92 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, baseBegin, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, baseBegin, baseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, baseBegin, baseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, baseBegin, baseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 92); do { } while (false); do { MOZ_CrashSequence(__null, 92); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 93 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, baseBegin, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, baseBegin, baseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseEnd, baseBegin, baseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseEnd, baseBegin, baseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 93); do { } while (false); do { MOZ_CrashSequence(__null, 93); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 94 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, baseBegin, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, baseBegin, baseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd2, baseBegin, baseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd2, baseBegin, baseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 94); do { } while (false); do { MOZ_CrashSequence(__null, 94); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 95 | ||||
| 96 | uintptr_t ubaseBegin = uintptr_t(baseBegin); | |||
| 97 | uintptr_t ubaseEnd = uintptr_t(baseEnd); | |||
| 98 | uintptr_t ubaseEnd2 = uintptr_t(baseEnd2); | |||
| 99 | ||||
| 100 | MOZ_RELEASE_ASSERT(IsInRange(nul, ubaseBegin, ubaseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, ubaseBegin, ubaseEnd))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(IsInRange(nul, ubaseBegin, ubaseEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(nul, ubaseBegin, ubaseEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 100); do { } while (false); do { MOZ_CrashSequence(__null, 100 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 101 | MOZ_RELEASE_ASSERT(!IsInRange(nul, ubaseEnd, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, ubaseEnd, ubaseEnd2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!IsInRange(nul, ubaseEnd, ubaseEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(nul, ubaseEnd, ubaseEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 101); do { } while (false); do { MOZ_CrashSequence(__null, 101 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 102 | ||||
| 103 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, ubaseBegin, ubaseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, ubaseBegin, ubaseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, ubaseBegin, ubaseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, ubaseBegin, ubaseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 103); do { } while (false); do { MOZ_CrashSequence(__null, 103); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 104 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, ubaseBegin, ubaseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, ubaseBegin, ubaseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd, ubaseBegin, ubaseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd, ubaseBegin, ubaseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 104); do { } while (false); do { MOZ_CrashSequence(__null, 104); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 105 | ||||
| 106 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, ubaseBegin, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, ubaseBegin, ubaseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, ubaseBegin, ubaseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, ubaseBegin, ubaseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 106); do { } while (false); do { MOZ_CrashSequence(__null, 106); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 107 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, ubaseBegin, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, ubaseBegin, ubaseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseEnd, ubaseBegin, ubaseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseEnd, ubaseBegin, ubaseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 107); do { } while (false); do { MOZ_CrashSequence(__null, 107); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 108 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 108); do { } while (false); do { MOZ_CrashSequence(__null, 108); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 109 | } | |||
| 110 | ||||
| 111 | struct EmptyBase {}; | |||
| 112 | ||||
| 113 | static void TestIsInRangeEmptyClass() { | |||
| 114 | void* nul = nullptr; | |||
| 115 | EmptyBase* baseBegin = nullptr; | |||
| 116 | EmptyBase* baseEnd = baseBegin + 1; | |||
| 117 | EmptyBase* baseEnd2 = baseBegin + 2; | |||
| 118 | ||||
| 119 | MOZ_RELEASE_ASSERT(IsInRange(nul, baseBegin, baseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, baseBegin, baseEnd))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(IsInRange(nul, baseBegin, baseEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(nul, baseBegin, baseEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 119); do { } while (false); do { MOZ_CrashSequence(__null, 119 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 120 | MOZ_RELEASE_ASSERT(!IsInRange(nul, baseEnd, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, baseEnd, baseEnd2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!IsInRange(nul, baseEnd, baseEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(nul, baseEnd, baseEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 120); do { } while (false); do { MOZ_CrashSequence(__null, 120 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 121 | ||||
| 122 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, baseBegin, baseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, baseBegin, baseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, baseBegin, baseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, baseBegin, baseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 122); do { } while (false); do { MOZ_CrashSequence(__null, 122); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 123 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, baseBegin, baseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, baseBegin, baseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd, baseBegin, baseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd, baseBegin, baseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 123); do { } while (false); do { MOZ_CrashSequence(__null, 123); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 124 | ||||
| 125 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, baseBegin, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, baseBegin, baseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, baseBegin, baseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, baseBegin, baseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 125); do { } while (false); do { MOZ_CrashSequence(__null, 125); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 126 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, baseBegin, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, baseBegin, baseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseEnd, baseBegin, baseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseEnd, baseBegin, baseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 126); do { } while (false); do { MOZ_CrashSequence(__null, 126); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 127 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, baseBegin, baseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, baseBegin, baseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd2, baseBegin, baseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd2, baseBegin, baseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 127); do { } while (false); do { MOZ_CrashSequence(__null, 127); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 128 | ||||
| 129 | uintptr_t ubaseBegin = uintptr_t(baseBegin); | |||
| 130 | uintptr_t ubaseEnd = uintptr_t(baseEnd); | |||
| 131 | uintptr_t ubaseEnd2 = uintptr_t(baseEnd2); | |||
| 132 | ||||
| 133 | MOZ_RELEASE_ASSERT(IsInRange(nul, ubaseBegin, ubaseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, ubaseBegin, ubaseEnd))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(IsInRange(nul, ubaseBegin, ubaseEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(nul, ubaseBegin, ubaseEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 133); do { } while (false); do { MOZ_CrashSequence(__null, 133 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 134 | MOZ_RELEASE_ASSERT(!IsInRange(nul, ubaseEnd, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, ubaseEnd, ubaseEnd2))>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(!IsInRange(nul, ubaseEnd, ubaseEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(nul, ubaseEnd, ubaseEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 134); do { } while (false); do { MOZ_CrashSequence(__null, 134 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 135 | ||||
| 136 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, ubaseBegin, ubaseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, ubaseBegin, ubaseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, ubaseBegin, ubaseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, ubaseBegin, ubaseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 136); do { } while (false); do { MOZ_CrashSequence(__null, 136); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 137 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, ubaseBegin, ubaseEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, ubaseBegin, ubaseEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd, ubaseBegin, ubaseEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd, ubaseBegin, ubaseEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 137); do { } while (false); do { MOZ_CrashSequence(__null, 137); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 138 | ||||
| 139 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, ubaseBegin, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, ubaseBegin, ubaseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseBegin, ubaseBegin, ubaseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, ubaseBegin, ubaseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 139); do { } while (false); do { MOZ_CrashSequence(__null, 139); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 140 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, ubaseBegin, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, ubaseBegin, ubaseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(baseEnd, ubaseBegin, ubaseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseEnd, ubaseBegin, ubaseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 140); do { } while (false); do { MOZ_CrashSequence(__null, 140); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 141 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd2, ubaseBegin, ubaseEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 141); do { } while (false); do { MOZ_CrashSequence(__null, 141); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 142 | } | |||
| 143 | ||||
| 144 | struct Derived : Base {}; | |||
| 145 | ||||
| 146 | static void TestIsInRangeClassDerived() { | |||
| 147 | void* nul = nullptr; | |||
| 148 | Derived* derivedBegin = nullptr; | |||
| 149 | Derived* derivedEnd = derivedBegin + 1; | |||
| 150 | Derived* derivedEnd2 = derivedBegin + 2; | |||
| 151 | ||||
| 152 | Base* baseBegin = static_cast<Base*>(derivedBegin); | |||
| 153 | Base* baseEnd = static_cast<Base*>(derivedEnd); | |||
| 154 | Base* baseEnd2 = static_cast<Base*>(derivedEnd2); | |||
| 155 | ||||
| 156 | MOZ_RELEASE_ASSERT(IsInRange(nul, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, derivedBegin, derivedEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(nul, derivedBegin, derivedEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(nul, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 156); do { } while (false); do { MOZ_CrashSequence(__null, 156); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 157 | MOZ_RELEASE_ASSERT(!IsInRange(nul, derivedEnd, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, derivedEnd, derivedEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(nul, derivedEnd, derivedEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(nul, derivedEnd, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 157); do { } while (false); do { MOZ_CrashSequence(__null, 157); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 158 | ||||
| 159 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedBegin, derivedEnd))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedBegin, derivedEnd)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 159); do { } while (false); do { MOZ_CrashSequence(__null, 159); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 160 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, derivedBegin, derivedEnd))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd, derivedBegin, derivedEnd)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 160); do { } while (false); do { MOZ_CrashSequence(__null, 160); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 161 | ||||
| 162 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedBegin, derivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedBegin, derivedEnd2)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 162); do { } while (false); do { MOZ_CrashSequence(__null, 162); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 163 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, derivedBegin, derivedEnd2))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseEnd, derivedBegin, derivedEnd2)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseEnd, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 163); do { } while (false); do { MOZ_CrashSequence(__null, 163); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 164 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, derivedBegin, derivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd2, derivedBegin, derivedEnd2)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd2, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 164); do { } while (false); do { MOZ_CrashSequence(__null, 164); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 165 | ||||
| 166 | uintptr_t uderivedBegin = uintptr_t(derivedBegin); | |||
| 167 | uintptr_t uderivedEnd = uintptr_t(derivedEnd); | |||
| 168 | uintptr_t uderivedEnd2 = uintptr_t(derivedEnd2); | |||
| 169 | ||||
| 170 | MOZ_RELEASE_ASSERT(IsInRange(derivedBegin, uderivedBegin, uderivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedBegin, uderivedBegin, uderivedEnd)) >::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedBegin, uderivedBegin, uderivedEnd)) )), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(derivedBegin, uderivedBegin, uderivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 170); do { } while (false); do { MOZ_CrashSequence(__null, 170); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 171 | MOZ_RELEASE_ASSERT(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(derivedEnd, uderivedBegin, uderivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 171); do { } while (false); do { MOZ_CrashSequence(__null, 171); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 172 | ||||
| 173 | MOZ_RELEASE_ASSERT(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2) )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "IsInRange(derivedBegin, uderivedBegin, uderivedEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 173); do { } while (false); do { MOZ_CrashSequence(__null, 173 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 174 | MOZ_RELEASE_ASSERT(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(derivedEnd, uderivedBegin, uderivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 174); do { } while (false); do { MOZ_CrashSequence(__null, 174); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 175 | MOZ_RELEASE_ASSERT(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2) )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 175); do { } while (false); do { MOZ_CrashSequence(__null, 175 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 176 | } | |||
| 177 | ||||
| 178 | struct DerivedEmpty : EmptyBase {}; | |||
| 179 | ||||
| 180 | static void TestIsInRangeClassDerivedEmpty() { | |||
| 181 | void* nul = nullptr; | |||
| 182 | DerivedEmpty* derivedEmptyBegin = nullptr; | |||
| 183 | DerivedEmpty* derivedEmptyEnd = derivedEmptyBegin + 1; | |||
| 184 | DerivedEmpty* derivedEmptyEnd2 = derivedEmptyBegin + 2; | |||
| 185 | ||||
| 186 | EmptyBase* baseBegin = static_cast<EmptyBase*>(derivedEmptyBegin); | |||
| 187 | EmptyBase* baseEnd = static_cast<EmptyBase*>(derivedEmptyEnd); | |||
| 188 | EmptyBase* baseEnd2 = static_cast<EmptyBase*>(derivedEmptyEnd2); | |||
| 189 | ||||
| 190 | MOZ_RELEASE_ASSERT(IsInRange(nul, derivedEmptyBegin, derivedEmptyEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, derivedEmptyBegin, derivedEmptyEnd))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(nul, derivedEmptyBegin, derivedEmptyEnd))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(nul, derivedEmptyBegin, derivedEmptyEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 190); do { } while (false); do { MOZ_CrashSequence(__null, 190); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 191 | MOZ_RELEASE_ASSERT(!IsInRange(nul, derivedEmptyEnd, derivedEmptyEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, derivedEmptyEnd, derivedEmptyEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(nul, derivedEmptyEnd, derivedEmptyEnd2))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(nul, derivedEmptyEnd, derivedEmptyEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 191); do { } while (false); do { MOZ_CrashSequence(__null, 191); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 192 | ||||
| 193 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 193); do { } while (false); do { MOZ_CrashSequence(__null, 193 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 194 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 194); do { } while (false); do { MOZ_CrashSequence(__null, 194 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 195 | ||||
| 196 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(baseBegin, derivedEmptyBegin, derivedEmptyEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 196); do { } while (false); do { MOZ_CrashSequence(__null, 196); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 197 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(baseEnd, derivedEmptyBegin, derivedEmptyEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 197); do { } while (false); do { MOZ_CrashSequence(__null, 197 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 198 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, derivedEmptyBegin, derivedEmptyEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, derivedEmptyBegin, derivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd2, derivedEmptyBegin, derivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(baseEnd2, derivedEmptyBegin, derivedEmptyEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 198); do { } while (false); do { MOZ_CrashSequence(__null, 198); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 199 | ||||
| 200 | uintptr_t uderivedEmptyBegin = uintptr_t(derivedEmptyBegin); | |||
| 201 | uintptr_t uderivedEmptyEnd = uintptr_t(derivedEmptyEnd); | |||
| 202 | uintptr_t uderivedEmptyEnd2 = uintptr_t(derivedEmptyEnd2); | |||
| 203 | ||||
| 204 | MOZ_RELEASE_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 205); do { } while (false); do { MOZ_CrashSequence(__null, 205); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false) | |||
| 205 | IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 205); do { } while (false); do { MOZ_CrashSequence(__null, 205); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 206 | MOZ_RELEASE_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 207); do { } while (false); do { MOZ_CrashSequence(__null, 207); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false) | |||
| 207 | !IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 207); do { } while (false); do { MOZ_CrashSequence(__null, 207); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 208 | ||||
| 209 | MOZ_RELEASE_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 210); do { } while (false); do { MOZ_CrashSequence(__null, 210); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false) | |||
| 210 | IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(derivedEmptyBegin, uderivedEmptyBegin, uderivedEmptyEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 210); do { } while (false); do { MOZ_CrashSequence(__null, 210); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 211 | MOZ_RELEASE_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 212); do { } while (false); do { MOZ_CrashSequence(__null, 212); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false) | |||
| 212 | IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("IsInRange(derivedEmptyEnd, uderivedEmptyBegin, uderivedEmptyEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 212); do { } while (false); do { MOZ_CrashSequence(__null, 212); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 213 | MOZ_RELEASE_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEmptyEnd2, uderivedEmptyBegin, uderivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEmptyEnd2, uderivedEmptyBegin, uderivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(derivedEmptyEnd2, uderivedEmptyBegin, uderivedEmptyEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 214); do { } while (false); do { MOZ_CrashSequence(__null, 214); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false) | |||
| 214 | !IsInRange(derivedEmptyEnd2, uderivedEmptyBegin, uderivedEmptyEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEmptyEnd2, uderivedEmptyBegin, uderivedEmptyEnd2 ))>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEmptyEnd2, uderivedEmptyBegin, uderivedEmptyEnd2 )))), 0))) { do { } while (false); MOZ_ReportAssertionFailure ("!IsInRange(derivedEmptyEnd2, uderivedEmptyBegin, uderivedEmptyEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 214); do { } while (false); do { MOZ_CrashSequence(__null, 214); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 215 | } | |||
| 216 | ||||
| 217 | struct ExtraDerived : Base { | |||
| 218 | int y; | |||
| 219 | }; | |||
| 220 | ||||
| 221 | static void TestIsInRangeClassExtraDerived() { | |||
| 222 | void* nul = nullptr; | |||
| 223 | ExtraDerived* derivedBegin = nullptr; | |||
| ||||
| 224 | ExtraDerived* derivedEnd = derivedBegin + 1; | |||
| ||||
| 225 | ExtraDerived* derivedEnd2 = derivedBegin + 2; | |||
| 226 | ||||
| 227 | Base* baseBegin = static_cast<Base*>(derivedBegin); | |||
| 228 | Base* baseEnd = static_cast<Base*>(derivedEnd); | |||
| 229 | Base* baseEnd2 = static_cast<Base*>(derivedEnd2); | |||
| 230 | ||||
| 231 | MOZ_RELEASE_ASSERT(IsInRange(nul, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, derivedBegin, derivedEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(nul, derivedBegin, derivedEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(nul, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 231); do { } while (false); do { MOZ_CrashSequence(__null, 231); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 232 | MOZ_RELEASE_ASSERT(!IsInRange(nul, derivedEnd, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, derivedEnd, derivedEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(nul, derivedEnd, derivedEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(nul, derivedEnd, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 232); do { } while (false); do { MOZ_CrashSequence(__null, 232); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 233 | ||||
| 234 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedBegin, derivedEnd))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedBegin, derivedEnd)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 234); do { } while (false); do { MOZ_CrashSequence(__null, 234); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 235 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, derivedBegin, derivedEnd))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd, derivedBegin, derivedEnd)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 235); do { } while (false); do { MOZ_CrashSequence(__null, 235); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 236 | ||||
| 237 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedBegin, derivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedBegin, derivedEnd2)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 237); do { } while (false); do { MOZ_CrashSequence(__null, 237); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 238 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, derivedBegin, derivedEnd2))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseEnd, derivedBegin, derivedEnd2)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseEnd, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 238); do { } while (false); do { MOZ_CrashSequence(__null, 238); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 239 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, derivedBegin, derivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd2, derivedBegin, derivedEnd2)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd2, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 239); do { } while (false); do { MOZ_CrashSequence(__null, 239); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 240 | ||||
| 241 | uintptr_t uderivedBegin = uintptr_t(derivedBegin); | |||
| 242 | uintptr_t uderivedEnd = uintptr_t(derivedEnd); | |||
| 243 | uintptr_t uderivedEnd2 = uintptr_t(derivedEnd2); | |||
| 244 | ||||
| 245 | MOZ_RELEASE_ASSERT(IsInRange(derivedBegin, uderivedBegin, uderivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedBegin, uderivedBegin, uderivedEnd)) >::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedBegin, uderivedBegin, uderivedEnd)) )), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(derivedBegin, uderivedBegin, uderivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 245); do { } while (false); do { MOZ_CrashSequence(__null, 245); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 246 | MOZ_RELEASE_ASSERT(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(derivedEnd, uderivedBegin, uderivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 246); do { } while (false); do { MOZ_CrashSequence(__null, 246); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 247 | ||||
| 248 | MOZ_RELEASE_ASSERT(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2) )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "IsInRange(derivedBegin, uderivedBegin, uderivedEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 248); do { } while (false); do { MOZ_CrashSequence(__null, 248 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 249 | MOZ_RELEASE_ASSERT(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(derivedEnd, uderivedBegin, uderivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 249); do { } while (false); do { MOZ_CrashSequence(__null, 249); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 250 | MOZ_RELEASE_ASSERT(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2) )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 250); do { } while (false); do { MOZ_CrashSequence(__null, 250 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 251 | } | |||
| 252 | ||||
| 253 | struct ExtraDerivedEmpty : EmptyBase { | |||
| 254 | int y; | |||
| 255 | }; | |||
| 256 | ||||
| 257 | static void TestIsInRangeClassExtraDerivedEmpty() { | |||
| 258 | void* nul = nullptr; | |||
| 259 | ExtraDerivedEmpty* derivedBegin = nullptr; | |||
| 260 | ExtraDerivedEmpty* derivedEnd = derivedBegin + 1; | |||
| 261 | ExtraDerivedEmpty* derivedEnd2 = derivedBegin + 2; | |||
| 262 | ||||
| 263 | EmptyBase* baseBegin = static_cast<EmptyBase*>(derivedBegin); | |||
| 264 | EmptyBase* baseEnd = static_cast<EmptyBase*>(derivedEnd); | |||
| 265 | EmptyBase* baseEnd2 = static_cast<EmptyBase*>(derivedEnd2); | |||
| 266 | ||||
| 267 | MOZ_RELEASE_ASSERT(IsInRange(nul, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(nul, derivedBegin, derivedEnd))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(IsInRange(nul, derivedBegin, derivedEnd)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(nul, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 267); do { } while (false); do { MOZ_CrashSequence(__null, 267); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 268 | MOZ_RELEASE_ASSERT(!IsInRange(nul, derivedEnd, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(nul, derivedEnd, derivedEnd2))>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!(!IsInRange(nul, derivedEnd, derivedEnd2)))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(nul, derivedEnd, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 268); do { } while (false); do { MOZ_CrashSequence(__null, 268); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 269 | ||||
| 270 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedBegin, derivedEnd))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedBegin, derivedEnd)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 270); do { } while (false); do { MOZ_CrashSequence(__null, 270); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 271 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd, derivedBegin, derivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd, derivedBegin, derivedEnd))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd, derivedBegin, derivedEnd)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd, derivedBegin, derivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 271); do { } while (false); do { MOZ_CrashSequence(__null, 271); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 272 | ||||
| 273 | MOZ_RELEASE_ASSERT(IsInRange(baseBegin, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseBegin, derivedBegin, derivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseBegin, derivedBegin, derivedEnd2)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseBegin, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 273); do { } while (false); do { MOZ_CrashSequence(__null, 273); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 274 | MOZ_RELEASE_ASSERT(IsInRange(baseEnd, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(baseEnd, derivedBegin, derivedEnd2))>:: isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(baseEnd, derivedBegin, derivedEnd2)))), 0) )) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(baseEnd, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 274); do { } while (false); do { MOZ_CrashSequence(__null, 274); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 275 | MOZ_RELEASE_ASSERT(!IsInRange(baseEnd2, derivedBegin, derivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(baseEnd2, derivedBegin, derivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(baseEnd2, derivedBegin, derivedEnd2)))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(baseEnd2, derivedBegin, derivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 275); do { } while (false); do { MOZ_CrashSequence(__null, 275); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 276 | ||||
| 277 | uintptr_t uderivedBegin = uintptr_t(derivedBegin); | |||
| 278 | uintptr_t uderivedEnd = uintptr_t(derivedEnd); | |||
| 279 | uintptr_t uderivedEnd2 = uintptr_t(derivedEnd2); | |||
| 280 | ||||
| 281 | MOZ_RELEASE_ASSERT(IsInRange(derivedBegin, uderivedBegin, uderivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedBegin, uderivedBegin, uderivedEnd)) >::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedBegin, uderivedBegin, uderivedEnd)) )), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(derivedBegin, uderivedBegin, uderivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 281); do { } while (false); do { MOZ_CrashSequence(__null, 281); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 282 | MOZ_RELEASE_ASSERT(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEnd, uderivedBegin, uderivedEnd))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("!IsInRange(derivedEnd, uderivedBegin, uderivedEnd)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 282); do { } while (false); do { MOZ_CrashSequence(__null, 282); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 283 | ||||
| 284 | MOZ_RELEASE_ASSERT(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2) )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedBegin, uderivedBegin, uderivedEnd2) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "IsInRange(derivedBegin, uderivedBegin, uderivedEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 284); do { } while (false); do { MOZ_CrashSequence(__null, 284 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 285 | MOZ_RELEASE_ASSERT(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))> ::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(IsInRange(derivedEnd, uderivedBegin, uderivedEnd2))) ), 0))) { do { } while (false); MOZ_ReportAssertionFailure("IsInRange(derivedEnd, uderivedBegin, uderivedEnd2)" , "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp", 285); do { } while (false); do { MOZ_CrashSequence(__null, 285); __attribute__ ((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 286 | MOZ_RELEASE_ASSERT(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2))do { static_assert( mozilla::detail::AssertionConditionType< decltype(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2) )>::isValid, "invalid assertion condition"); if ((__builtin_expect (!!(!(!!(!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2) ))), 0))) { do { } while (false); MOZ_ReportAssertionFailure( "!IsInRange(derivedEnd2, uderivedBegin, uderivedEnd2)", "/root/firefox-clang/mfbt/tests/TestArrayUtils.cpp" , 286); do { } while (false); do { MOZ_CrashSequence(__null, 286 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); | |||
| 287 | } | |||
| 288 | ||||
| 289 | int main() { | |||
| 290 | TestIsInRangeNonClass(); | |||
| 291 | TestIsInRangeVoid(); | |||
| 292 | TestIsInRangeClass(); | |||
| 293 | TestIsInRangeEmptyClass(); | |||
| 294 | TestIsInRangeClassDerived(); | |||
| 295 | TestIsInRangeClassDerivedEmpty(); | |||
| 296 | TestIsInRangeClassExtraDerived(); | |||
| 297 | TestIsInRangeClassExtraDerivedEmpty(); | |||
| 298 | return 0; | |||
| 299 | } |