4 of 6 standards met
Summary Fixes #4590 and raise a (division by zero) on x86 when long distance matching (LDM) is enabled via but the individual LDM sub-parameters (hashLog, bucketSizeLog, minMatchLength, hashRateLog) remain at their default zero values. The division by zero occurs in at , where is computed with . Root Cause When the user enables LDM through , only the flag is set. The other LDM parameters stay at zero. The existing path avoids this by going through , which calls to fill in sensible defaults. However, and skip this adjustment step and pass the raw (zeroed) LDM params directly to the internal estimation function. Fix Both and now copy the LDM parameters to a local and call when LDM is enabled, consistent with the pattern already used in . Changes : Added LDM parameter adjustment in both estimation functions : Added regression test that enables LDM via CCtxParams and calls both estimation functions Steps to Reproduce (before fix) Compile and run: Testing Verified the reproducer no longer crashes and returns a correct estimation passes passes including the new regression test
Repository: facebook/zstd. Description: Zstandard - Fast real-time compression algorithm Stars: 26713, Forks: 2414. Primary language: C. Languages: C (76.2%), C++ (13.7%), Shell (3.1%), Python (2.5%), Makefile (1.9%). Homepage: http://www.zstd.net Latest release: v1.5.7 (1y ago). Open PRs: 37, open issues: 218. Last activity: 1d ago. Community health: 87%. Top contributors: Cyan4973, terrelln, inikep, felixhandte, stellamplau, sean-purcell, embg, daniellerozenblit, GeorgeLu97, dependabot[bot] and others.
Last 12 weeks · 36 commits
Description This PR updates the root to automatically detect RISC-V architectures (via ) and append the flag to . On many RISC-V implementations standard builds can suffer from significant performance degradation. Adding instructs the compiler to generate code that handles unaligned accesses via byte-wise instructions or other safe methods, thereby avoiding expensive traps and improving runtime performance. Changes Detects in . Appends to . Exports to ensure the flag is correctly propagated to sub-makefiles (lib, programs, etc.). Validation & Benchmarks Tested on a RISC-V device (Sophon SG2044 / 64-core RISC-V). Benchmark Environment: Hardware: Sophon SG2044 OS: Linux (RISC-V 64-bit) Compiler: GCC 12.3.1 Results:* Comparison between the original build and the build with . (Note: Data collected using benchmark)
Summary This PR updates to select for RISC-V builds when both and are defined. Motivation indicates support for misaligned loads/stores in main memory. For these targets, using method 2 enables direct unaligned memory access in . References GCC Zicclsm RVA20U64 specification Changes Updated the default selection logic: when Keep existing GCC fallback: for other GCC targets No changes to behavior when is explicitly set by the build system. Validation Verified the updated preprocessor branch compiles cleanly in . No linter issues reported for the modified file. Benchmark Data (Compression Speed) Method vs Method 0 Method 2 +74% Method 1 +39% Method 0 - Data screenshot
According to the mmap docs is returned upon error: On success, mmap() returns a pointer to the mapped area. On error, the value MAP_FAILED (that is, (void *) -1) is returned, and errno is set to indicate the error. Update mmap error validation to check for instead of NULL. POSIX specifies that mmap returns (-1) on failure. Reported-by: Clang 21 Static Analyzer