If P is empty then simply deallocate the partition. Then expand G. Then reallocate the free space to a new partition and format it and assign it a drive letter.
If P: is not empty then it's a lot more work, likely want to use a tool like EaseUS Partition Master, and even that recommends you first back up all your data to another drive in case something goes wrong. Depending on the size of the HD this movement can take hours.http://www.partition-tool.com/
The space being given to G: must be contiguous with the current G: drive. The only way to just take some out is with software like I mentioned, and even then it recommends you make a backup first in case it accidentally makes a mistake. Basically it has to shift all your data on P: and after that G: can expand to use the space freed up.