Bug 2259215

Summary: micropython FTBS with GCC 14
Product: [Fedora] Fedora Reporter: Jakub Jelinek <jakub>
Component: micropythonAssignee: Charalampos Stratakis <cstratak>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 40CC: mhroncok, python-packagers-sig, releng, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: micropython-1.22.2-1.fc41 micropython-1.22.2-1.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-03-26 20:09:35 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2231791    

Description Jakub Jelinek 2024-01-19 15:43:29 UTC
Various tests FAIL in micropython when built with GCC 14 snapshots (such as gcc-14.0.1-0.2.fc40 in rawhide).

I believe the bug is in micropython-1.21.0/py/nlrx64.c (nlr_jump).
Preprocessed the function is:
__attribute__((noreturn)) void nlr_jump(void *val) {
    nlr_buf_t **_top_ptr = &(mp_thread_get_state()->nlr_top); nlr_buf_t *top = *_top_ptr; if (top == ((void *)0)) { nlr_jump_fail(val); } top->ret_val = val; nlr_call_jump_callbacks(top); (void)top; *_top_ptr = top->prev;
    __asm volatile (
        "movq   %0, %%rcx           \n"
        "movq   72(%%rcx), %%r15    \n"
        "movq   64(%%rcx), %%r14    \n"
        "movq   56(%%rcx), %%r13    \n"
        "movq   48(%%rcx), %%r12    \n"
        "movq   40(%%rcx), %%rbx    \n"
        "movq   32(%%rcx), %%rsp    \n"
        "movq   24(%%rcx), %%rbp    \n"
        "movq   16(%%rcx), %%rax    \n"
        "movq   %%rax, (%%rsp)      \n"
        "xorq   %%rax, %%rax        \n"
        "inc    %%al                \n"
        "ret                        \n"
        :
        : "r" (top)
        :
        );
    __builtin_unreachable();
}
The bug is that the inline asm doesn't use "memory" clobber nor say uses "m" (top) to explain to the compiler that the inline asm reads from memory, so starting with https://gcc.gnu.org/r14-1982 GCC dead store eliminates the *_top_ptr = top->prev; store - the inline asm doesn't indicate it reads any memory and then is __builtin_unreachable () so nothing later will need the store either.

Reproducible: Always

Comment 1 Aoife Moloney 2024-02-15 23:10:44 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 2 Tomas Orsava 2024-03-13 13:17:43 UTC
*** Bug 2261376 has been marked as a duplicate of this bug. ***

Comment 4 Fedora Update System 2024-03-26 20:04:43 UTC
FEDORA-2024-9f2a705459 (micropython-1.22.2-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-9f2a705459

Comment 5 Fedora Update System 2024-03-26 20:09:35 UTC
FEDORA-2024-9f2a705459 (micropython-1.22.2-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 6 Fedora Update System 2024-03-26 21:44:44 UTC
FEDORA-2024-51e55a7065 (micropython-1.22.2-1.fc38) has been submitted as an update to Fedora 38.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-51e55a7065

Comment 7 Fedora Update System 2024-03-26 21:44:54 UTC
FEDORA-2024-a3b517705e (micropython-1.22.2-1.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-a3b517705e

Comment 8 Fedora Update System 2024-03-26 21:45:04 UTC
FEDORA-2024-34aa24af35 (micropython-1.22.2-1.fc39) has been submitted as an update to Fedora 39.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-34aa24af35

Comment 9 Fedora Update System 2024-03-27 02:25:43 UTC
FEDORA-2024-51e55a7065 has been pushed to the Fedora 38 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-51e55a7065`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-51e55a7065

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

Comment 10 Fedora Update System 2024-03-27 02:35:42 UTC
FEDORA-2024-34aa24af35 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-34aa24af35`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-34aa24af35

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

Comment 11 Fedora Update System 2024-03-27 02:36:05 UTC
FEDORA-2024-a3b517705e has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-a3b517705e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-a3b517705e

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

Comment 12 Fedora Update System 2024-04-04 00:46:21 UTC
FEDORA-2024-34aa24af35 (micropython-1.22.2-1.fc39) has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2024-04-04 00:55:22 UTC
FEDORA-2024-51e55a7065 (micropython-1.22.2-1.fc38) has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2024-04-05 23:09:59 UTC
FEDORA-2024-a3b517705e (micropython-1.22.2-1.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.