Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Strange (or at least interesting) printf() behavior!



On Mon, Jan 03, 2011 at 08:01:36AM -0800, Paul Goyette wrote:
> While researching another problem, I created the following test program:
[...]
> As listed, the program runs find and produces the expected results.
> 
> However, if I remove the printf() pointed to by the >>>> the program 
> actually hangs!  Running it under gdb and interrupting with Control/C 
> shows the following traceback:

Well, does not hang for me ... but loops on my amd64 machine (but the
32bit version, compiled with -m32 option, works fine).

  PID USERNAME PRI NICE   SIZE   RES STATE      TIME   WCPU    CPU COMMAND
 8435 njoly     27    0  5396K  884K CPU/0      0:09 93.36% 36.77% xx

Adding an alarm after 10 seconds show the following trace :

Program terminated with signal 6, Aborted.
#0  0x00007f7ffd8e7dea in _lwp_kill () from /usr/lib/libc.so.12
(gdb) bt
#0  0x00007f7ffd8e7dea in _lwp_kill () from /usr/lib/libc.so.12
#1  0x00007f7ffd8e775e in abort () at 
/local/src/NetBSD/src/lib/libc/stdlib/abort.c:74
#2  0x0000000000400b58 in sigalrm_action (signo=14, info=0x7f7fffffc640, 
ptr=0x7f7fffffc6c0) at xx.c:23
#3  <signal handler called>
#4  0x00007f7ffd898f6e in arena_bin_run_size_calc (bin=0x7f7ffdff7110, 
min_run_size=<value optimized out>)
    at /local/src/NetBSD/src/lib/libc/stdlib/jemalloc.c:2200
#5  0x00007f7ffd89a4d1 in arenas_extend (ind=0) at 
/local/src/NetBSD/src/lib/libc/stdlib/jemalloc.c:2631
#6  0x00007f7ffd89a9b4 in malloc_init_hard () at 
/local/src/NetBSD/src/lib/libc/stdlib/jemalloc.c:3655
#7  0x00007f7ffd89bd35 in malloc (size=4096) at 
/local/src/NetBSD/src/lib/libc/stdlib/jemalloc.c:3313
#8  0x00007f7ffd8e80af in __smakebuf (fp=0x7f7ffdb14d38) at 
/local/src/NetBSD/src/lib/libc/stdio/makebuf.c:79
#9  0x00007f7ffd8e7f4d in __swsetup (fp=0x7f7ffdb14d38) at 
/local/src/NetBSD/src/lib/libc/stdio/wsetup.c:88
#10 0x00007f7ffd8c9f20 in __vfprintf_unlocked (fp=0x7f7ffdb14d38, 
    fmt0=0x400c88 "FPE signal handler invoked %d times.\n", ap=<value optimized 
out>)
    at /local/src/NetBSD/src/lib/libc/stdio/vfwprintf.c:811
#11 0x00007f7ffd8ccad5 in vfprintf (fp=0x7f7ffdb14d38, fmt0=0x400c88 "FPE 
signal handler invoked %d times.\n", 
    ap=0x7f7fffffda80) at /local/src/NetBSD/src/lib/libc/stdio/vfwprintf.c:546
#12 0x00007f7ffd8c7b6a in printf (fmt=0x18 <Address 0x18 out of bounds>)
    at /local/src/NetBSD/src/lib/libc/stdio/printf.c:56
#13 0x0000000000400c0e in main () at xx.c:46

-- 
Nicolas Joly

Biological Software and Databanks.
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index