Deutsch   English   Français   Italiano  
<32565d46f03edef2380267eeb552fcce102e6753.camel@gmail.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wij <wyniijj5@gmail.com>
Newsgroups: comp.lang.c++
Subject: Re: Can someone please verify the execution trace of this?
Date: Tue, 21 May 2024 00:21:52 +0800
Organization: A noiseless patient Spider
Lines: 164
Message-ID: <32565d46f03edef2380267eeb552fcce102e6753.camel@gmail.com>
References: <v2b78t$2vima$1@dont-email.me>
	 <v2df79$3ghfd$1@raubtier-asyl.eternal-september.org>
	 <v2di7v$3gujt$1@dont-email.me>
	 <v2eada$3p6sk$1@raubtier-asyl.eternal-september.org>
	 <v2edbr$3pl2i$1@dont-email.me>
	 <eaa0ef93ca03f744edc4fbcf6e79fc730805cce9.camel@gmail.com>
	 <v2fom7$1pfh$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Mon, 20 May 2024 18:21:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ef40af8de3ec9bd1fc1347cc87190775";
	logging-data="72120"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19NC8v7E/nenUHSx76yqhek"
User-Agent: Evolution 3.50.2 (3.50.2-1.fc39)
Cancel-Lock: sha1:3dM++C1ooUTM4HGbVv3OcKx14Bs=
In-Reply-To: <v2fom7$1pfh$1@dont-email.me>
Bytes: 6762

On Mon, 2024-05-20 at 10:02 -0500, olcott wrote:
> On 5/20/2024 7:37 AM, wij wrote:
> > On Sun, 2024-05-19 at 21:43 -0500, olcott wrote:
> > > On 5/19/2024 8:52 PM, Bonita Montero wrote:
> > > > Am 19.05.2024 um 21:00 schrieb olcott:
> > > > > On 5/19/2024 1:08 PM, Bonita Montero wrote:
> > > > > > Am 18.05.2024 um 23:40 schrieb olcott:
> > > > > > > People are saying that they have no idea what this code does
> > > > > > > because they do not believe it conforms to c11 or c17.
> > > > > > >=20
> > > > > > > typedef int (*ptr)();=C2=A0 // ptr is pointer to int function
> > > > > > > 00 int H(ptr x, ptr y);
> > > > > > > 01 int D(ptr x)
> > > > > > > 02 {
> > > > > > > 03=C2=A0=C2=A0 int Halt_Status =3D H(x, x);
> > > > > > > 04=C2=A0=C2=A0 if (Halt_Status)
> > > > > > > 05=C2=A0=C2=A0=C2=A0=C2=A0 HERE: goto HERE;
> > > > > > > 06=C2=A0=C2=A0 return Halt_Status;
> > > > > > > 07 }
> > > > > > > 08
> > > > > > > 09 int main()
> > > > > > > 10 {
> > > > > > > 11=C2=A0=C2=A0 H(D,D);
> > > > > > > 12=C2=A0=C2=A0 return 0;
> > > > > > > 13 }
> > > > > > >=20
> > > > > > > In the above case a simulator is an x86 emulator that correct=
ly
> > > > > > > emulates
> > > > > > > at least one of the x86 instructions of D in the order specif=
ied by the
> > > > > > > x86 instructions of D.
> > > > > > >=20
> > > > > > > This may include correctly emulating the x86 instructions of =
H in the
> > > > > > > order specified by the x86 instructions of H thus calling H(D=
,D) in
> > > > > > > recursive simulation.
> > > > > > >=20
> > > > > > > *Execution Trace*
> > > > > > > Line 11: main() invokes H(D,D);
> > > > > > >=20
> > > > > > > *keeps repeating* (unless aborted)
> > > > > > > Line 01:
> > > > > > > Line 02:
> > > > > > > Line 03: simulated D(D) invokes simulated H(D,D) that simulat=
es D(D)
> > > > > > >=20
> > > > > > > *Simulation invariant*
> > > > > > > D correctly simulated by H cannot possibly reach past its own=
 line 03.
> > > > > > >=20
> > > > > > > The key thing to note is that no D correctly simulated by any=
 H of
> > > > > > > every
> > > > > > > H/D pair specified by the above template ever reaches its own=
 line 06
> > > > > > > and halts.
> > > > > > >=20
> > > > > >=20
> > > > > > Other people think 30s about this, you think years about that.
> > > > > >=20
> > > > >=20
> > > > > It is the basis for my two decades long primary research into
> > > > > termination analysis. People on another forum have written
> > > > > hundreds of posts claiming that D correctly simulated by H
> > > > > reaches its own line 06 and halts.
> > > > >=20
> > > > > *I have only gotten truthful answers on this forum*
> > > > >=20
> > > >=20
> > > > That's not research, that's nonsense.
> > > >=20
> > >=20
> > > This is not the forum to show that it is not nonsense this is
> > > a simple C question that I should not even have to ask except
> > > for a few people in another forum that consistently lie about
> > > the answer.
> > >=20
> > > I have been a professional C++ developer since Y2K. So I already
> > > know the answer, I just need some competent people in this forum
> > > to attest to this answer. I met Bjarne Stroustrup back when he
> > > was going around the country promoting his new language.
> > >=20
> >=20
> > typedef int (*ptr)();=C2=A0 // ptr is pointer to int function
> > int H(ptr x, ptr y);
> > int D(ptr x)
> > {
> > =C2=A0=C2=A0 int Halt_Status =3D H(x, x);
> > =C2=A0=C2=A0 if (Halt_Status)
> > =C2=A0=C2=A0=C2=A0=C2=A0 HERE: goto HERE;
> > =C2=A0=C2=A0 return Halt_Status;
> > }
> >=20
> > int main()
> > {
> > =C2=A0=C2=A0 H(D,D);
> > =C2=A0=C2=A0 return 0;
> > }
> >=20
> > The code above does not compile:
>=20
> *It does compile*
> *It does compile*
> *It does compile*
> *It does compile*
>=20
> typedef int (*ptr)();
> int H(ptr P, ptr I);
>=20
> int D(ptr x)
> {
> =C2=A0=C2=A0 int Halt_Status =3D H(x, x);
> =C2=A0=C2=A0 if (Halt_Status)
> =C2=A0=C2=A0=C2=A0=C2=A0 HERE: goto HERE;
> =C2=A0=C2=A0 return Halt_Status;
> }
>=20
> int main()
> {
> =C2=A0=C2=A0 H(D,D);
> =C2=A0=C2=A0 return 0;
> }
>=20
> cl=C2=A0 /GS- /std:c11 /c /arch:IA32 Test_Compile.c
> cl=C2=A0 /GS- /std:c17 /c /arch:IA32 Test_Compile.c
> if ERRORLEVEL 1 pause
>=20
>=20
> D:\__HP_Stream\__NLU_Notes\__Work_In_Progress\__Halt_Decider_X86\___x86ut=
m_VS>echo=20
> off
>=20
> D:\__HP_Stream\__NLU_Notes\__Work_In_Progress\__Halt_Decider_X86\___x86ut=
m_VS>REM=20
> 2022
>=20
> D:\__HP_Stream\__NLU_Notes\__Work_In_Progress\__Halt_Decider_X86\___x86ut=
m_VS>call=20
> "C:\Program Files\Microsoft Visual=20
> Studio\2022\Community\Common7\Tools\VsDevCmd.BAT"
> **********************************************************************
> ** Visual Studio 2022 Developer Command Prompt v17.6.4
> ** Copyright (c) 2022 Microsoft Corporation
> **********************************************************************
> Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32535 for x86
> Copyright (C) Microsoft Corporation.=C2=A0 All rights reserved.
>=20
> Test_Compile.c
> Microsoft (R) C/C++ Optimizing Compiler Version 19.36.32535 for x86
> Copyright (C) Microsoft Corporation.=C2=A0 All rights reserved.
>=20
> Test_Compile.c
> Press any key to continue . . .

OK, My fault, gcc can compile (g++ can't. No idea why D's protocol doesn't =
match
type ptr and get compiled in C).

>=20