Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!emory!mephisto!mcnc!rti!dg-rtp!gen-rtx!wood From: wood@gen-rtx.rtp.dg.com (Tom Wood) Newsgroups: comp.sys.m88k Subject: Re: Grabbing arithmetic overflow traps ? Message-ID: <1990Jun27.173213.8250@dg-rtp.dg.com> Date: 27 Jun 90 17:32:13 GMT References: <9724@discus.technion.ac.il> <3418@oakhill.UUCP> Sender: usenet@dg-rtp.dg.com (Usenet Administration) Reply-To: wood@gen-rtx.dg.com () Organization: Data General Corporation, Research Triangle Park, NC Lines: 20 In article <3418@oakhill.UUCP> shebanow@oakhill.UUCP (Mike Shebanow) writes: > The 88k "add" and "sub" instructions do check for arithmetic overflow > automatically. I also have an Aviion; I replaced an "addu" instruction > with an "add" in a piece of test code and purposely generated an > overflow with the add. The result was a floating point exception. > You can catch this with your own handler w/o modifying the kernel. > Unfortunately, looking at the gcc man page (online), I saw no way to > get the compiler to generate "add" instead of "addu" when performing ops > on signed integers (unless I overlooked something in the man page). > Does anyone at DG know how to do this? It wouldn't be too hard to change the `key' uses of addu/subu in the GCC compiler to add/sub, but unfortunately, you would no longer have a C compiler. Perhaps that's too strong a statement, but in C, you typically don't get integer overflow checks, and most often you don't want them. --- Tom Wood (919) 248-6067 Data General, Research Triangle Park, NC {the known world}!rti!xyzzy!wood, wood@dg-rtp.dg.com