Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test 32-bit builds in CI and fix platform-specific code and tests #7756

Merged
merged 19 commits into from
Sep 22, 2023

Commits on Aug 23, 2023

  1. Fix 32bit unit test build failure

    GCC defines i386 as a macro (with value 1) on 32-bit x86.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    24d4d3a View commit details
    Browse the repository at this point in the history
  2. Unit tests: do not hard-code 64-bit pointer width

    We also support 32-bit architectures.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    37ed69c View commit details
    Browse the repository at this point in the history
  3. Interpreter: Do not hard-code platform bit width

    Not all systems have 64-bit addresses. Also fix an off-by-power-of-2
    error in the comment.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    caca58b View commit details
    Browse the repository at this point in the history
  4. Make goto-inspect test patterns platform-agnostic

    Not all platforms have 32-bit int, and the size of long int may be the
    same as int.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    093e2f3 View commit details
    Browse the repository at this point in the history
  5. Test patterns: fix optional casts

    Not all platforms require casts from int to long int as those may have
    the same bit width.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    352299a View commit details
    Browse the repository at this point in the history
  6. goto-harness regression tests: support non-64-bit platforms

    The pointer width encoded in pre-built snapshots is 64 bits. Replace
    that width at test runtime with the host system bit width.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    3318f6f View commit details
    Browse the repository at this point in the history
  7. Arrays have a signed size

    Fix tests and argc/argv constraints to account for the fact that our
    arrays (at present) use signed sizes. We previously didn't always
    consider the case that where sizeof(int) == sizeof(long), which
    demonstrated overflows.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    ebaf09f View commit details
    Browse the repository at this point in the history
  8. Fix tests and contracts wrongly assuming sizeof(long) == sizeof(long …

    …long)
    
    This isn't true for all platforms.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    a9ca74e View commit details
    Browse the repository at this point in the history
  9. Tests: use types that are smaller than long on all platforms

    Some tests assumed that sizeof(int) < sizeof(long), which need not be
    the case.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    0723271 View commit details
    Browse the repository at this point in the history
  10. Tests: do not hard-code 64 bits/8 bytes as pointer width

    This wouldn't be true for all platforms.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    ba7eb04 View commit details
    Browse the repository at this point in the history
  11. Tests: fix index typo

    The comparison previously succeeded by chance on 64-bit platforms, but
    didn't pass on ones that have a smaller pointer width.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    a3f1ae9 View commit details
    Browse the repository at this point in the history
  12. Properly type initial value of __CPROVER_max_malloc_size

    Use a suffix to ensure the constant isn't treated as an int, but instead
    matches the left-hand side's type.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    28e4238 View commit details
    Browse the repository at this point in the history
  13. Goto analyzer: do not create untyped nil expression

    We need to create a typed variant of top rather than relying on eval to
    produce a typed expression. Tests involving pointer difference
    spuriously passed for 64-bit platforms include a type cast in those
    expressions. The abstract evaluation of said type cast resulted in typed
    expressions despite the untyped nil input.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    5eb8a94 View commit details
    Browse the repository at this point in the history
  14. Make cbmc-incr-smt2 test patterns platform-agnostic

    Not all platforms have 32-bit int, and the size of long int may be the
    same as int.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    cc27808 View commit details
    Browse the repository at this point in the history
  15. cbmc-incr-smt2 tests: remove misguided assertion

    There is no reason an integer couldn't have the same value as a pointer
    (when converted to an integer type). This assertion might accidentally
    hold on platforms where sizeof(int) != sizeof(int *) given our current
    pointer model, but this is an implementation detail that we must not
    rely on. The assertion certainly doesn't hold when sizeof(int) ==
    sizeof(int *).
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    9d1be21 View commit details
    Browse the repository at this point in the history
  16. Incremental SMT2: support cast from pointer to integer of different w…

    …idth
    
    Do a zero extension, just like the propositional back-end does.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    0794f5b View commit details
    Browse the repository at this point in the history
  17. Make memory-analyzer compatible with i386

    We previously hard-coded x86_64 calling conventions for malloc.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    c1f9237 View commit details
    Browse the repository at this point in the history
  18. Contracts test: ensure return value access is in bounds

    We ended up with an assumption that performed an out-of-bounds access as
    there was no link between `size` and the return value in the contract.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    1cae1b3 View commit details
    Browse the repository at this point in the history
  19. Run 32-bit builds and tests as CI job

    This is to detect hardwired 64-bit configuration or tests when those
    should be platform-independent instead.
    tautschnig committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    1a30ad4 View commit details
    Browse the repository at this point in the history