Bug 455090 - incorrect output for printf("%lld")
Summary: incorrect output for printf("%lld")
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 9
Hardware: i386
OS: Linux
low
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-07-11 21:29 UTC by Gene Czarcinski
Modified: 2008-07-11 21:55 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2008-07-11 21:55:19 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
error demo c program (610 bytes, text/x-csrc)
2008-07-11 21:29 UTC, Gene Czarcinski
no flags Details

Description Gene Czarcinski 2008-07-11 21:29:22 UTC
Description of problem:
Attached is an extremely simple program which prints some numbers with
formatting of "%d", "%ld", and "%lld"

On x86_64, I am getting the expected results but on i386 I am getting garbage
when I run it on i386 Fedora 9.

see below

Version-Release number of selected component (if applicable):
Fedora 9 plus (more or less) recent updates

How reproducible:
yes
-------------------------------------------
x86_64:

short   = 2 bytes
int     = 4 bytes
long    = 8 bytes
long long 8 bytes
pointer = 8 bytes

 testing   d: 12345, 5890123, 6901234, 448989898
 testing  ld: 12345, 5890123, 6901234, 448989898
 testing lld: 12345, 5890123, 6901234, 448989898
----------------------------------------------------------
On i386:
short   = 2 bytes
int     = 4 bytes
long    = 4 bytes
long long 8 bytes
pointer = 4 bytes

 testing   d: 12345, 5890123, 6901234, 448989898
 testing  ld: 12345, 5890123, 6901234, 448989898
 testing lld: 25297885654429753, 1928396928151277042, 0, 134514269

Comment 1 Gene Czarcinski 2008-07-11 21:29:22 UTC
Created attachment 311622 [details]
error demo c program

Comment 2 Jakub Jelinek 2008-07-11 21:55:19 UTC
And what do you expect?  The program is clearly invalid.  You are passing vars
to ... which don't match the expected types from the format string.
POSIX says:
"If any argument is not the correct type for the corresponding conversion
specification, the behavior is undefined." and that's exactly what happened.


Note You need to log in before you can comment on or make changes to this bug.