gcc should be in /usr/bin, so you shouldn't need to update you PATH variable. Also, when you add to your path variable, do it in .profile, and not .bashrc.
The updatedb service runs periodically around 3 am, so if you want the locate command to be current just after installing a program, then run "sudo /usr/bin/updatedb" to update the database manually.
I don't know what you are doing with the "update .bashrc" and "update .profile" commands.
I think that you can reinstall gcc version 4.11. If you use the "-V 3.3" option the /usr/bin/i486-linux-gnu-gcc-3.3 compiler will be used instead. I didn't notice any gcc-3.1 however, but maybe after running updatedb your locate results will be changed.
I'm curious why you need to use version 3.1.