Article View: sci.electronics.design
Article #1100Re: Arms race
From: Johann 'Myrkraverk' Oskarsson
Date: Thu, 12 Nov 2026 21:04
Date: Thu, 12 Nov 2026 21:04
47 lines
3920 bytes
3920 bytes
On 11/12/2026 12:35 PM, Bill Sloman wrote: > On 10/11/2026 10:02 pm, Johann 'Myrkraverk' Oskarsson wrote: >> On 11/10/2026 5:14 AM, Waldek Hebisch wrote: >>> Actually, at '-O2' version of 'gcc' that I use replaces explicit >>> division by 0 by the 'ud2' instruction. >> >> Shouldn't that be considered /erroneous compilation/? I mean, you can >> write a signal handler that catches all signals, and isn't /division by >> zero/ one of the Posix signals? Is the compiler prescient and makes >> sure this only happens if the binary is ever run when the user isn't ex- >> plictly expecting a division by zero -- rather than /invalid opcode/? >> >> Does the question bother you? Am I too high, or too low on the /moron/ >> vs. /jedi master/ axis to be understood? Should we put all the GCC devs >> in therapy for believing they are prescient? > > I imagine that there are situations where the programmer can be > confident that the divisor is never going to be zero. > > A cautious programmer might test for a zero divisor and run an error > recovery routine rather than doing the division. > > To me it does look as if you've posted an under-informed response. > You should try to write a signal handler that looks at the offending instruction or something. It's been a while since I did this, and that was for -- overflow? -- I was experimenting with my own + operator in C++ and injected the INTO instruction -- that was before AMD in their never-ending wisdom removed it from the 64bit instruction set -- which I then handled in a fancy Posix signal handler, and if I recall correctly I had access to the very instruction that caused the "fault" and could use it to redirect to a C++ exception mechanism as if that happened in the function causing the "fault" or "trap" or whatever Intel wants to call it. Anyway, that code is long lost, and I never did much with it. It was an illuminating exercise though, and taught me that there's a lot a com- piler can do. Best wishes, and happy Posix signal handlers! -- Johann | email: invalid -> com | http://www.myrkraverk.com/blog/ I'm not from the Internet, I just work there. | via Easynews.com https://bsky.app/profile/myrkraverk.bsky.social | for ( ;; ) _:; Federated at https://fed.brid.gy/bsky/myrkraverk.bsky.social
Technical Details
Message-ID:
<gRpJS.420$0op4.49@fx15.ams4>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx15.ams4.POSTED!not-for-mailReferences:
<11bp6d1$16i93$1@dont-email.me> <a8n6elh26hc5cg98pn84idqp7rrel2l47o@4ax.com> <11bvnp8$3ehgg$1@dont-email.me> <11c0065$3hr4g$1@dont-email.me> <39e9elp8cqum5iatg21ltbf06hc4p4dgec@4ax.com> <eig9ellto4nl35n0cd8elct4boi2018mcp@4ax.com> <11ck9s9$2dmvp$1@dont-email.me> <fe8selhl8um5p168shk979cms2elurlhh1@4ax.com> <11cma06$34o3u$2@dont-email.me> <4rbtelp38pp2qnaqha6cq7csbfafpgk9i9@4ax.com> <11cmffm$36ee0$1@dont-email.me> <11cqieb$3h7vq$2@paganini.bofh.team> <11cqnt0$mtaq$1@dont-email.me> <11ctd4b$3rem1$1@paganini.bofh.team> <_QCIS.2$ev2.0@fx08.ams4> <11d3fn7$3ks1o$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!peer02.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!fx15.ams4.POSTED!not-for-mail MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Arms race Newsgroups: sci.electronics.design References: <11bp6d1$16i93$1@dont-email.me> <a8n6elh26hc5cg98pn84idqp7rrel2l47o@4ax.com> <11bvnp8$3ehgg$1@dont-email.me> <11c0065$3hr4g$1@dont-email.me> <39e9elp8cqum5iatg21ltbf06hc4p4dgec@4ax.com> <eig9ellto4nl35n0cd8elct4boi2018mcp@4ax.com> <11ck9s9$2dmvp$1@dont-email.me> <fe8selhl8um5p168shk979cms2elurlhh1@4ax.com> <11cma06$34o3u$2@dont-email.me> <4rbtelp38pp2qnaqha6cq7csbfafpgk9i9@4ax.com> <11cmffm$36ee0$1@dont-email.me> <11cqieb$3h7vq$2@paganini.bofh.team> <11cqnt0$mtaq$1@dont-email.me> <11ctd4b$3rem1$1@paganini.bofh.team> <_QCIS.2$ev2.0@fx08.ams4> <11d3fn7$3ks1o$1@dont-email.me> Content-Language: en-US From: Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> Organization: Watcom Pro Ltd. In-Reply-To: <11d3fn7$3ks1o$1@dont-email.me> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Lines: 47 Message-ID: <gRpJS.420$0op4.49@fx15.ams4> X-Complaints-To: abuse@easynews.com X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. Date: Fri, 13 Nov 2026 05:04:10 +0800 X-Received-Bytes: 3718