Skip to content

Warning when building ./Modules/timemodule.c on i686 with 64-bit time #104040

@TabLand

Description

@TabLand

Building CPython generates the following warning:

gcc  -fno-strict-overflow -Wsign-compare -g -Og -Wall    -std=c11 -Wextra \
    -Wno-unused-parameter -Wno-missing-field-initializers                 \ 
    -Werror=implicit-function-declaration -fvisibility=hidden             \
    -I./Include/internal  -I. -I./Include                                 \
    -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64                                \
    -DPy_BUILD_CORE_BUILTIN                                               \
    -c ./Modules/timemodule.c -o Modules/timemodule.o
./Modules/timemodule.c: In function 'check_ticks_per_second':
./Modules/timemodule.c:73:36: warning: comparison is always false due to limited
 range of data type [-Wtype-limits]
   73 |     if (tps >= 0 && (_PyTime_t)tps > _PyTime_MAX / SEC_TO_NS) {
      |          

#Environment

  • CPython versions tested on:
    Python 3.12.0a6+
  • Operating system and architecture:
Linux lfs.ijtaba 6.1.11 #1 SMP PREEMPT_DYNAMIC Sun Apr 30 12:53:36 PKT 2023 i686 GNU/Linux

Not able to replicate on a 64 bit system without the following compiler options:
-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64

Found whilst analysing #101732

I appreciate that building 32-bit python using gcc on Linux is not currently a supported platform combination, I would still like to review the code behind this...
configure: WARNING: i686-pc-linux-gnu/gcc is not supported

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions