Path: ...!feeds.phibee-telecom.net!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Thomas Koenig Newsgroups: comp.arch Subject: Re: Computer architects leaving Intel... Date: Mon, 16 Sep 2024 06:50:45 -0000 (UTC) Organization: A noiseless patient Spider Lines: 37 Message-ID: References: <2024Aug30.161204@mips.complang.tuwien.ac.at> <86r09ulqyp.fsf@linuxsc.com> <2024Sep8.173639@mips.complang.tuwien.ac.at> <2024Sep10.101932@mips.complang.tuwien.ac.at> <2024Sep11.123824@mips.complang.tuwien.ac.at> <867cbhgozo.fsf@linuxsc.com> <20240912142948.00002757@yahoo.com> <865xqzg63u.fsf@linuxsc.com> <20240913144411.00005866@yahoo.com> <20240914215922.000033d1@yahoo.com> <20240915001939.00003be0@yahoo.com> <20240915224235.00006f73@yahoo.com> <86frq0cqud.fsf@linuxsc.com> Injection-Date: Mon, 16 Sep 2024 08:50:45 +0200 (CEST) Injection-Info: dont-email.me; posting-host="791bf6c76acc5f7d6a0b52e0480cb113"; logging-data="2854146"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KrPh5Pz13A21nZVvJF9ggCRIgmCBwK3M=" User-Agent: slrn/1.0.3 (Linux) Cancel-Lock: sha1:Pq9UURE/6gtleeixWfgSCaGb0nQ= Bytes: 2611 Tim Rentsch schrieb: > Michael S writes: > >> On Sun, 15 Sep 2024 20:13:44 +0200 >> David Brown wrote: >> >>> struct Bar { >>> char x[8]; >>> int y; >>> } bar; >>> >>> >>> int foo(int i) { >>> bar.y = 1234; >>> bar.x[i] = 42; >>> return bar.y; >>> } >>> >>> It generates: >>> >>> foo: >>> movslq %edi,%rdi >>> movl $1234, %eax >>> movl $1234, bar+8(%rip) >>> movb $42, bar(%rdi) >>> ret >>> >>> That is, y is /not/ reloaded after bar.x[i] is set. >> >> No other compiler on godbolt is doing it, except possibly gcc clones. >> Not even clang, who's former leader wrote "Nasal Manifest". > > Test runs on two different Ubuntu machines (gcc 7.4.0 and gcc 8.4.0) > both show bar.y not being overwritten (optimization levels -01 or -O2) > when foo() is called. Same for current gcc trunk (bleeding edge development version).