Comments (11)
Not observed on commit 9f6bc3b or earlier (build: https://app.travis-ci.com/github/ivmai/libatomic_ops/jobs/609611344).
Commit 418dfb5 seems to be the 1st one the issue could be reproduced at (with some occurrence rate).
from libatomic_ops.
Build: https://app.travis-ci.com/github/ivmai/libatomic_ops/jobs/612448219
Source: master (e106a87)
from libatomic_ops.
Build: https://app.travis-ci.com/github/ivmai/libatomic_ops/jobs/612743595
Source: master (42684a2)
from libatomic_ops.
Source: master (42684a2)
Reproduced on cfarm203.
Compiler: gcc (Debian 13.2.0-6) 13.2.0
cd out && cmake -DCMAKE_BUILD_TYPE=MinSizeRel -Denable_assertions=ON -Denable_atomic_intrinsics=OFF -Dbuild_tests=ON -Denable_werror=ON -Werror=dev .. && cmake --build . && ctest
Or:
gcc -Isrc -D AO_DISABLE_GCC_ATOMICS -Os tests/test_atomic.c -lpthread && ./a.out
Or:
gcc -Isrc -D AO_DISABLE_GCC_ATOMICS -Os -D AO_PREFER_GENERALIZED -D AO_GENERALIZE_ASM_BOOL_CAS tests/test_atomic.c -lpthread && ./a.out
from libatomic_ops.
Not reproduced with clang.
Not reproduced with -O0, -O1, -O2, -O3.
from libatomic_ops.
Looks like an issues in the compiler (gcc), The potential workaround is to avoid "static" for counter1 variable (in tests/test_atomic.c). Diff of asm (generated by gcc -I src -D AO_DISABLE_GCC_ATOMICS -Os -S tests/test_atomic.c
):
--- test_atomic.s
+++ test_atomic-after-workaround.s
@@ -470,7 +470,8 @@
cmpwi 3,3,1
.cfi_register 65, 0
.cfi_offset 70, 8
- bl _savegpr0_28
+ bl _savegpr0_27
+ .cfi_offset 27, -40
.cfi_offset 28, -32
.cfi_offset 29, -24
.cfi_offset 30, -16
@@ -517,28 +518,29 @@
li 3,0
lwz 12,8(1)
mtcrf 24,12
- b _restgpr0_28
+ b _restgpr0_27
.cfi_restore 31
.cfi_restore 30
.cfi_restore 29
.cfi_restore 28
+ .cfi_restore 27
.cfi_restore 65
.cfi_restore 70
.L32:
.cfi_restore_state
mr 3,28
bl AO_load_acquire
- ld 5,8(31)
+ ld 27,8(31)
mr 30,3
mr 3,28
- std 5,112(1)
bl AO_load_acquire
- ld 5,112(1)
+ cmpld 0,30,27
+ ld 5,8(31)
mr 6,3
- cmpld 0,30,5
ble 0,.L35
addis 4,2,.LC7@toc@ha
mr 6,30
+ mr 5,27
addi 4,4,.LC7@toc@l
.L40:
addis 9,2,.LC5@toc@ha
@@ -554,7 +556,7 @@
addi 4,4,.LC8@toc@l
b .L40
.long 0
- .byte 0,0,0,3,128,4,0,0
+ .byte 0,0,0,3,128,5,0,0
.cfi_endproc
.LFE57:
.size acqrel_thr,.-.L.acqrel_thr
@@ -4960,6 +4962,7 @@
.LFE62:
.size main,.-.L.main
.globl junk
+ .globl counter1
.section ".data"
.align 3
.set .LANCHOR1,. + 0
from libatomic_ops.
Hello @sharkcz, could you please look at this issue? Seems to be a bug in gcc on ppc64.
I have prepared a W/A but i have not analyzed the asm code diff.
from libatomic_ops.
Hi @ivmai , does it need some special options/defines set to expose the issue? Our CI using Fedora 38 with gcc-13.2.1-4.fc38.ppc64le (snapshot from the gcc13 branch) hasn't seen it.
from libatomic_ops.
Exactly, you could reproduce it in 2 ways:
Type
git checkout 20390d7~1 && gcc -Isrc -D AO_DISABLE_GCC_ATOMICS -Os tests/test_atomic.c -lpthread && ./a.out
Or
git checkout 20390d7~1 && ./configure && make check CC=gcc CFLAGS_EXTRA="-D AO_DISABLE_GCC_ATOMICS -Os"
from libatomic_ops.
Thanks, reproduced.
from libatomic_ops.
Related Issues (20)
- Test suite fails to build with gcc-7 on amd64 HOT 3
- How can I get libatomic_ops.a ? HOT 3
- coredump with '__atomic_fetch_add' function on aarch64 HOT 2
- [x86 gcc] Missing dx side effect in AO_compare_double_and_swap_double_full HOT 10
- SIGSEGV in test_malloc on Alpine linux/s390x HOT 12
- test_stack fail on linux/arm64 (clang) HOT 13
- FTBFS in the testsuite on riscv64 HOT 6
- Incorrect use of sizeof operator to verify alignment HOT 5
- Downstream libatomic_ops releases (Sep 2021) HOT 26
- Explore existing changes in forks (Nov 2021) HOT 3
- test_malloc abort on sparc HOT 3
- Downstream libatomic_ops releases (Aug 2022) HOT 18
- Outdated config.guess Files HOT 3
- Downstream libatomic_ops release (Mar 2023) HOT 24
- Undefined reference to AO_pt_lock on Ubuntu 22.04 when building with configure and clang-16 HOT 2
- test_stack fail on E2K in 64-bit mode HOT 11
- configure AC_FUNC_MMAP does not detect mmap on CheriBSD HOT 2
- Support protected mode of E2K HOT 1
- Downstream libatomic_ops v7.8.2 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libatomic_ops.