From nobody Tue Mar 07 10:53:15 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PWC3b6vcZz3xDvJ for ; Tue, 7 Mar 2023 10:53:31 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic316-8.consmr.mail.gq1.yahoo.com (sonic316-8.consmr.mail.gq1.yahoo.com [98.137.69.32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PWC3b0Qggz3R8y for ; Tue, 7 Mar 2023 10:53:30 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=ALm4KKUo; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.69.32 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1678186408; bh=xBB8Nbe6gcNZY+Skz+Yim435IkLKW6AoPAFa0NB2RBc=; h=From:Subject:Date:References:To:In-Reply-To:From:Subject:Reply-To; b=ALm4KKUo4Z7Z82DYfWlRPBAYPorPltHPMlc2khN2NBZmolPzujPOyZZBLMKbtzcNRrZlnpaV8fQXZ8KgProQD5Xgh+02HtR1VvortWQ+MfKt8773MqVPkPhC590CzcR59D4DD1RrTyxMJI56BHAdtOmZZfDAczSvhMu0okSfy2qtmHsfHn4+ZL2x1hv78W0tSaR5t/5ipITH5onxXmyIgwCN17wMX0d7AsLcJyQhFYuBZfFO4GfcI/nhS2r/+/dtLWChFfrObJv7hJLmibP//GUsonXtbdzpgtOTmBlb6cWuTvS2unp2sPKQPj5ez+gVo2JpDL4qXv66aIWMqlAksA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1678186408; bh=S6PWUph3d12DFqhnycPfqdmYs5rcYjKC/HiI6uBsL0J=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=bgV5ScGB2ySJOwMWVujFwazbpBURT/E1ko15mX/vzqKavezqagFZTqHFBjZWMca21B0n30z8ODS008hYOndPQ3QJEhgEIYNIBmW0wrv73JbyEpbh6fNrsHrKRzHBsGfvvowLJpT9gEhdMKJuDqPCHt+mfWoosvqJTPE0qhpnSLeu+I+hgHmwgzoa8Odf6BOSYb4UMmbEshW5V8Tjvao4omcWmCg+8z4bW2v/PdkwCKSvzlFrdy0h3Xj6c6Eg8DXVe0vgU1wnE9DU29bthlThrQVcfRIVUyxevCsADgUN1y1IsJLh5xOTK5DBQ8bHLgG0DsQryg+DIy6ke9O/SUh/eA== X-YMail-OSG: aebwvMkVM1m9cBp_ZS65sZejWhllV_Lrbn8O8aMwLlQ_3WmPPi9AnxrntRTuOKr 7zUriHJyd9Vf_wWv9hlsmLDqbj_6jB58Ukoe6QttqYCqK71o2DqhOqXWzABQFK.0qpv9qWLhrlGA M40rSl7kCcAXEduoJJkAnvzGj4g4zLG0kqLDFMyZV6WpUB7nyy_.m7.9EF6pMcu1Qn3iG.ilTuA3 2_inOweJ3Kzb7rD9rFaN1rkWllQ0eZzZ8unlJ45UyxlQGG28fAWsoc7d4udVVSTv9bdlA_RtZCPx TtPMiP4Htdbx.AktW5pMHIFkdharwtXpRaHBC2ixCZGh4is4uFjXZHR3vCwBPX.RplZGdfUD3M8j b0IJT45N6nJVKoLwWX5.Y5_F8D4jUoBBjTt.2XAo4lgR46vJOtbQB8iMZJ61PJVd50i0dznHktNC T.z5.LD2cVfEheCyc2_9oSlgwSvBtr.40JunpeVzU7iGtU7hrAY7b16AnD8FgqHGMkisbbuKBH6v 5sryQBR1URD75hmgtR6OwxsD_pD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fRE1Z6g1mGgnVGQkAw8TMfbH6aXs 3N3X_xwcwOjHGHXAmlxAI..G_.g_D3pqBIVJFEaIfD5wmGhonHTwVJyxFA_rMDYd5yc_g3IyXjD9 dJcLGAvg6gq543060hsTPF2vb76wsiw5N6LwSDTkwfr7TCWj64C6fy4xZ8hL0_t_beuNljptdi1C .5CT0K54RKRj96WmdAx64IHE0J0VPrsh2WRs51UAeZAkzJvEL9ymjgrl2DcDi90aMWXYM2c3M1pX ttcVuZ5xSMyY7UCEaqKQ9.ozCpGc_N7276RR3PhVhRZyPojxewNfEOu.jnwk4ITv0Utk.BP0xYZw j.FjxKxE_rLnkNml2hiBVWErOEaC2DMPRSLRJ8bE3IgWuTqhAnoRrYHdCFjGVbe4bLiZYiTK8lGs s_a6Sofbx_Tbj8FvGepCRBWyW4AFbn_bruIZkVBt_OPHcdVJreITFzNbxX2r6qCqLFkojm59qXcu D_H_pIaBEK4eYwbFYGXRtezRdmHwI3zvdTf7tImg_p_TZuhZgWKkBc97eXi97dr8AZx5rm0zthJE 4Wg49ZVYyHjra8w50sSZ0xNN9OeC6B7B8p2O_E8MyTdSUIxy9R1ORsCwTyAlpbMWYUbndIdKegS4 MoBk.PhowRTtHpAGve8uAjuOTueSHKTKZbJITnOytM59oeUcTsRfE7oAhhHIEubugoE8Bk5gW95j KjA-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic316.consmr.mail.gq1.yahoo.com with HTTP; Tue, 7 Mar 2023 10:53:28 +0000 Received: by hermes--production-gq1-6cf7749bc8-gfc22 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID aa836dde43238a22303c170784f9c092; Tue, 07 Mar 2023 10:53:26 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Subject: a system-clang 15 and devel/llvm1[56] armv7 code generation error: a small test case Date: Tue, 7 Mar 2023 02:53:15 -0800 References: <2HOLCFE6Z_cOyGycU4ZBU7Lf6kcqohVx7tiLiRLzdjMEc6a8DFeH1IaJqdPNJOqFVTh1MGE7_UUJLcg2gg0UbTZIHZl72NbaNEsqrJwJ3xA=@lorenzosalvadore.it> <93707ED2-F529-49DE-A018-794827F56247@yahoo.com> <7AA0AE73-87CC-4B26-92B2-A0EC4281F429@yahoo.com> <480C8278-DC30-40D6-AED2-F52F59E78EBC@yahoo.com> To: FreeBSD Toolchain , freebsd-arm In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3731.400.51.1.1) X-Spamd-Result: default: False [-2.70 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; NEURAL_HAM_SHORT(-0.20)[-0.196]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; RCVD_IN_DNSWL_NONE(0.00)[98.137.69.32:from]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; MLMMJ_DEST(0.00)[freebsd-arm@freebsd.org]; TO_DN_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; FREEMAIL_FROM(0.00)[yahoo.com]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[yahoo.com:+]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; MIME_TRACE(0.00)[0:+]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.69.32:from] X-Rspamd-Queue-Id: 4PWC3b0Qggz3R8y X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N [This is just an FYI about a system-clang 15 and devel/llvm1[56] armv7 code generation bug. The investigation sequence notes that lead to this discovery is on the freebsd-ports list.] On Mar 7, 2023, at 02:26, Mark Millard wrote on the freebsd-ports list: > Below is a small example C source showing the clang 15+ armv7 > problem that leads to the unbounded looping in later code in > the lang/gcc12+ builds: a data structure is mis-initialized, > breaking its invariant properties used by the later code > structure. >=20 > # more partition.c > // Minor varation of part of some gcc source code! >=20 > // For system-clang 15: cc -g -O2 partition.c ; ./a.out > // For devel/llvm16: clang16 -g -O2 partition.c ; ./a.out >=20 > #include >=20 > #define NUM_ELEMENTS 32 >=20 > struct partition_elem > { > struct partition_elem* next; > int class_element; > unsigned class_count; > }; >=20 > typedef struct partition_def > { > int num_elements; > struct partition_elem elements[NUM_ELEMENTS]; > } *partition; >=20 > struct partition_def partition_storage; >=20 > partition > partition_new (int num_elements) > { > int e; >=20 > if (NUM_ELEMENTS < num_elements) num_elements =3D NUM_ELEMENTS; >=20 > partition part=3D &partition_storage; > part->num_elements =3D num_elements; > for (e =3D 0; e < num_elements; ++e) > { > part->elements[e].class_element =3D e; > part->elements[e].next =3D &(part->elements[e]); > part->elements[e].class_count =3D 1; > } >=20 > for (e =3D 0; e < num_elements; ++e) > printf("%d: %p : next?: = %p\n",e,(void*)&part->elements[e],(void*)part->elements[e].next); >=20 > return part; > } >=20 > int main(void) > { > partition part; > part=3D partition_new(NUM_ELEMENTS); >=20 > return !part; > } >=20 > In the output below, note the blocks of 4 "next" > values that do not change. Each should match the > earlier hexadecimal value on the same line: point > back to same element of the array. 3 of 4 do not. >=20 > # cc -g -O2 partition.c > # ./a.out > 0: 0x40a84 : next?: 0x40a84 > 1: 0x40a90 : next?: 0x40a84 > 2: 0x40a9c : next?: 0x40a84 > 3: 0x40aa8 : next?: 0x40a84 > 4: 0x40ab4 : next?: 0x40ab4 > 5: 0x40ac0 : next?: 0x40ab4 > 6: 0x40acc : next?: 0x40ab4 > 7: 0x40ad8 : next?: 0x40ab4 > 8: 0x40ae4 : next?: 0x40ae4 > 9: 0x40af0 : next?: 0x40ae4 > 10: 0x40afc : next?: 0x40ae4 > 11: 0x40b08 : next?: 0x40ae4 > 12: 0x40b14 : next?: 0x40b14 > 13: 0x40b20 : next?: 0x40b14 > 14: 0x40b2c : next?: 0x40b14 > 15: 0x40b38 : next?: 0x40b14 > 16: 0x40b44 : next?: 0x40b44 > 17: 0x40b50 : next?: 0x40b44 > 18: 0x40b5c : next?: 0x40b44 > 19: 0x40b68 : next?: 0x40b44 > 20: 0x40b74 : next?: 0x40b74 > 21: 0x40b80 : next?: 0x40b74 > 22: 0x40b8c : next?: 0x40b74 > 23: 0x40b98 : next?: 0x40b74 > 24: 0x40ba4 : next?: 0x40ba4 > 25: 0x40bb0 : next?: 0x40ba4 > 26: 0x40bbc : next?: 0x40ba4 > 27: 0x40bc8 : next?: 0x40ba4 > 28: 0x40bd4 : next?: 0x40bd4 > 29: 0x40be0 : next?: 0x40bd4 > 30: 0x40bec : next?: 0x40bd4 > 31: 0x40bf8 : next?: 0x40bd4 >=20 > Turns out that the -O2 is important: no other that I > tried got the problem, including -O3 not getting the > problem. lang/gcc12+ builds happen to use -O2 , at > least in my environment. >=20 > -g is not required for the problem. >=20 I've not built lang/gcc11 or before in a long time. Building them "no bootstrap" style via clang15+ may hit the same type of problem for all I know. =3D=3D=3D Mark Millard marklmi at yahoo.com