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]

peculiar bitfield bug warning egcs-2.91.57 19980901


The third argument to sprintf in my test case below should be of type
"unsigned long" (with or without the cast), but egcs-2.91.57 gives me a
warning.

uni.ardi.com 2.17 i486-pc-cygwin32-gcc -v -O2 -Wall -c test.i
Reading specs from /usr/local/lib/gcc-lib/i486-pc-cygwin32/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
 /usr/local/lib/gcc-lib/i486-pc-cygwin32/egcs-2.91.57/cc1 test.i -quiet -O2 -Wa\
ll -version -o /tmp/ccgdn8yL.s
GNU C version egcs-2.91.57 19980901 (egcs-1.1 release) (i486-pc-cygwin32) compi\
led by GNU C version 2.7.2.3.
test.i: In function `test_func':
test.i:13: warning: long int format, int arg (arg 3)
 /usr/local/lib/gcc-lib/i486-pc-cygwin32/egcs-2.91.57/../../../../i486-pc-cygwi\
n32/bin/as -o test.o /tmp/ccgdn8yL.s

I'm running gcc as a cross-compiler.  It was configured with:

# This directory was configured as follows,
# on host uni.ardi.com:
#
# ./configure  --host=i686-pc-linux-gnu --target=i486-pc-cygwin32 --with-gnu-as --with-gnu-ld --with-stabs --with-gnu-as --with-gnu-ld --with-newlib --cache-file=../config.cache

--Cliff
ctm@ardi.com

2.18 cat /tmp/test.i
int     sprintf (char* caBuffer, const char* szFormat, ...);

struct
{
  unsigned long test:16;
}
foo;

void test_func (void)
{
  char buf[1024];

  sprintf (buf, "%ld", (unsigned long) foo.test);
}


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