Hi ruochen, I think this should be handled in application rather than compiler handling it. With regards, Anandkumar.C.B -----Original Message----- From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of Pan ruochen Sent: Tuesday, November 04, 2008 5:07 PM To: gcc-help@xxxxxxxxxxx Subject: How to force gcc warn the conditions which are true of false forever? Hi All, gcc (version 3.4.5) will optimize the following code without any warnings even with -Wall options -------------------------------------- if (id < 0 && id > 3) { printf("Failed.\n"); return ; } -------------------------------------- How should I do if I do want gcc to give warnings about these code, since in most cases such code are really mistakes? Best Regards --------------- PRC Nov 4, 2008 Important notice:This e-mail and any attachment thereto contains corporate proprietary information. If you have received it by mistake, please notify us immediately by reply e-mail and delete this e-mail and its attachments from your system. Thank You.