gcc issues warning when using the tolower function along with an optimization flag. This warning also happens in other versions of gcc apart from 4.4.2 gcc -std=c99 -pedantic -O2 -Wall -Wunreachable-code a.c a.c:13: warning: will never be executed #include <stdio.h> #include <string.h> #include <ctype.h> int main(void) { char A[50] = ""; strcat(A, "Hello World!"); int COUNT = 0; while(A[COUNT]) { A[COUNT] = (char)(tolower(A[COUNT])); // this line issues warning COUNT++; } puts(A); // output: hello world! return 0; }
-Wunreachable-code is broken and has been removed in 4.5.