gc.dg/warn-1.c failure

H. J. Lu hjl@lucon.org
Wed Apr 16 20:58:00 GMT 2003


On Wed, Apr 16, 2003 at 11:47:55AM -0700, Geoff Keating wrote:
> Joern Rennecke <joern.rennecke@superh.com> writes:
> 
> > This test fails because the functions are no longer compiled
> > at -O3.  If you remove the 'static' from the function declaration
> > you get the warning back.
> > Now, should we 'fix' the compiler to always do enough compilation
> > to emit warnings about conversions due to argument passing?
> > Or should we change the testcase so that the compiler has to compile
> > the functions?
> 
> I think the testcase should be changed.  IMO, there's no point making
> a special effort to warn about conversions that don't actually ever
> happen.
> 

Since it is mentioned, I got

# cat f.c
extern int foo_short (short);
extern int foo_long (long);
int
foo (long *i)
{
  if (0)
    return foo_short ((short) i);
  else
    return foo_long ((long) i);
}
# gcc -c f.c
f.c: In function `foo':
f.c:7: warning: cast from pointer to integer of different size

I find it is quite annoying.

H.J.



More information about the Gcc mailing list