IPW example

#include <iostream.h>

#include <windows.h>

 

int

main(int, char **)

{

    int *ptr = (int *) 0x80000000; //Bug: pointer to reserved portion of address space

    for (int i=0; i < 2; i++) {

        //IPW + IPR: attempting to access invalid pointer

        ptr[i] = i;

        cerr << "ptr[" << i << "] == " << ptr[i] << '\n';

    }

    return(0);

}

(C) Copyright IBM Corporation 1992, 2010.