gcc: printf stack/register(?) bug should emit error not warning

Carsten Aulbert carsten at welcomes-you.com
Fri Dec 8 10:56:02 UTC 2006


Package: gcc
Version: 4:4.1.1-6ubuntu3
Severity: normal

Trying this tiny program with said GCC gives ... interesting results:

#include <stdlib.h>
#include <stdio.h>

int
main (void)
{

  long long unsigned int l = 4000;
  int i = 555;
  printf ( "Wrong: %d %d\n", l, i );
  printf ( "Right: %lld %d\n", l, i );
  return EXIT_SUCCESS;
}

The output:
./test
Wrong: 4000 0
Right: 4000 555

(note the zero in the wrong line!)

Of course, gcc emits a warning with -Wall, however I think an error would be more appropriate here, dont'y you think?

Cheers

Carsten

PS: In case anyone wonders where I stumbled across this: libhdf5 defines some data types to be long long unsigned int and this can break your neck at some 
point :(

-- System Information:
Debian Release: testing/unstable
  APT prefers edgy-updates
  APT policy: (500, 'edgy-updates'), (500, 'edgy-security'), (500, 'edgy-backports'), (500, 'edgy')
Architecture: i386 (i686)
Kernel: Linux 2.6.17-10-generic
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages gcc depends on:
ii  cpp                     4:4.1.1-6ubuntu3 The GNU C preprocessor (cpp)
ii  gcc-4.1                 4.1.1-13ubuntu5  The GNU C compiler

Versions of packages gcc recommends:
ii  libc6-dev [libc-dev]       2.4-1ubuntu12 GNU C Library: Development Librari

-- no debconf information




More information about the ubuntu-users mailing list