//------------------------------------------------------------------- // zerodiv.cpp // // This program attempts to execute an integer 'divide-by-zero' // instruction, hence triggering a 'Divide Overflow' exception, // although Linux's exception-handler incorrectly reports it as // a "Floating point exception." // // to compile: $ g++ zerodiv.cpp -o zerodiv // to execute: $ ./zerodiv // // programmer: ALLAN CRUSE // written on: 01 SEP 2009 //------------------------------------------------------------------- int main( int argc, char **argv ) { asm(" mov $-1, %edx \n mov $-1, %eax \n xor %ecx, %ecx \n div %ecx "); }