[Top][All Lists]

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

[Tinycc-devel] bounds checking bug?

From: kf
Subject: [Tinycc-devel] bounds checking bug?
Date: Thu, 10 May 2007 14:36:43 +0300


I'm having a strange problem with free() with bounds checking turned
on. Below is a small program that reproduces the problem. The program
runs just fine if I don't use -b flag. My system is FC5. I'm using Rob
Landley's tinycc-rl-1.0.0.tar.bz2 release.

Here is the transcript:

$ cat t.c
#include <stdlib.h>

int     main (int argc, char **argv)
       char    * s;
       size_t  n = 1000000;

       s = malloc (n);
       if (!s) { printf("Failed\n"); exit (1); }
       free (s);

       return 0;
$ tcc -b t.c; a.out
Segmentation fault
$ gdb a.out
GNU gdb Red Hat Linux (
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".

(gdb) r
Starting program: /home/kf/a.out
Reading symbols from shared object read from target memory...done.
Loaded system supplied DSO at 0x9e5000

Program received signal SIGSEGV, Segmentation fault.
0x08048c50 in __bound_delete_region ()
(gdb) bt
#0  0x08048c50 in __bound_delete_region ()
#1  0x08048d66 in __bound_free ()
#2  0x001783d3 in ?? ()
#3  0x00259008 in ?? ()
#4  0x08048429 in main ()

What's going on? Is it me, my system or tcc -b goofing up something?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]