public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results @ 2023-04-06 14:04 jovan.dmitrovic at syrmia dot com 2023-04-06 14:28 ` [Bug other/109435] " jovan.dmitrovic at syrmia dot com ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: jovan.dmitrovic at syrmia dot com @ 2023-04-06 14:04 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109435 Bug ID: 109435 Summary: [MIPS64R6] Typedef struct alignment returns incorrect results Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other Assignee: unassigned at gcc dot gnu.org Reporter: jovan.dmitrovic at syrmia dot com Target Milestone: --- Consider the following testcase: #include<stdio.h> typedef struct uint8 { unsigned v[8]; } uint8 __attribute__ ((aligned(128))); unsigned callee(int x, uint8 a) { return a.v[0]; } uint8 identity(uint8 in) { return in; } int main() { uint8 vec = {1, 2, 3, 4, 5, 6, 7, 8}; printf("res1: %d\n", callee(99, identity(vec))); uint8 temp = identity(vec); printf("res2: %d\n", callee(99, temp)); } When this code is compiled for MIPS64 R6, output is as follows: res1: 3 res2: 1 However, when aligned attribute is removed from the testcase, res1 and res2 become 1, which are values that were expected in the first place. Furthermore, this bug is reproducible only if there is a unused argument x in function callee. Adding more arguments or switching their places also produces expected values. Type of x doesn't seem to impact the result. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug other/109435] [MIPS64R6] Typedef struct alignment returns incorrect results 2023-04-06 14:04 [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results jovan.dmitrovic at syrmia dot com @ 2023-04-06 14:28 ` jovan.dmitrovic at syrmia dot com 2023-04-06 19:14 ` [Bug target/109435] overaligned structs are not passed correctly for mips64 pinskia at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jovan.dmitrovic at syrmia dot com @ 2023-04-06 14:28 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109435 --- Comment #1 from Jovan Dmitrović <jovan.dmitrovic at syrmia dot com> --- This is compile command that I used: mipsisa64r6-linux-gnuabi64-gcc -march=mips64r6 -mabi=64 -O0 -o foo foo.c -static I used the MIPS gcc package from Ubuntu's package repository. Also, I used qemu-mips64 to run the executable file. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109435] overaligned structs are not passed correctly for mips64 2023-04-06 14:04 [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results jovan.dmitrovic at syrmia dot com 2023-04-06 14:28 ` [Bug other/109435] " jovan.dmitrovic at syrmia dot com @ 2023-04-06 19:14 ` pinskia at gcc dot gnu.org 2023-05-29 11:07 ` jovan.dmitrovic at syrmia dot com ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: pinskia at gcc dot gnu.org @ 2023-04-06 19:14 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109435 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=88469 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The aarch64 and arm backends had a similar issue which was fixed too. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109435] overaligned structs are not passed correctly for mips64 2023-04-06 14:04 [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results jovan.dmitrovic at syrmia dot com 2023-04-06 14:28 ` [Bug other/109435] " jovan.dmitrovic at syrmia dot com 2023-04-06 19:14 ` [Bug target/109435] overaligned structs are not passed correctly for mips64 pinskia at gcc dot gnu.org @ 2023-05-29 11:07 ` jovan.dmitrovic at syrmia dot com 2023-06-30 3:21 ` cvs-commit at gcc dot gnu.org 2023-07-01 6:35 ` syq at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jovan.dmitrovic at syrmia dot com @ 2023-05-29 11:07 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109435 --- Comment #3 from Jovan Dmitrović <jovan.dmitrovic at syrmia dot com> --- Tentative patch posted on the mailing list: https://gcc.gnu.org/pipermail/gcc-patches/2023-May/619949.html ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109435] overaligned structs are not passed correctly for mips64 2023-04-06 14:04 [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results jovan.dmitrovic at syrmia dot com ` (2 preceding siblings ...) 2023-05-29 11:07 ` jovan.dmitrovic at syrmia dot com @ 2023-06-30 3:21 ` cvs-commit at gcc dot gnu.org 2023-07-01 6:35 ` syq at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: cvs-commit at gcc dot gnu.org @ 2023-06-30 3:21 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109435 --- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by YunQiang Su <syq@gcc.gnu.org>: https://gcc.gnu.org/g:e20abdb749d0c0c8552da998ff8ec139b830f5eb commit r14-2205-ge20abdb749d0c0c8552da998ff8ec139b830f5eb Author: Jovan Dmitrovic <Jovan.Dmitrovic@Syrmia.com> Date: Mon Jun 26 17:00:20 2023 +0200 mips: Fix overaligned function arguments [PR109435] This patch changes alignment for typedef types when passed as arguments, making the alignment equal to the alignment of original (aliased) types. This change makes it impossible for a typedef type to have alignment that is less than its size. 2023-06-27 Jovan DmitroviÄ <jovan.dmitrovic@syrmia.com> gcc/ChangeLog: PR target/109435 * config/mips/mips.cc (mips_function_arg_alignment): Returns the alignment of function argument. In case of typedef type, it returns the aligment of the aliased type. (mips_function_arg_boundary): Relocated calculation of the aligment of function arguments. gcc/testsuite/ChangeLog: * gcc.target/mips/align-1-n64.c: New test. * gcc.target/mips/align-1-o32.c: New test. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug target/109435] overaligned structs are not passed correctly for mips64 2023-04-06 14:04 [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results jovan.dmitrovic at syrmia dot com ` (3 preceding siblings ...) 2023-06-30 3:21 ` cvs-commit at gcc dot gnu.org @ 2023-07-01 6:35 ` syq at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: syq at gcc dot gnu.org @ 2023-07-01 6:35 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109435 YunQiang Su <syq at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED CC| |syq at gcc dot gnu.org --- Comment #5 from YunQiang Su <syq at gcc dot gnu.org> --- Fixed by commit: https://gcc.gnu.org/g:e20abdb749d0c0c8552da998ff8ec139b830f5eb ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-01 6:35 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-04-06 14:04 [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results jovan.dmitrovic at syrmia dot com 2023-04-06 14:28 ` [Bug other/109435] " jovan.dmitrovic at syrmia dot com 2023-04-06 19:14 ` [Bug target/109435] overaligned structs are not passed correctly for mips64 pinskia at gcc dot gnu.org 2023-05-29 11:07 ` jovan.dmitrovic at syrmia dot com 2023-06-30 3:21 ` cvs-commit at gcc dot gnu.org 2023-07-01 6:35 ` syq at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).