Warning is an indication of a potential weakness in the code. The strength of the chain is normally determined by its weakest point right? Also, we normally need to strengthen the fortress at those segments where the foe has more abilities to conquer. Here the foe is the vulnerability or a bug.
Hence normally it is recommended to 'Treat warning as errors'.