From mboxrd@z Thu Jan 1 00:00:00 1970 From: ydi@eecs.uic.edu To: gcc-gnats@gcc.gnu.org Cc: zwei@eecs.uic.edu Subject: c/3112: printf error for structs with "long long" members Date: Sun, 10 Jun 2001 17:26:00 -0000 Message-id: <20010611001822.14469.qmail@sourceware.cygnus.com> X-SW-Source: 2001-06/msg00388.html List-Id: >Number: 3112 >Category: c >Synopsis: printf error for structs with "long long" members >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Sun Jun 10 17:26:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Yu Di >Release: gcc version 2.95.2 19991024 (release) >Organization: >Environment: Solaris 2.7, Generic_106541-12 sun4u sparc SUNW,Ultra-60 >Description: If we try to print several member variables in a struct, with one of them being "long long" type, the other member variable displays will be also wrong. If the following program is compiled and executed, it outputs "0,20" instead of "20,10" #include main() { struct aaa { unsigned long long x; unsigned short y; } a; a.x = 20; a.y = 10; printf("%lu, %d\n", a.x, a.y); /*We know that %lu can't work for a.x, but it shouldn't affect a.y. If we change the sentence to printf("%lf, ...), it will work correctly for both values */ } >How-To-Repeat: See our program in the description >Fix: N/A >Release-Note: >Audit-Trail: >Unformatted: