Description of problem: Standard C requires that all declarations must preceed executable statements (while in C++ this requirement is relaxed). gcc-3.2-1 accepts code that does not fulfill that condition, even with -std=c89. This may make developers believe that they write standard-conforming code while they not. Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. compile following program: #include <stdio.h> int main(void) { printf("Executable statement.\n"); int n = 1; return n; } Actual Results: Program compiles. Expected Results: Compiler should abort compilation. Additional info: a). Compiling with --pedantic produces a warning: gcc -std=c89 --pedantic order.c order.c: In function `main': order.c:5: warning: ISO C89 forbids mixed declarations and code An error should be produced even without --pedantic flag. b). FWIW, older compilers did not have problem with recognizing this issue as an error.
The gcc.info says that: "to obtain all the diagnostics required by the standard, you should also specify `-pedantic' (or `-pedantic-errors' if you want them to be errors rather than warnings). *Note Options Controlling C Dialect: C Dialect Options." I think it is too liberal interpretation of standard and I cannot think of a situation when one would use -std=xxx option without requesting all the diagnostics.
This change was rejected upstream in http://gcc.gnu.org/PR5957