Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Rosario19 Newsgroups: comp.lang.c Subject: Re: Can someone please verify the execution trace of this? Date: Sun, 19 May 2024 06:25:21 +0200 Organization: A noiseless patient Spider Lines: 49 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Sun, 19 May 2024 06:25:22 +0200 (CEST) Injection-Info: dont-email.me; posting-host="b7dd86ba3674e1b68042e5eaa221ccb8"; logging-data="3387018"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VNxPC4s5zLVKcWV9YSzscW+9EdRKWErE=" Cancel-Lock: sha1:CUR8gaRb49KsLDOS3tk92hTyBD4= X-Newsreader: Forte Free Agent 1.93/32.576 English (American) Bytes: 2439 On Sat, 18 May 2024 16:40:45 -0500, olcott wrote: >People are saying that they have no idea what this code does >because they do not believe it conforms to c11 or c17. > >typedef int (*ptr)(); // ptr is pointer to int function >00 int H(ptr x, ptr y); >01 int D(ptr x) >02 { >03 int Halt_Status = H(x, x); >04 if (Halt_Status) >05 HERE: goto HERE; >06 return Halt_Status; >07 } >08 >09 int main() >10 { >11 H(D,D); here you call H(D,D) D is just a pointer, but what is H? if it is a ponter for me the program is not definited and has to stop here im not one expert of C >12 return 0; >13 } > >In the above case a simulator is an x86 emulator that correctly emulates >at least one of the x86 instructions of D in the order specified by the >x86 instructions of D. > >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. > >*Execution Trace* >Line 11: main() invokes H(D,D); > >*keeps repeating* (unless aborted) >Line 01: >Line 02: >Line 03: simulated D(D) invokes simulated H(D,D) that simulates D(D) > >*Simulation invariant* >D correctly simulated by H cannot possibly reach past its own line 03. > >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.