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

Do not cast pointers to arrays of differently sized integers. #485

Merged
merged 4 commits into from
May 21, 2024

Commits on May 16, 2024

  1. Do not cast pointers to arrays of differently sized integers.

    Casting between `int64_t *` and `int32_t *` does *not* maintain the values in
    the array. Instead, it tells the compiler to interpret the memory at that
    pointer as an array of a different type (i.e., two `int32_t` elements "become"
    one `int64_t` element). That can lead to all kinds of errors and is very not
    what was intended.
    
    Remove the integer pointer casts to allow the compiler to emit an error on
    compile-time instead of potentially causing, e.g., an array overflow on
    runtime if `sunindextype` has a different size from `KLU_INDEXTYPE`.
    
    Signed-off-by: Markus Mützel <[email protected]>
    mmuetzel committed May 16, 2024
    Configuration menu
    Copy the full SHA
    8e63589 View commit details
    Browse the repository at this point in the history
  2. SundialsKLU.cmake: Check if size of SuiteSparse_long matches sunindex…

    …type
    
    If `sunindextype` is a 64-bit integer, `SuiteSparse_long` must also be a
    64-bit integer or KLU cannot be used.
    Add a CMake check to fail during configuration if the sizes don't match.
    
    Signed-off-by: Markus Mützel <[email protected]>
    mmuetzel committed May 16, 2024
    Configuration menu
    Copy the full SHA
    1b82aa2 View commit details
    Browse the repository at this point in the history

Commits on May 20, 2024

  1. Configuration menu
    Copy the full SHA
    87d3c5b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f01888e View commit details
    Browse the repository at this point in the history