[gnu.gcc.bug] -Wcast-qual bug?

edler@JAN.ULTRA.NYU.EDU (Jan Edler) (01/05/90)

Consider the following example, compiled with -Wcast-qual:

int
g(int *x, int *y)
{
	return *x + *y;
}

int
f()
{
	static int foo;
	const int bar;
	return g(&foo, &bar);
}

The compiler says
x.c: In function f:
x.c:12: warning: pointer to const given for argument 1 of `g'

I claim the argument number given in the warning is off by one.
I suppose you might feel that arguments are "naturally" zero-origin,
but I wasted 10 minutes on a real case because I assumed argument 3
was the third argument to a function.

Jan Edler