Bug 15488

Summary: Incorrect FPE_*_TRAP macros in machine/trap.h
Product: Base System Reporter: housel <housel>
Component: i386Assignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-CURRENT   
Hardware: Any   
OS: Any   

Description housel 1999-12-14 23:00:00 UTC
The following sets of trap codes do not appear to be consistent.
Using the FPE_*_TRAP constants in a trap handler gives incorrect
results.

#define FPE_INTDIV	1	/* integer divide by zero */
#define FPE_INTOVF	2	/* integer overflow */
#define FPE_FLTDIV	3	/* floating point divide by zero */
#define FPE_FLTOVF	4	/* floating point overflow */
#define FPE_FLTUND	5	/* floating point underflow */
#define FPE_FLTRES	6	/* floating point inexact result */
#define FPE_FLTINV	7	/* invalid floating point operation */
#define FPE_FLTSUB	8	/* subscript out of range */

#define	FPE_INTOVF_TRAP	0x1	/* integer overflow */
#define	FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
#define	FPE_FLTDIV_TRAP	0x3	/* floating/decimal divide by zero */
#define	FPE_FLTOVF_TRAP	0x4	/* floating overflow */
#define	FPE_FLTUND_TRAP	0x5	/* floating underflow */
#define	FPE_FPU_NP_TRAP	0x6	/* floating point unit not present  */
#define	FPE_SUBRNG_TRAP	0x7	/* subrange out of bounds */

Fix: 

Base "depreciated" macros on the updated ones?
How-To-Repeat: 
Write a trap handler for integer overflow or integer divide by zero.
Comment 1 Martin Cracauer freebsd_committer freebsd_triage 2000-03-20 12:24:46 UTC
State Changed
From-To: open->closed

Fixed in RELENG_4 and -current. 
It is unclear whether this fix will make it into 4.0 release CDs.