//------------------------------------------------------------------- // segfault.cpp // // This example uses 'inline' assembly language to insert into // the instruction-stream a 'privileged' instruction that will // cause a 'Segmentation fault' that aborts program execution. // (No visible clue is provided to help find the bug's cause.) // // to compile: $ g++ segfault.cpp -o segfault // to execute: $ ./segfault // // programmer: ALLAN CRUSE // written on: 18 MAR 2009 //------------------------------------------------------------------- int main( int argc, char **argv ) { asm(" hlt " ); // a privileged CPU instruction }