|
[PATCH] fix integer truncation in hp2ps output: msg#00004lang.haskell.glasgow.bugs
Hi, The following patch fixes a bug in hp2ps that causes silly numbers like 84,762,122,-646 to appear in the heading. The problem was that 'n' is (can be) a 64-bit type, and converting to an int before doing the modulo gives rounding errors. The fix is courtesy of Ralf Wildenhues (Ralf.Wildenhues@xxxxxx). N Index: massif/hp2ps/Utilities.c =================================================================== RCS file: /home/kde/valgrind/massif/hp2ps/Utilities.c,v retrieving revision 1.2 diff -u -r1.2 Utilities.c --- massif/hp2ps/Utilities.c 15 Feb 2004 15:38:08 -0000 1.2 +++ massif/hp2ps/Utilities.c 2 Apr 2004 12:24:45 -0000 @ -77,7 +77,7 @ fprintf(fp, "%d", (int)n); } else { CommaPrint(fp, n / ONETHOUSAND); - fprintf(fp, ",%03d", (int)n % ONETHOUSAND); + fprintf(fp, ",%03d", (int)(n % ONETHOUSAND)); } }
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | RE: ghc-6.2.1 incorrectly reporting duplicate instance declarations, Simon Peyton-Jones |
|---|---|
| Next by Date: | Bug in GHC 6.2.1, Benjamin Franksen |
| Previous by Thread: | ghc-6.2.1 incorrectly reporting duplicate instance declarations, George Russell |
| Next by Thread: | RE: [PATCH] fix integer truncation in hp2ps output, Simon Marlow |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |