I am trying to clearly understand the behaviour of the shift operators (especially for the boundary cases), so I devised a little test written in C++.
    int a = odd_value; //321 in my case but it should not matter (the last bit to be 1)
    print(0, a);
    a = a << 31; // (this gives a segmentation fault, as normal because it tries the sign bit becomes 1 but all the other bits are 0).
    print(0, a); //the segmentation fault happens here - it prints the minimum integer value and then gives the fault
    a = (a << 1) + 1; // but if then I do this, shouldn't it set a to -1 ??
    print(a); //gives 0
   void print(int stackCallIndex, int nb)
   {
     if(nb)
     {
        print(++stackCallIndex, nb >> 1);
        if(nb & 1) printf("%d", 1);
        else       printf("%d", 0);
        if(stackCallIndex % 8 == 0) printf(" ");
     }
   }
 
     
     
    