| Summary: | builtin_bswap32 is broken with -mshort | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | alan | ||||
| Component: | cross-gcc | Assignee: | David Howells <dhowells> | ||||
| Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 23 | CC: | dan, dhowells | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2016-12-20 21:32:36 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Attachments: |
|
||||||
|
Description
alan
2016-09-13 10:43:24 UTC
m68k-linux-gnu-gcc -mshort -m68000 -S /tmp/3.c versus m68k-linux-gnu-gcc -m68000 -S /tmp/3.c Do you have a test program you could attach? Created attachment 1200640 [details]
Example
Sorry thought I attached it earlier
This one isn't quite the same but generates broken output too
m68k-linux-gnu-gcc -m68000 -mshort -O2 -S /tmp/3.c
alan@localhost:~/Bulk/UZI/External/FUZIX/Kernel$ more 3.s
#NO_APP
.file "3.c"
.text
.align 2
.globl x
.type x, @function
x:
link.w %fp,#0
move.l 8(%fp),%d0
ror.w #8,%d0
and.l #65535,%d0
unlk %fp
rts
.size x, .-x
.ident "GCC: (GNU) 5.3.1 20160212 (Red Hat Cross 5.3.1-2)"
.section .note.GNU-stack,"",@progbits
versus
m68k-linux-gnu-gcc -Os -m68000 -S /tmp/3.c
alan@localhost:~/Bulk/UZI/External/FUZIX/Kernel$ more 3.s
#NO_APP
.file "3.c"
.text
.align 2
.globl x
.type x, @function
x:
link.w %fp,#0
move.l 8(%fp),%d0
ror.w #8,%d0
swap %d0
ror.w #8,%d0
unlk %fp
rts
.size x, .-x
.ident "GCC: (GNU) 5.3.1 20160212 (Red Hat Cross 5.3.1-2)"
.section .note.GNU-stack,"",@progbits
To quote Jeff Law on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77599 : The problem here is you're using -mshort on *-linux-gnu which IMHO is invalid. Linux defines int32_t as a "int". And -mshort changes the width of an int to 16 bits, at which point anything prototyped using int32_t has just changed its ABI in a meaningful way (similarly for uint32_t, but unsigned). You can see this in the .optimized dump file: x (long unsigned int y) { unsigned int _1; unsigned int _2; long unsigned int _4; ;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot ;; prev block 0, next block 1, flags: (NEW, REACHABLE, VISITED) ;; pred: ENTRY [100.0%] (FALLTHRU,EXECUTABLE) _1 = (unsigned int) y_3(D); _2 = __builtin_bswap32 (_1); _4 = (long unsigned int) _2; return _4; } Note the type of the _1 and _2. They are both unsigned ints, so 16 bits. If you try this test on a bare metal target such as m68k-elf or without the -mshort, you'll get the expected and desired result. This message is a reminder that Fedora 23 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 23. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '23'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 23 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed. |