printf or stdargs bug (one-liner).

Yuri Dotsenko dotsenko@rice.edu
Wed Jun 4 23:49:00 GMT 2003


Hi,

It was discovered that gcc (3.2.2 or 3.3) both miscompile the following 
code:


#include "stdio.h"

int main() {
  unsigned long long lu;
  int d;
 
  lu = 8;
  d = 4;

  printf("test1:  %lu %d\n", lu, d);  // prints: 8 0, instead of 8 4
  printf("test1:  %d %lu\n", d, lu);  // prints: 4 8 - Ok

  return 0;
}


Thanks,
Yuri




More information about the Gcc-bugs mailing list