Skip to content

C compilation warnings, signedness comparison, uninitialized #758

@mkitti

Description

@mkitti

Building the extensions results in several warnings of two classes:

  1. comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
  2. may be used uninitialized [-Wmaybe-uninitialized]
$ pip install -vv -e .

  numcodecs/blosc.c: In function ‘__pyx_pf_9numcodecs_5blosc_22decompress’:
  numcodecs/blosc.c:6049:38: warning: comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   6049 |     __pyx_t_2 = (__pyx_v_dest_nbytes < __pyx_v_nbytes);
        |                                      ^
  In function ‘__Pyx_PyLong_From_int’,
      inlined from ‘__pyx_pf_9numcodecs_5blosc_20compress’ at numcodecs/blosc.c:5659:17,
      inlined from ‘__pyx_pw_9numcodecs_5blosc_21compress’ at numcodecs/blosc.c:4751:13:
  numcodecs/blosc.c:14883:20: warning: ‘__pyx_v_cbytes’ may be used uninitialized [-Wmaybe-uninitialized]
  14883 |             return PyLong_FromLong((long) value);
        |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  numcodecs/blosc.c: In function ‘__pyx_pw_9numcodecs_5blosc_21compress’:
  numcodecs/blosc.c:4775:7: note: ‘__pyx_v_cbytes’ was declared here
   4775 |   int __pyx_v_cbytes;
        |       ^~~~~~~~~~~~~~

...
  numcodecs/zstd.c: In function ‘__pyx_pf_9numcodecs_4zstd_2decompress’:
  numcodecs/zstd.c:3816:38: warning: comparison of integer expressions of different signedness: ‘Py_ssize_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   3816 |     __pyx_t_3 = (__pyx_v_dest_nbytes < __pyx_v_dest_size);
        |                                      ^
...
  numcodecs/lz4.c: In function ‘__pyx_pf_9numcodecs_3lz4_2decompress’:
  numcodecs/lz4.c:3449:38: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
   3449 |     __pyx_t_3 = (__pyx_v_source_size < (sizeof(uint32_t)));
        |                                      ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions