From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 76DB63858D32; Thu, 6 Apr 2023 14:04:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76DB63858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680789871; bh=ZpcOaSkXtTU6ItE6APcaOXLGYX/bYP3LZIFBDVCTUF0=; h=From:To:Subject:Date:From; b=jAM+9T1vqN1SIcs6Zek61xj7mtbKM4KL6RMAfSB6JYGVVoxXASqehQyXFnC0mxi5p +KlN67qR8pzalJhnjPfmRnc85KYfJCFhKcllJZ+RTUZ/EgyPaYDH/e2J+a4bmxZXt8 wT00EevOHOHw47iVExA880V8qpOGRGgY7aoYqMgg= From: "jovan.dmitrovic at syrmia dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug other/109435] New: [MIPS64R6] Typedef struct alignment returns incorrect results Date: Thu, 06 Apr 2023 14:04:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: other X-Bugzilla-Version: 10.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jovan.dmitrovic at syrmia dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109435 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 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 =3D {1, 2, 3, 4, 5, 6, 7, 8}; printf("res1: %d\n", callee(99, identity(vec))); uint8 temp =3D 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.=20 Furthermore, this bug is reproducible only if there is a unused argument x = in function callee. Adding more arguments or switching their places also produ= ces expected values. Type of x doesn't seem to impact the result.=