Bug 2346233 - wasm2c/spec/float_exprs.txt test fails with GCC 15 on ppc64le and s390x
Summary: wasm2c/spec/float_exprs.txt test fails with GCC 15 on ppc64le and s390x
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: FE-ExcludeArch-ppc64, F-ExcludeArch-ppc64
TreeView+ depends on / blocked
 
Reported: 2025-02-18 09:03 UTC by Dominik 'Rathann' Mierzejewski
Modified: 2025-03-10 16:13 UTC (History)
13 users (show)

Fixed In Version: gcc-15.0.1-0.9.fc42
Clone Of:
Environment:
Last Closed: 2025-03-10 16:13:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
preprocessed source (988 bytes, text/plain)
2025-02-18 17:23 UTC, Dan Horák
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 119002 0 P1 NEW [15 Regression] Comparison miscompilation on ppc64le and s390x since r15-6777 2025-02-24 18:15:06 UTC
Github WebAssembly wabt issues 2542 0 None open wasm2c/spec/float_exprs.txt test fails with GCC 15 on ppc64le 2025-02-18 09:03:02 UTC

Description Dominik 'Rathann' Mierzejewski 2025-02-18 09:03:03 UTC
Description of problem:
Starting with gcc-15.0.1-0.3.fc42, the wabt testsuite (1.0.33-1.0.36) is failing on the wasm2c/spec/float_exprs.txt test on ppc64le only.

Version-Release number of selected component (if applicable):
gcc-15.0.1-0.7.fc43.ppc64le

How reproducible:
Always

Steps to Reproduce:
1. fedpkg clone rpms/wabt
2. koji build --scratch --arch=ppc64le rawhide "git+https://src.fedoraproject.org/rpms/wabt.git#9fb6f15d26dcb42284bb5778c468afbb6571b0fa"

Actual results:
...
- test/wasm2c/spec/float_exprs.txt
  expected error code 0, got 1.
  STDERR MISMATCH:
  --- expected
  +++ actual
  @@ -0,0 +1,8 @@
  +float_exprs.wast:2238: assertion failed: in w2c_float__exprs__86__wasm_f320x2Eno_trichotomy_lt(&float__exprs__86__wasm_instance, 0.f, make_nan_f32(0x400000)): expected 0, got 1.
  +float_exprs.wast:2239: assertion failed: in w2c_float__exprs__86__wasm_f320x2Eno_trichotomy_le(&float__exprs__86__wasm_instance, 0.f, make_nan_f32(0x400000)): expected 0, got 1.
  +float_exprs.wast:2240: assertion failed: in w2c_float__exprs__86__wasm_f320x2Eno_trichotomy_gt(&float__exprs__86__wasm_instance, 0.f, make_nan_f32(0x400000)): expected 0, got 1.
  +float_exprs.wast:2241: assertion failed: in w2c_float__exprs__86__wasm_f320x2Eno_trichotomy_ge(&float__exprs__86__wasm_instance, 0.f, make_nan_f32(0x400000)): expected 0, got 1.
  +float_exprs.wast:2242: assertion failed: in w2c_float__exprs__86__wasm_f640x2Eno_trichotomy_lt(&float__exprs__86__wasm_instance, 0.0000000000000000, make_nan_f64(0x8000000000000)): expected 0, got 1.
  +float_exprs.wast:2243: assertion failed: in w2c_float__exprs__86__wasm_f640x2Eno_trichotomy_le(&float__exprs__86__wasm_instance, 0.0000000000000000, make_nan_f64(0x8000000000000)): expected 0, got 1.
  +float_exprs.wast:2244: assertion failed: in w2c_float__exprs__86__wasm_f640x2Eno_trichotomy_gt(&float__exprs__86__wasm_instance, 0.0000000000000000, make_nan_f64(0x8000000000000)): expected 0, got 1.
  +float_exprs.wast:2245: assertion failed: in w2c_float__exprs__86__wasm_f640x2Eno_trichotomy_ge(&float__exprs__86__wasm_instance, 0.0000000000000000, make_nan_f64(0x8000000000000)): expected 0, got 1.
  STDOUT MISMATCH:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -794/794 tests passed.
  +786/794 tests passed.
...

Expected results:
+ test/wasm2c/spec/float_exprs.txt

Additional info:
Upstream says it's a GCC bug.

Comment 1 Dan Horák 2025-02-18 10:43:47 UTC
- with
test/run-tests.py -v -p --bindir redhat-linux-build --timeout=1200 -j8 test/wasm2c/spec/float_exprs.txt
one can run just the single test case

- fails with gcc-15.0.0-0.4.fc42 as well, so it's likely a gcc 15 related issue, not a recent change

Comment 2 Dan Horák 2025-02-18 11:22:32 UTC
seems I am getting somewhere in the test case minimization, stay tuned ...

Comment 3 Dan Horák 2025-02-18 13:15:08 UTC
manually minimized reproducer provided by upstream

#include <string.h>
#include <stdint.h>

typedef uint32_t u32;
typedef float f32;

__attribute__((noinline)) u32 w2c_float__exprs__88__wasm_f320x2Eno_trichotomy_lt_0(void* instance, f32 var_p0, f32 var_p1)
{
  u32 var_i0, var_i1;
  f32 var_f0, var_f1, var_f2;
  var_f0 = var_p0;
  var_f1 = var_p1;
  var_i0 = var_f0 < var_f1;
  var_f1 = var_p0;
  var_f2 = var_p1;
  var_i1 = var_f1 >= var_f2;
  var_i0 |= var_i1;
  return var_i0;
}

static f32 make_nan_f32(u32 x) {
  x |= 0x7f800000;
  f32 res;
  memcpy(&res, &x, sizeof(res));
  return res;
}

int main(int argc, char **argv) {
  return w2c_float__exprs__88__wasm_f320x2Eno_trichotomy_lt_0(NULL, 0.f, make_nan_f32(0x400000));
}

and compiled with
  gcc -std=c99 -O2 -Wall -fno-optimize-sibling-calls -frounding-math -fsignaling-nans -D_DEFAULT_SOURCE -o test test.c
reproduces the issue with GCC 15 (return code 1), but runs OK with GCC 14 (return code 0)

Comment 4 Dan Horák 2025-02-18 13:43:40 UTC
no compiler options except (at least) -O1 are required

Comment 5 Dan Horák 2025-02-18 17:23:51 UTC
Created attachment 2076985 [details]
preprocessed source

Comment 6 Dan Horák 2025-02-21 13:17:54 UTC
same issue exists on s390x too

Comment 7 Fedora Update System 2025-03-03 08:46:21 UTC
FEDORA-2025-6a12d86df4 (gcc-15.0.1-0.9.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-6a12d86df4

Comment 8 Fedora Update System 2025-03-04 01:43:47 UTC
FEDORA-2025-6a12d86df4 has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-6a12d86df4`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-6a12d86df4

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2025-03-10 16:13:51 UTC
FEDORA-2025-6a12d86df4 (gcc-15.0.1-0.9.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.