From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 661B13858001; Thu, 15 Jul 2021 11:41:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 661B13858001 From: "simon.willcocks at gmx dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug inline-asm/101422] register variable uninitialised before passing to asm Date: Thu, 15 Jul 2021 11:41:20 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: inline-asm X-Bugzilla-Version: 10.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simon.willcocks at gmx dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID 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: Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Jul 2021 11:41:21 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101422 --- Comment #8 from Simon Willcocks --- (In reply to Andrew Pinski from comment #4) > (In reply to Simon Willcocks from comment #2) > > That's not an accurate description of the problem; the value of the var= iable > > is being passed, not its address. As a register variable, it doesn't ha= ve an > > address. >=20 > It is the address of the array that is being passed (I was copying and > pasting from another bug). > register uint32_t *cap_and_join asm( "r5" ) =3D cap_and_join_style; > Is the same as: > register uint32_t *cap_and_join asm( "r5" ) =3D &cap_and_join_style[0]; >=20 > Because array decays to pointers :). And, of course, I later came up against this precise problem, at least I kn= ew what I was looking for, and thanks to you, how to fix it. The final solutio= n is as follows. I really think that passing a pointer type into an asm should indicate that the object pointed to is used, though. void Draw_Stroke( uint32_t *path )=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 {=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20 // Keep this declaration before the first register variable declaration, = or=20=20=20 // -Os will cause the compiler to forget the preceding registers.=20=20= =20=20=20=20=20=20=20=20=20=20=20 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101422=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 uint32_t cap_and_join_style[5] =3D { 0x00000001 }; // Round joints=20=20= =20=20=20=20=20=20=20=20=20=20=20 register uint32_t *draw_path asm( "r0" ) =3D path;=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 register uint32_t fill_style asm( "r1" ) =3D 0x3f;=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 register uint32_t *matrix asm( "r2" ) =3D 0;=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 register uint32_t flatness asm( "r3" ) =3D 0;=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 register uint32_t thickness asm( "r4" ) =3D 8;=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 register uint32_t *cap_and_join asm( "r5" ) =3D cap_and_join_style;=20=20= =20=20=20=20=20=20=20=20=20=20=20 register uint32_t dashes asm( "r6" ) =3D 0;=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20 asm ( "swi 0x60704" :=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 : "r" (draw_path)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 , "r" (fill_style)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 , "r" (matrix)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 , "r" (flatness)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 , "r" (thickness)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20 , "r" (cap_and_join)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20 , "r" (dashes)=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 , "m" (cap_and_join_style) ); // Without this, array is not initial= ised=20 } I wanted to correct the record and thank you (both). I'll shut up, now.=