- Determine alignment offset of base class - 2 Updates
- H_Hat is proved to be halting decidable (current consensus) - 1 Update
- #include'ing .c files considered harmful? - 2 Updates
- Poor Mans RCU... - 1 Update
- Detecting infinite recursion (H_Hat is proved to be decidable) - 1 Update
Marcel Mueller <news.5.maazl@spamgourmet.org>: Mar 01 08:15AM +0100 Am 28.02.21 um 20:39 schrieb Chris M. Thomasson: > struct alignas(ALIGN) base > struct alignas(ALIGN) foo : virtual public base It is trivial when the base class has a greater or same alignment. In this case there is no offset. But when base is used in different subclasses with different alignments it makes no longer sense. In this case base may appear e.g. at 0x...108, 0x...308, 0x...308 etc. Now the algorithm has to deal with the 08 offset in the alignment. Marcel |
Bonita Montero <Bonita.Montero@gmail.com>: Mar 01 07:39PM +0100 > struct alignas(ALIGN) foo : virtual public base Not necessary. The derived class inherits the alignment and if the specified alignment of the derived class is less, it is ignored. |
olcott <NoOne@NoWhere.com>: Mar 01 09:06AM -0600 If we assume that Simulate is functionally equivalent to the following code (even if Simulate is an x86 emulator that emulates the x86 machine code of its input): int Simulate(u32 P, u32 I) { ((void(*)(int))P)(I); return 1; } Then because the execution trace shown below shows that H_Hat() invokes Simulate() with the same data two times in sequence we can conclude that H_Hat() is invoked in infinite recursion entirely based on this execution trace and the assumption that Simulate() does nothing besides execute or emulate it input. // P has the machine address of H_Hat() void H_Hat(u32 P) { u32 Input_Halts = Simulate(P, P); if (Input_Halts) HERE: goto HERE; return; } _H_Hat() [00000858](01) 55 push ebp [00000859](02) 8bec mov ebp,esp [0000085b](01) 51 push ecx [0000085c](03) 8b4508 mov eax,[ebp+08] [0000085f](01) 50 push eax [00000860](03) 8b4d08 mov ecx,[ebp+08] [00000863](01) 51 push ecx [00000864](05) e80ffcffff call 00000478 [00000869](03) 83c408 add esp,+08 [0000086c](03) 8945fc mov [ebp-04],eax [0000086f](04) 837dfc00 cmp dword [ebp-04],+00 [00000873](02) 7402 jz 00000877 [00000875](02) ebfe jmp 00000875 [00000877](02) 8be5 mov esp,ebp [00000879](01) 5d pop ebp [0000087a](01) c3 ret Push instructions have already pushed the value shown in their in the third column. The two push instructions preceding the call to Simulate() are its second and first parameters respectively. Columns (1) Machine address of instruction (2) Machine address of top of stack (3) Value of top of stack after instruction executed (4) Number of bytes of machine code (5) Machine language bytes (6) Assembly language text ...[00000858][000111c5][000111d1](01) 55 push ebp ...[00000859][000111c5][000111d1](02) 8bec mov ebp,esp ...[0000085b][000111c1][00000000](01) 51 push ecx ...[0000085c][000111c1][00000000](03) 8b4508 mov eax,[ebp+08] ...[0000085f][000111bd][00000858](01) 50 push eax ...[00000860][000111bd][00000858](03) 8b4d08 mov ecx,[ebp+08] ...[00000863][000111b9][00000858](01) 51 push ecx ; Call Simulate(0x858, 0x858); ...[00000864][000111b5][00000869](05) e80ffcffff call 00000478 ...[00000858][000111a5][000111b1](01) 55 push ebp ...[00000859][000111a5][000111b1](02) 8bec mov ebp,esp ...[0000085b][000111a1][00000858](01) 51 push ecx ...[0000085c][000111a1][00000858](03) 8b4508 mov eax,[ebp+08] ...[0000085f][0001119d][00000858](01) 50 push eax ...[00000860][0001119d][00000858](03) 8b4d08 mov ecx,[ebp+08] ...[00000863][00011199][00000858](01) 51 push ecx ; Call Simulate(0x858, 0x858); ...[00000864][00011195][00000869](05) e80ffcffff call 00000478 -- Copyright 2021 Pete Olcott "Great spirits have always encountered violent opposition from mediocre minds." Einstein |
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Feb 28 09:57PM -0800 > In what way does this definition of memcpy() not satisfy the > specifications given in the ISO C standard? Or does it pass > that test? My thought was that the effective type rules might cause problems, but I haven't taken the time to do the necessary research. It's very likely I was mistaken. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */ |
James Kuyper <jameskuyper@alumni.caltech.edu>: Mar 01 01:28AM -0500 On 3/1/21 12:57 AM, Keith Thompson wrote: > My thought was that the effective type rules might cause problems, > but I haven't taken the time to do the necessary research. It's very > likely I was mistaken. The effective type rules from the C standard say that "If a value is copied into an object having no declared type using memcpy or memmove, or is copied as an array of character type, then the effective type of the modified object for that access and for subsequent accesses that do not modify the value is the effective type of the object from which the value is copied, if it has one." (6.5p6) This says two distinct things that are relevant to this question: First, that memcpy() is required to transfer over the effective type, and second, that implementation of memcpy() by copying the objects as an array of character type meets that requirement. I don't think there's a problem. I'm not as sure about the C++ rules. The last time I reviewed the relevant clauses, they didn't address the issue anywhere near as clearly as the C standard, and there's been a major revision to C++ standard since I did that review. |
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Feb 28 08:45PM -0800 On 2/18/2021 3:17 AM, Chris M. Thomasson wrote: >> sorry for missing that counting issue in version 0.0.1. If you can >> please, when you get free time, run it again? I need to see your output. >> https://pastebin.com/raw/CYZ78gVj [...] I have an idea about creating a more "distributed" poor mans RCU using per thread sequence locks. Just need to code it up in Relacy. |
Kaz Kylheku <563-365-8930@kylheku.com>: Mar 01 03:52AM > This instance of H_Hat() is proved to be decidable and all the code is > provided. This H_Hat() calls Simulate() that returns true whenever its > input halts. Your eyes keep slipping off the carrot every once in a short while. What's not decidable is universal halting, not any one specific program and its input. Any method by which you can decide a specific program and its input will also work for some other programs/inputs, but not all of them. -- TXR Programming Language: http://nongnu.org/txr Cygna: Cygwin Native Application Library: http://kylheku.com/cygnal |
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page. To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com. |
No comments:
Post a Comment