This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/14030] New: missing parameter count check ?


Given the following broken source code

void f( one, two)
int one;
char two;
{
}

void g(int i)
{
	f( 1);
	f( 1, 'e', i);
}

gcc 332 says

[dcb@localhost src]$ gcc -c bad.c
[dcb@localhost src]$

gcc 332 with lots of warning flags says

[dcb@localhost src]$ gcc -c -g -O2 -Wall -ansi -pedantic bad.c
[dcb@localhost src]$

Surprising.  Here is Intel compiler on the same code. Note the lack
of extra flags.

[dcb@localhost src]$ icc -c bad.c
bad.c(13): warning #165: too few arguments in function call
        f( 1);
            ^

bad.c(14): warning #140: too many arguments in function call
        f( 1, 'e', i);
                   ^

Any chance of getting gcc to find the faults in the code, without
changing the original code from K & R to ISO ?

-- 
           Summary: missing parameter count check ?
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: d dot binderman at virgin dot net
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: redhat linux on i686


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14030


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]