Skip to content

[Bug]: SP math 32 bit build fails with clang #5864

@guidovranken

Description

@guidovranken

Contact Details

No response

Version

Git repository checkout

Description

Build fails due to long-to-int casting.

Reproduction steps

export CC=clang
export CFLAGS="-m32"
git clone https://github.com/wolfSSL/wolfssl.git
cd wolfssl/
autoreconf -ivf
./configure --enable-sp
make

Relevant log output

wolfcrypt/src/sp_c32.c:505:16: error: implicit conversion loses integer precision: 'sp_uint64' (aka 'unsigned long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[23] = t0 >> 29;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:957:16: error: implicit conversion loses integer precision: 'sp_uint64' (aka 'unsigned long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[23] = t0 >> 29;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:8664:16: error: implicit conversion loses integer precision: 'sp_uint64' (aka 'unsigned long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[27] = t0 >> 28;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:9146:16: error: implicit conversion loses integer precision: 'sp_uint64' (aka 'unsigned long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[27] = t0 >> 28;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:16044:16: error: implicit conversion loses integer precision: 'sp_uint64' (aka 'unsigned long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[17] = t0 >> 26;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:16617:16: error: implicit conversion loses integer precision: 'sp_uint64' (aka 'unsigned long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[17] = t0 >> 26;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:20218:16: error: implicit conversion loses integer precision: 'sp_int64' (aka 'long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[17] = t0 >> 29;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:20339:16: error: implicit conversion loses integer precision: 'sp_int64' (aka 'long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[17] = t0 >> 29;
          ~ ~~~^~~~~
  CC       wolfcrypt/src/src_libwolfssl_la-sha512.lo
  CC       wolfcrypt/src/src_libwolfssl_la-sha3.lo
wolfcrypt/src/sp_c32.c:27481:16: error: implicit conversion loses integer precision: 'sp_int64' (aka 'long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[29] = t0 >> 26;
          ~ ~~~^~~~~
wolfcrypt/src/sp_c32.c:27689:16: error: implicit conversion loses integer precision: 'sp_int64' (aka 'long long') to 'sp_digit' (aka 'int') [-Werror,-Wshorten-64-to-32]
    r[29] = t0 >> 26;
          ~ ~~~^~~~~

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions