From 4a8984e0672b98e8a4470b70ceb34af274313c8a Mon Sep 17 00:00:00 2001 From: William Storey Date: Sun, 13 Sep 2026 18:16:39 +0000 Subject: [PATCH 1/2] Add a 32-bit autotools CI job ssize_t and long are 32 bits wide on i686. That exposes signedness and range problems that the 64-bit jobs cannot see, such as the -Wsign-compare error fixed in #487, which only showed up in Fedora's i686 build. The new job builds and tests with -m32 using gcc and clang. The flags are set for the whole job so that the libtap build, which has its own Makefile, and the test scripts that compile code themselves pick them up. The decoder limits test kept only -f flags from the environment when it rebuilt the library, so it would have dropped -m32 and checked 64-bit code. It now keeps -m flags as well. With the #487 fix reverted, the old script passed at 32-bit and the new one fails with the original error. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/test.yml | 28 ++++++++++++++++++++++++++++ t/decoder_limits_t.pl | 7 ++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c5b4e87..30e70613 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,34 @@ jobs: - run: make - run: make check + # ssize_t and long are 32 bits wide on i686, which exposes signedness and + # range problems that the 64-bit jobs cannot see. Build and test as 32-bit + # with -m32. The flags are set for the whole job so that the libtap build, + # which has its own Makefile, and the test scripts that compile code + # themselves pick them up too. + test-autoconf-32bit: + strategy: + matrix: + cc: [gcc, clang] + name: Autotools 32-bit build on ubuntu-latest using ${{matrix.cc}} + runs-on: ubuntu-latest + env: + CC: ${{ matrix.cc }} + CFLAGS: -m32 -std=c99 -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-parameter + LDFLAGS: -m32 + CXXFLAGS: -m32 + VERBOSE: 1 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + submodules: true + persist-credentials: false + - run: sudo apt-get update && sudo apt-get install -y gcc-multilib g++-multilib libipc-run3-perl + - run: ./bootstrap + - run: ./configure + - run: make + - run: make check + test-cmake: strategy: matrix: diff --git a/t/decoder_limits_t.pl b/t/decoder_limits_t.pl index 3284565e..654221f7 100755 --- a/t/decoder_limits_t.pl +++ b/t/decoder_limits_t.pl @@ -38,9 +38,10 @@ plan( skip_all => "decoder limit override tests need gcc or clang" ); } -# Keep instrumentation such as -fsanitize=address from the environment, but -# not its warning flags. Those vary by CI job and would trip -Werror below. -my @instrumentation = grep { /^-f/ } +# Keep instrumentation such as -fsanitize=address and target flags such as +# -m32 from the environment, but not its warning flags. Those vary by CI job +# and would trip -Werror below. +my @instrumentation = grep { /^-[fm]/ } map { split ' ' } grep { defined } @ENV{ 'CFLAGS', 'LDFLAGS' }; my @base = ( From 665789de2150970fd4c61b217c94738118c022b3 Mon Sep 17 00:00:00 2001 From: William Storey Date: Mon, 14 Sep 2026 15:19:48 +0000 Subject: [PATCH 2/2] Fold the 32-bit build into the autoconf matrix Add an arch dimension to the existing autoconf job instead of keeping a separate 32-bit job. macOS is excluded from the -m32 variant, and the multilib packages install only for the -m32 builds. The flag goes through CC="gcc -m32" rather than CFLAGS and LDFLAGS. CFLAGS must stay out of the job environment: when it is set, even empty, make exports the configured CFLAGS to the libtap sub-make, and libtap does not build on macOS with _POSIX_C_SOURCE defined. CC reaches configure, libtap, and the test scripts. The decoder limits test now splits CC on whitespace and no longer needs to pick -m flags out of CFLAGS. CXXFLAGS stays job-wide for the C++ compile test, which reads it from the environment. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/test.yml | 46 +++++++++++++------------------------- t/decoder_limits_t.pl | 15 +++++++------ 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30e70613..917be21b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,16 +6,28 @@ on: - cron: '3 20 * * SUN' permissions: {} jobs: + # The -m32 variants build and test as 32-bit. ssize_t and long are 32 bits + # wide on i686, which exposes signedness and range problems that the 64-bit + # builds cannot see. The flag goes in CC rather than CFLAGS so that the + # libtap build, which has its own Makefile, and the test scripts that + # compile code themselves pick it up too. CFLAGS must stay out of the job + # environment: when it is set, even empty, make exports the configured + # CFLAGS to libtap, and libtap does not build on macOS with _POSIX_C_SOURCE. test-autoconf: strategy: matrix: os: [ubuntu-latest, macos-latest] cc: [gcc, clang] posix: ['', -D_POSIX_C_SOURCE=200112L] - name: Autotools build on ${{matrix.os}} using ${{matrix.cc}} ${{matrix.posix}} + arch: ['', -m32] + exclude: + - os: macos-latest + arch: -m32 + name: Autotools build on ${{matrix.os}} using ${{matrix.cc}} ${{matrix.posix}} ${{matrix.arch}} runs-on: ${{ matrix.os }} env: - CC: ${{ matrix.cc }} + CC: ${{ matrix.cc }} ${{ matrix.arch }} + CXXFLAGS: ${{ matrix.arch }} VERBOSE: 1 steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -24,6 +36,8 @@ jobs: persist-credentials: false - run: sudo apt install libipc-run3-perl if: ${{ matrix.os == 'ubuntu-latest' }} + - run: sudo apt-get update && sudo apt-get install -y gcc-multilib g++-multilib + if: ${{ matrix.os == 'ubuntu-latest' && matrix.arch == '-m32' }} - run: brew install autoconf automake libtool if: ${{ matrix.os == 'macos-latest' }} - run: ./bootstrap @@ -33,34 +47,6 @@ jobs: - run: make - run: make check - # ssize_t and long are 32 bits wide on i686, which exposes signedness and - # range problems that the 64-bit jobs cannot see. Build and test as 32-bit - # with -m32. The flags are set for the whole job so that the libtap build, - # which has its own Makefile, and the test scripts that compile code - # themselves pick them up too. - test-autoconf-32bit: - strategy: - matrix: - cc: [gcc, clang] - name: Autotools 32-bit build on ubuntu-latest using ${{matrix.cc}} - runs-on: ubuntu-latest - env: - CC: ${{ matrix.cc }} - CFLAGS: -m32 -std=c99 -Wall -Wextra -Werror -Wno-unused-function -Wno-unused-parameter - LDFLAGS: -m32 - CXXFLAGS: -m32 - VERBOSE: 1 - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - with: - submodules: true - persist-credentials: false - - run: sudo apt-get update && sudo apt-get install -y gcc-multilib g++-multilib libipc-run3-perl - - run: ./bootstrap - - run: ./configure - - run: make - - run: make check - test-cmake: strategy: matrix: diff --git a/t/decoder_limits_t.pl b/t/decoder_limits_t.pl index 654221f7..0d9c05f5 100755 --- a/t/decoder_limits_t.pl +++ b/t/decoder_limits_t.pl @@ -21,14 +21,16 @@ my $root = abs_path("$Bin/.."); my $include_dir = "$root/include"; my $src_dir = "$root/src"; -my $cc = $ENV{CC} || 'cc'; + +# CC may carry flags, such as CC="gcc -m32". +my @cc = split ' ', $ENV{CC} || 'cc'; # The checks below rebuild the library with -Werror. Only gcc and clang are # known to compile it cleanly with the flags used here, so skip elsewhere # instead of failing on a missing compiler or an unrelated warning. my ( $cc_version, $cc_stderr ) = ( q{}, q{} ); my $cc_status = eval { - run3( [ $cc, '--version' ], \undef, \$cc_version, \$cc_stderr ); + run3( [ @cc, '--version' ], \undef, \$cc_version, \$cc_stderr ); $?; }; $cc_version .= $cc_stderr; @@ -38,14 +40,13 @@ plan( skip_all => "decoder limit override tests need gcc or clang" ); } -# Keep instrumentation such as -fsanitize=address and target flags such as -# -m32 from the environment, but not its warning flags. Those vary by CI job -# and would trip -Werror below. -my @instrumentation = grep { /^-[fm]/ } +# Keep instrumentation such as -fsanitize=address from the environment, but +# not its warning flags. Those vary by CI job and would trip -Werror below. +my @instrumentation = grep { /^-f/ } map { split ' ' } grep { defined } @ENV{ 'CFLAGS', 'LDFLAGS' }; my @base = ( - $cc, + @cc, @instrumentation, '-std=c99', '-Wall',