This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37156] New: Hangwith -g -O2 (or higher) (discovered with malloc.c in sqlite3)
- From: "cw at f00f dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 Aug 2008 22:20:37 -0000
- Subject: [Bug c/37156] New: Hangwith -g -O2 (or higher) (discovered with malloc.c in sqlite3)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
cw@lysdexia:~/wk/sqlite-cvs-git/build$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-2)
I get a hang:
cw@lysdexia:~/wk/sqlite-cvs-git/build$ gcc -Wall -c -O2 -g malloc.i
malloc.i: In function ?sqlite3_memory_used?:
malloc.i:10: warning: call to ?sqlite3_status? declared with attribute warning:
is experimental
<...hang...>
malloc.i (below, and which i will also attach if i can) is derived from
malloc.c from sqlite (CVS as of this morning), i butchered it as much a i could
to make it as small as possible but still show the problem.
-O1 -g hangs
-O2 is ok
-O2 -g hangs
if you take out either function or any calls the hang seems to go away
cw@lysdexia:~/wk/sqlite-cvs-git/build$ cat malloc.i
typedef long long int sqlite_int64;
typedef sqlite_int64 sqlite3_int64;
__attribute__ ((warning ("is experimental"))) int sqlite3_status(int op, int
*pCurrent, int *pHighwater, int resetFlag);
sqlite3_int64 sqlite3_memory_used(void){
int n, mx;
sqlite3_int64 res;
sqlite3_status(0, &n, &mx, 0);
res = (sqlite3_int64)n;
return res;
}
void sqlite3_soft_heap_limit(int n){
int overage;
overage = sqlite3_memory_used() - n;
}
--
Summary: Hangwith -g -O2 (or higher) (discovered with malloc.c
in sqlite3)
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cw at f00f dot org
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37156