From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B17813858C00; Fri, 27 Jan 2023 18:07:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B17813858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674842846; bh=FgvNv4e/8pCTiRfKVKe1LDlh0wtM520tRNWPbY/17Mk=; h=From:To:Subject:Date:From; b=uryYFOcOwhdRmYgzmOIKEO4bwxxZGQARqOjvHcHsA7f8zJd2WDW+dkpJ8c0JNP2II eBzD769sGi2AmEMxeuB+vg3vZmrScqWQCrZ9veAeMFM6CPdA7u8Zgl5wrn/5KvbDa3 E3dJ+bgFQdw1poxr3ncx6wZRU/50zd1JRCB5vrHQ= From: "ergasies.uni at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/108575] New: Bug in gcc arm non eabi Date: Fri, 27 Jan 2023 18:07:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 10.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ergasies.uni at gmail 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 attachments.created 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=3D108575 Bug ID: 108575 Summary: Bug in gcc arm non eabi Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: ergasies.uni at gmail dot com Target Milestone: --- Created attachment 54363 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D54363&action=3Dedit i files and some screenshots. Hi, I use the gcc-arm-none-eabi-10.3-2021.10 version. I working on Fedora 29.=20 My C Code is auto-generated from Simulink. The following code is the function call.=20 /* ModelReference: '/AngleCalculation' incorporates: * DataStoreRead: '/Data Store Read' * Inport: '/Input' * Inport: '/Input1' * UnitDelay: '/Unit Delay' */ ConvertPWMtoAngle(&qSoll, &rtb_UnitDelay_n, &UnitDelay_DSTATE, &rtb_AngleCalculation_o1, &Sig_MechanicalAngle); and this is the declaration of the function.=20 /* Output and update for referenced model: 'ConvertPWMtoAngle' */ void ConvertPWMtoAngle(const int16_T *rtu_qSollin, const boolean_T *rtu_detectStartUpin, const real32_T *rtu_AngleMecIn, real32_T *rty_AngleElec, real32_T *rty_AnlgleMec) The global variable Sig_MechanicalAngle according to map file has the addre= ss 0x0000000020004c94.=20 In the function ConvertPWMtoAngle the implementation looks like this:=20 continuesAngle =3D (degresProCounter * (real32_T)rtb_Switch_d) + (*rtu_AngleMecIn);=20 and the assembly looks like this:=20 0800837C 4B14 LDR R3, =3DEncoderCounter ; [P= C, #80] [0x080083D0] =3D0x20000224 0800837E 881B LDRH R3, [R3] 08008380 4A0E LDR R2, =3DConvertPWMtoAngle_DW = ; [PC, #56] [0x080083BC] =3D0x20004CF0 08008382 8912 LDRH R2, [R2, #8] 08008384 1A9B SUBS R3, R3, R2 08008386 B21B SXTH R3, R3 08008388 EE07 3A90 VMOV S15, R3 0800838C EEF8 7AE7 VCVT.F32.S32 S15, S15 08008390 4B15 LDR R3, =3DdegresProCounter = ; [PC, #84] [0x080083E8] =3D0x080102E0 08008392 ED93 7A00 VLDR S14, [R3] 08008396 EE67 7A87 VMUL.F32 S15, S15, S14 0800839A ED96 7A00 VLDR S14, [R6] 0800839E EE77 7A87 VADD.F32 S15, S15, S14 080083A2 4B12 LDR R3, =3DcontinuesAngle = ; [PC, #72] [0x080083EC] =3D0x20004D0C 080083A4 EDC3 7A00 VSTR S15, [R3] 080083A8 E7CC B 0x08008344 ; +0x11C in line 0800839A ED96 7A00 VLDR S14, [R6]=20 the controller loads from the memory address in R6 the value in S14.=20 But when I check the register R6 Value the has the address value 2001=E2=80= =881548 and this is not the correct address, this is not the address from variable Sig_MechanicalAngle. And always the Register S14 has the value 0. The addre= ss 2001=E2=80=881548 exist not in my map file as variable.=20 This is the map entry in this address area:=20 0x0000000020011394 testTask500msHandle 0x0000000020011398 ComputationINTBuffer 0x0000000020011598 testTask500msBuffer COMMON 0x0000000020011d98 0x2c ./Core/Src/main.o 0x0000000020011d98 ClockInfos 0x0000000020011dac adcBuffer I changed my implementation to continuesAngle =3D (degresProCounter * (real32_T)rtb_Switch_d) + (Sig_MechanicalAngle); and the software is working properly.=20 I checked also my stack and i did not find a stack overflow.=20 That means when I use a pointer I have a big trouble and when I use the obj= ect of the variable then everything is ok.=20 Could you help me and see if is it a bug?=