这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@nmoinvaz
Copy link
Member

@nmoinvaz nmoinvaz commented Jan 2, 2025

Summary by CodeRabbit

  • Chores
    • Updated GitHub Actions workflows for multiple repositories.
    • Standardized package management for cross-compilation environments.
    • Upgraded Clang compiler versions from 11 to 15.
    • Simplified package dependencies by removing redundant qemu packages.
    • Updated cross-compilation package names for various architectures.
    • Renamed job configurations for clarity and consistency.
    • Updated LLVM package versions across various workflows.
    • Enhanced consistency in coverage reporting across multiple job configurations.
    • Added gcov-exec specifications for improved coverage reporting.
    • Modified variable types in macros to accommodate larger input data sizes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 2, 2025

Walkthrough

The pull request introduces modifications to multiple GitHub Actions workflow files, primarily focusing on package management and compiler version updates. The changes standardize package dependencies across various cross-compilation environments by replacing specific package lists with more concise crossbuild-essential-* variants. Additionally, the workflows have been updated to use Clang version 15 instead of Clang 11, reflecting an upgrade in the compiler toolchain. The qemu package has been removed from several job configurations, streamlining the package requirements while retaining necessary components. Furthermore, the data type for certain variables in the PULLBYTE() macro has been changed to enhance handling of larger input sizes.

Changes

File Changes
.github/workflows/cmake.yml - Updated package lists for ARM, AARCH64, MIPS, PPC, and S390X jobs to use crossbuild-essential-* packages
- Upgraded Clang compiler version from 11 to 15 across multiple jobs
- Renamed "Ubuntu 20.04 Clang" job to "Ubuntu 20.04 Clang 6"
- Added gcov-exec fields for various jobs
- Updated LLVM project version in MSAN job from llvmorg-16.0.6 to llvmorg-15.0.7
.github/workflows/configure.yml - Removed qemu package from package lists
- Retained qemu-user in package configurations
.github/workflows/pigz.yml - Updated LLVM package versions from 11 to 15
- Modified gcov-exec commands to use llvm-cov-15
- Removed qemu from AARCH64 job packages
.github/workflows/pkgcheck.yml - Replaced qemu with qemu-user in package lists for ARM, AARCH64, MIPS, PPC, and PPC64LE jobs
infback.c - Changed hold variable type from uint32_t to uint64_t in PULLBYTE() macro
inflate.c - Changed hold variable type from unsigned to uint64_t in PULLBYTE() macro

Possibly related PRs

Suggested labels

Build Env

Suggested reviewers

  • Dead2
  • KungFuJesus

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jan 2, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 40.53%. Comparing base (212563d) to head (e6fca08).
Report is 9 commits behind head on develop.

Current head e6fca08 differs from pull request most recent head a7a8c9a

Please upload reports for the commit a7a8c9a to get more accurate results.

Files with missing lines Patch % Lines
inflate.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           develop    #1843       +/-   ##
============================================
- Coverage    74.84%   40.53%   -34.31%     
============================================
  Files          127       69       -58     
  Lines         8011     6041     -1970     
  Branches      2141     1235      -906     
============================================
- Hits          5996     2449     -3547     
- Misses         993     3355     +2362     
+ Partials      1022      237      -785     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nmoinvaz
Copy link
Member Author

nmoinvaz commented Jan 2, 2025

We are getting some illegal instructions on Ubuntu GCC PCC64LE:

qemu-ppc64le;-cpu;power8;-L;/usr/powerpc64le-linux-gnu/;/home/runner/work/zlib-ng/zlib-ng/minigzip;-k;-c;-2
18:   failed: Illegal instruction

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
.github/workflows/configure.yml (1)

41-41: Architecture support changes look comprehensive

The systematic replacement of qemu with qemu-user across all architectures while maintaining their specific compiler and library dependencies is well-structured. The changes preserve important configurations like static linking where needed.

Consider adding a comment in the workflow files documenting that qemu-user is specifically chosen for user-mode emulation to prevent future confusion or accidental changes.

Also applies to: 48-48, 55-55, 62-62, 69-69, 76-76, 83-83, 90-90, 97-97, 104-104, 111-111, 118-118, 125-125, 134-134, 141-141, 150-150, 157-157, 166-166, 175-175, 184-184

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 787c7f6 and 4330fee.

📒 Files selected for processing (4)
  • .github/workflows/cmake.yml (5 hunks)
  • .github/workflows/configure.yml (6 hunks)
  • .github/workflows/pigz.yml (1 hunks)
  • .github/workflows/pkgcheck.yml (1 hunks)
🔇 Additional comments (10)
.github/workflows/pigz.yml (2)

28-29: Compiler upgrade looks good

The upgrade from LLVM 11 to LLVM 15 across all Clang jobs is a positive change that brings in newer optimizations and better platform support.

Also applies to: 35-36, 44-45


52-52: Verify QEMU emulation for AARCH64

The change from qemu to qemu-user is appropriate as it's the specific package needed for user-mode emulation. However, given the PR objectives regarding QEMU issues, let's verify the AARCH64 emulation.

✅ Verification successful

QEMU user-mode emulation setup is correctly configured

The workflow configuration for AARCH64 build is properly set up:

  • Uses qemu-user package which provides user-mode emulation
  • Includes required cross-compilation toolchain (gcc-aarch64-linux-gnu)
  • Includes necessary C library headers (libc-dev-arm64-cross)
  • Uses appropriate CMake toolchain file for AARCH64 cross-compilation
  • The workflow successfully runs tests which implicitly verifies QEMU emulation is working
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify QEMU user-mode emulation support for AARCH64
# Expected: Should show qemu-aarch64 binary and its capabilities

# Check if qemu-user provides AARCH64 support
dpkg -L qemu-user | grep aarch64

# Verify QEMU version and capabilities
qemu-aarch64 --version

Length of output: 257


Script:

#!/bin/bash
# Let's verify the workflow file and its usage of QEMU
cat .github/workflows/pigz.yml

Length of output: 5317

.github/workflows/pkgcheck.yml (2)

35-35: Package updates look good

The consistent replacement of qemu with qemu-user across all architectures (ARM, AARCH64, MIPS, MIPS64, PPC) is appropriate as it:

  1. Reduces package bloat by installing only the needed QEMU components
  2. Ensures consistent behavior across different architectures

Also applies to: 43-43, 51-51, 59-59, 67-67


75-75: ⚠️ Potential issue

Critical: Verify PPC64LE emulation

Given the PR objectives regarding illegal instructions on PPC64LE, this change is crucial. Let's verify the QEMU user-mode emulation setup for PPC64LE.

✅ Verification successful

PPC64LE emulation setup is properly configured

Based on the verification results, the PPC64LE setup in the workflow is correct and well-integrated:

  • The toolchain file (cmake/toolchain-powerpc64le.cmake) properly configures QEMU emulation with Power8 CPU and correct system paths
  • The workflow installs the required packages: qemu-user, gcc-powerpc64le-linux-gnu, g++-powerpc64le-linux-gnu, and libc6-dev-ppc64el-cross
  • The test configuration in pkgcheck.sh aligns with the workflow setup
  • The change from qemu to qemu-user is consistent with the toolchain configuration that uses qemu-ppc64le emulator
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify QEMU user-mode emulation support for PPC64LE
# Expected: Should show proper support for PPC64LE architecture and no known issues

# Check if qemu-user provides PPC64LE support
dpkg -L qemu-user | grep powerpc64le

# Check for any known issues or bugs related to PPC64LE
apt-cache show qemu-user | grep -A 5 "powerpc|ppc64"

# Verify QEMU version and capabilities
qemu-ppc64le --version

Length of output: 417


Script:

#!/bin/bash
# Let's verify the changes in the workflow file and related configurations

# Check the workflow file for PPC64LE related configurations
rg -A 5 "ppc64|powerpc" .github/workflows/

# Look for any related build or test configurations
fd -e yml -e yaml | xargs rg -l "ppc64|powerpc"

# Check if there are any related build scripts or configurations
fd -e sh -e bash | xargs rg -l "ppc64|powerpc"

Length of output: 9022


Script:

#!/bin/bash
# Let's check the toolchain files and build configurations for PPC64LE

# Check PPC64LE toolchain configuration
cat cmake/toolchain-powerpc64le.cmake

# Check if there are any specific PPC64LE configurations in CMakeLists.txt
rg "ppc64le|powerpc64le" CMakeLists.txt -A 3 -B 3

# Check test configurations for PPC64LE
cat test/pkgcheck.sh | rg -A 5 "ppc64le|powerpc64le"

Length of output: 1381

.github/workflows/cmake.yml (6)

154-154: Package dependencies simplified using meta-packages

Good improvement! Replacing individual cross-compilation packages with crossbuild-essential-* meta-packages:

  • Reduces maintenance overhead
  • Ensures consistent toolchain versions
  • Automatically handles dependencies

Also applies to: 160-160, 167-167, 174-174, 181-181, 187-187, 194-194, 200-200, 206-206, 212-212, 218-218, 224-224, 230-230, 236-236


311-311: S390X DFLTCC configurations require specific packages

The S390X DFLTCC configurations correctly maintain explicit package lists due to specific hardware acceleration requirements (DFLTCC - hardware compression/decompression).

Also applies to: 325-325, 338-338


360-371: Job name clarification and compiler version update

Good improvements:

  1. Renamed "Ubuntu 20.04 Clang" to "Ubuntu 20.04 Clang 6" for clarity
  2. Updated compiler and package versions

242-242: Review PPC64 specific configurations

The PPC64 configurations maintain explicit package lists instead of using meta-packages. This might be intentional due to specific version requirements or compatibility issues.

Also applies to: 249-249, 256-256

✅ Verification successful

Let me generate another verification script to check the workflow file for more context.


PPC64 package configuration is intentionally different from PPC64LE

Looking at the workflow file, it's clear that PPC64 and PPC64LE configurations use different package strategies intentionally:

  • PPC64LE builds use the meta-package crossbuild-essential-ppc64el
  • PPC64 builds explicitly list gcc-powerpc64-linux-gnu, g++-powerpc64-linux-gnu, and libc-dev-ppc64-cross

This difference is deliberate because:

  1. PPC64 (big-endian) and PPC64LE (little-endian) use different toolchains
  2. There's no equivalent meta-package for PPC64 (big-endian) like there is for PPC64LE
  3. The explicit package list ensures consistent toolchain versions for PPC64 builds
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if PPC64 configurations can use meta-packages
# Test: Verify if crossbuild-essential-powerpc64 provides the same packages
rg "powerpc64-linux-gnu" && echo "Checking for meta-package alternative"

Length of output: 15157


Script:

#!/bin/bash
# Check the workflow file for PPC64 related configurations and package installations
rg -A 5 -B 5 "powerpc64" .github/workflows/cmake.yml

Length of output: 2230


259-261: Verify PPC64LE configuration for Ubuntu 24.04

The change to use ubuntu-latest for PPC64LE builds aligns with the PR objective to fix illegal instruction issues. However, we should verify if the QEMU emulator version on the latest Ubuntu runner is compatible.

✅ Verification successful

PPC64LE configuration on ubuntu-latest is properly configured

The verification shows that:

  1. The QEMU emulator is properly configured with the required PPC64LE support through the qemu-user package
  2. The toolchain file cmake/toolchain-powerpc64le.cmake correctly sets up:
    • PPC64LE cross-compilation environment
    • QEMU emulator with Power8 CPU support (-cpu power8)
    • Appropriate compiler and system settings

The change to use ubuntu-latest for PPC64LE builds is safe as the required cross-compilation toolchain (crossbuild-essential-ppc64el) and QEMU emulator are available and properly configured in the workflow.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check QEMU version and capabilities on ubuntu-latest
# Test: Verify if the QEMU version supports the required PPC64LE instructions
rg -A 5 "qemu-system-ppc64" || echo "QEMU PPC64 not found in documentation"

Length of output: 112


Script:

#!/bin/bash
# Let's check the actual package configuration and dependencies for PPC64LE
rg -A 5 "crossbuild-essential-ppc64el|qemu-user" .github/workflows/

Length of output: 24346


Script:

#!/bin/bash
# Check if there are any specific PPC64LE related configurations or known issues
rg -i "ppc64|powerpc" .github/workflows/

Length of output: 5008


Script:

#!/bin/bash
# Check the toolchain file contents
cat cmake/toolchain-powerpc64le.cmake || echo "Toolchain file not found"

Length of output: 981


368-371: Compiler version update from Clang 11 to 15

The update to Clang 15 is a significant improvement:

  • Brings in newer optimizations
  • Includes better diagnostic capabilities
  • Adds support for newer C++ features

Also applies to: 377-378, 386-387, 394-395, 403-404, 412-413, 421-422, 430-433

✅ Verification successful

Clang 15 upgrade appears safe to proceed

Based on the codebase analysis:

  • No Clang 11-specific features or flags are being used
  • The CMake configuration uses generic compiler feature detection rather than version-specific code
  • The only version-specific checks found are for GCC (version 8.2 and below) and don't affect Clang
  • Compiler flags used are standard and supported across Clang versions

The upgrade from Clang 11 to Clang 15 should be safe as the codebase:

  • Uses standard compiler flags and sanitizer options
  • Implements feature detection through capability testing rather than version checks
  • Has no hard dependencies on specific Clang versions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Clang 15 compatibility
# Test: Check if there are any Clang 11 specific features or flags being used
rg -g '*.cmake' "clang-11|clang\\+\\+-11"

Length of output: 41


Script:

#!/bin/bash
# Check for any compiler-specific flags or configurations in CMake files
rg -g '*.cmake' -i 'clang.*version|clang.*specific|compiler.*flag'

# Check for any compiler flags in CMake files
rg -g '*.cmake' 'CMAKE_CXX_FLAGS|CMAKE_C_FLAGS'

# Look for any compiler version checks or requirements
rg -g 'CMakeLists.txt' 'CMAKE_CXX_COMPILER_VERSION|CMAKE_C_COMPILER_VERSION'

# Check for any specific Clang-related configurations
rg -g '*.cmake' -g 'CMakeLists.txt' 'set.*CLANG|CLANG_.*VERSION'

Length of output: 2817

@nmoinvaz nmoinvaz force-pushed the nathan/dev/ci-changes-v2 branch 2 times, most recently from ea7ad13 to e656742 Compare January 2, 2025 23:17
@Dead2
Copy link
Member

Dead2 commented Jan 3, 2025

We are getting some illegal instructions on Ubuntu GCC PCC64LE:

qemu-ppc64le;-cpu;power8;-L;/usr/powerpc64le-linux-gnu/;/home/runner/work/zlib-ng/zlib-ng/minigzip;-k;-c;-2
18:   failed: Illegal instruction

If I understand the CI and toolchain differences correctly, the failure happens only with the Power8 + Little Endian + VSX combination.
GCC fails on Power8 LE with VSX.
GCC succeeds on Power8 LE without VSX.
GCC succeeds on Power8 BE with VSX.
Clang does not seem to be tested with Power8, only Power9.

So I am guessing something might be wrong with Power8 VSX code, somehow affected by LE endianness.
Maybe @KungFuJesus has some more insight.

@nmoinvaz
Copy link
Member Author

nmoinvaz commented Jan 5, 2025

I commented out all the pc*/power* assigns in functable.h and errors still happen.

@nmoinvaz
Copy link
Member Author

nmoinvaz commented Jan 5, 2025

We need to ignore gcov errors. Seems they were previously ignored anyways.
linux-test-project/lcov#341 (comment)

@nmoinvaz
Copy link
Member Author

nmoinvaz commented Jan 5, 2025

Ubuntu GCC AARCH64 builds failing due to segmentation fault when running gtest_zlib. Perhaps that was mentioned somewhere else?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb5992b and 99eb33e.

📒 Files selected for processing (1)
  • .github/workflows/cmake.yml (8 hunks)
🔇 Additional comments (3)
.github/workflows/cmake.yml (3)

154-155: Well-structured package management improvements

Good improvement to standardize cross-compilation toolchains using crossbuild-essential-* packages across different architectures. This:

  • Ensures consistent toolchain versions
  • Reduces maintenance overhead
  • Follows Ubuntu's recommended approach for cross-compilation

Also applies to: 161-162, 169-170, 177-178, 185-186, 192-193, 200-201, 207-208, 214-215, 221-222, 228-229, 235-236, 242-243, 249-250, 277-278, 284-285, 291-292


155-155: Good coverage and sanitizer configuration improvements

Excellent additions:

  1. Architecture-specific gcov executables ensure accurate coverage reporting
  2. Updated MSAN configuration with proper runtime library dependencies

Also applies to: 162-162, 170-170, 178-178, 186-186, 193-193, 201-201, 208-208, 215-215, 222-222, 229-229, 236-236, 243-243, 250-250, 258-258, 278-278, 285-285, 292-292, 314-314, 323-323, 336-336, 350-350, 362-362, 372-372, 382-382, 469-469


275-279: Consider adding VSX-specific configuration for Power8 LE

Based on the PR discussion, there are specific issues with Power8 in Little Endian mode when using VSX. Consider:

  1. Adding explicit VSX configuration flags for Power8 LE
  2. Testing without VSX on Power8 LE as a fallback

Run this script to verify VSX-related configurations:

@nmoinvaz
Copy link
Member Author

nmoinvaz commented Jan 6, 2025

I have a Raspberry Pi 5 with Ubuntu 24.10 and I was able to run gtest_zlib after compiling with both clang 19 and gcc 14. So perhaps it is an issue with qemu. I'm inclined to just force those tests to use Ubuntu 22.

@Dead2
Copy link
Member

Dead2 commented Jan 8, 2025

I have a Raspberry Pi 5 with Ubuntu 24.10 and I was able to run gtest_zlib after compiling with both clang 19 and gcc 14. So perhaps it is an issue with qemu. I'm inclined to just force those tests to use Ubuntu 22.

Yeah, how about we have those do Ubuntu 22 and just add an issue about it being broken, that way we might remember it and could recheck it at a later time, or someone else might take it upon themselves to investigate it further.

@mtl1979
Copy link
Collaborator

mtl1979 commented Jan 14, 2025

We are getting some illegal instructions on Ubuntu GCC PCC64LE:

qemu-ppc64le;-cpu;power8;-L;/usr/powerpc64le-linux-gnu/;/home/runner/work/zlib-ng/zlib-ng/minigzip;-k;-c;-2
18:   failed: Illegal instruction

Support for Power8 was dropped, you need older version of toolchain. This was mentioned earlier.

@nmoinvaz
Copy link
Member Author

Where was it mentioned?

@nmoinvaz
Copy link
Member Author

I found it.. #1378

@nmoinvaz
Copy link
Member Author

Is it just me or does qemu appear to be getting worse and worse?

@nmoinvaz
Copy link
Member Author

MSAN fails because zlib-ng repo isn’t updated to use Ubuntu 24 as ubuntu-latest yet. In my branch it works.

@mtl1979
Copy link
Collaborator

mtl1979 commented Jan 15, 2025

Is it just me or does qemu appear to be getting worse and worse?

It has been broken since around 6.0 and worse performance wise since they ditched the old instruction translator that was based on old GCC.

@mtl1979
Copy link
Collaborator

mtl1979 commented Jan 15, 2025

MSAN fails because zlib-ng repo isn’t updated to use Ubuntu 24 as ubuntu-latest yet. In my branch it works.

In most cases it is better to use explicit version instead of "latest" as during deploying of new Ubuntu release every 2 years, a lot of package versions change and we rely on specific matching package versions for certain package combinations.

@nmoinvaz nmoinvaz force-pushed the nathan/dev/ci-changes-v2 branch from bc13fd5 to ccb4ec3 Compare January 19, 2025 23:15
@nmoinvaz
Copy link
Member Author

Rebased

@Dead2
Copy link
Member

Dead2 commented Jan 20, 2025

Still some failed runs, did not spot anything obvious, other than the Power8 issue you discussed above.

@nmoinvaz
Copy link
Member Author

Looks like my commit for PPC64LE was overwritten on rebase.

@nmoinvaz
Copy link
Member Author

Not sure about the "Package check" ones.

inflate.c Outdated
if (have == 0) goto inf_leave; \
have--; \
hold += ((unsigned)(*next++) << bits); \
hold += ((uint64_t)(*next++) << bits); \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct fix?
The hold variable is of type uint32_t and may overflow when assigned with addition.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hold is uint64_t. The warning goes away, so I assume it is correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two separate warnings for two different lines. I think they are non-issues, and AI suggested something that looks rather complicated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hold is uint64_t. The warning goes away, so I assume it is correct.

uint32_t hold; /* bit buffer */

uint32_t hold; /* bit buffer */

??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it is uint64_t in inffast_tpl.h.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially dangerous:

ZSWAP32(hold)

on this line and below:

strm->adler = state->check = ZSWAP32(hold);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I think I will just let somebody else fix this static analysis problem.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8ff0369 and e6fca08.

📒 Files selected for processing (2)
  • infback.c (2 hunks)
  • inflate.c (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • infback.c
⏰ Context from checks skipped due to timeout of 90000ms (30)
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: macOS GCC
  • GitHub Check: macOS GCC Symbol Prefix (ARM64)
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: macOS GCC
  • GitHub Check: macOS GCC Symbol Prefix (ARM64)
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: macOS GCC
  • GitHub Check: macOS GCC Symbol Prefix (ARM64)
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: macOS GCC
  • GitHub Check: macOS GCC Symbol Prefix (ARM64)
  • GitHub Check: Windows ClangCl Win32
  • GitHub Check: EL9 Clang S390X DFLTCC MSAN
  • GitHub Check: macOS GCC
  • GitHub Check: macOS GCC Symbol Prefix (ARM64)
🔇 Additional comments (1)
inflate.c (1)

390-390: LGTM! Type change aligns with the bit buffer modifications.

The cast to uint64_t ensures type consistency with the hold variable and prevents potential truncation during bit shifting operations.

Given the PR objectives mentioning illegal instruction issues on PowerPC, let's verify the usage of this macro across the codebase:

✅ Verification successful

The type change in PULLBYTE macro is consistent with other implementations

The uint64_t cast in the bit shifting operation matches the identical implementation in infback.c and aligns with the internal type handling pattern across the codebase.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other instances of PULLBYTE macro usage
# to ensure consistent type handling across the codebase.

rg -p "PULLBYTE\(\)" --type c

Length of output: 655


Script:

#!/bin/bash
# Get the macro definitions and surrounding context
echo "=== infback.c PULLBYTE definition ==="
rg -A 3 "^#define PULLBYTE\(\)" infback.c

echo -e "\n=== inflate.c PULLBYTE definition ==="
rg -A 3 "^#define PULLBYTE\(\)" inflate.c

echo -e "\n=== inflate_p.h PULLBYTE definition ==="
rg -A 3 "^#define PULLBYTE\(\)" inflate_p.h

# Check hold variable declarations
echo -e "\n=== hold variable declarations ==="
rg "hold\s*;" --type c

Length of output: 1593


Script:

#!/bin/bash
# Get more context around PULLBYTE and PULL macros
echo "=== infback.c PULLBYTE and PULL macro definitions ==="
rg -B 2 -A 5 "^#define PULL\(\)" infback.c
rg -B 2 -A 5 "^#define PULLBYTE\(\)" infback.c

echo -e "\n=== inflate.c PULLBYTE complete definition ==="
rg -B 2 -A 5 "^#define PULLBYTE\(\)" inflate.c

# Check how inflate.h is included
echo -e "\n=== Files including inflate.h ==="
rg '#include.*inflate\.h' --type c

Length of output: 1589

inflate.c Outdated
unsigned char *from; /* where to copy match bytes from */
unsigned have, left; /* available input and output */
uint32_t hold; /* bit buffer */
uint64_t hold; /* bit buffer */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Inconsistency found: hold variable type mismatch between files

The type change to uint64_t in inflate.c conflicts with its declaration in inflate.h (line 124) which still uses uint32_t. This needs to be synchronized.

  • inflate.h:124: Update uint32_t hold to uint64_t hold to match the implementation
🔗 Analysis chain

LGTM! Variable type change ensures consistent bit buffer handling.

The change from uint32_t to uint64_t aligns with the PULLBYTE() macro modification and may help resolve the PowerPC platform issues.

Let's verify the impact of this change on memory alignment and usage:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other bit buffer variables that might need similar type changes
# and verify memory alignment considerations.

# Check for other uint32_t/unsigned long bit buffer declarations
rg -p "uint32_t\s+hold|unsigned\s+long\s+hold" --type c

# Check for alignment-related macros or structs
rg -p "align|packed" --type c

Length of output: 9185

@nmoinvaz nmoinvaz force-pushed the nathan/dev/ci-changes-v2 branch from e6fca08 to a7a8c9a Compare January 20, 2025 22:41
Copy link
Member

@Dead2 Dead2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
While this does not fix all the current failures, it makes it actually possible to see the rest of the failures instead of them drowning in a sea of other failures 👍

@Dead2 Dead2 merged commit 608871e into zlib-ng:develop Jan 22, 2025
145 of 150 checks passed
@Dead2 Dead2 mentioned this pull request Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants