This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/1789] New: assert() corrupts the stack?


Here is the sample program:
--------------------------------
#include <assert.h>
int main(void){
   int i = 1;
   assert(i == 0);
   return 0;
}
--------------------------------

It compiles OK (gcc -g t.c); it runs OK, stopping at the assertion like it 
should. But here's the output from running the program under gdb:

--------------------------------
(gdb) run
a.out: t.c:5: main: Assertion `i == 0' failed.

Program received signal SIGABRT, Aborted.
0xffffe410 in __kernel_vsyscall ()
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0xb7ed6175 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb7ed77d8 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xbffff4f0 in ?? ()
#4  0x00000000 in ?? ()
#5  0x00000020 in ?? ()
#6  0x00000000 in ?? ()
[... many null pointers...]
#36 0x00000000 in ?? ()
#37 0xb7f19307 in _IO_file_write () from /lib/tls/i686/cmov/libc.so.6
Previous frame inner to this frame (corrupt stack?)
--------------------------------

I don't know if gdb's "corrupt stack?" claim is true, but assert() pretty 
consistently gives me this less-than-useless backtrace. Call me a crappy 
programmer, but without a backtrace I have a lot of trouble fixing my code.

-- 
           Summary: assert() corrupts the stack?
           Product: glibc
           Version: 2.3.2
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: fluffmail at f-m dot fm
                CC: glibc-bugs at sources dot redhat dot com
  GCC host triplet: Ubuntu Linux 2.6.10-5-686


http://sourceware.org/bugzilla/show_bug.cgi?id=1789

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]