This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g++ 2.95.3: throw does zero byte malloc?
- To: gcc-bugs at gcc dot gnu dot org
- Subject: g++ 2.95.3: throw does zero byte malloc?
- From: Sebastian Rittau <srittau at jroger dot in-berlin dot de>
- Date: Sat, 17 Feb 2001 13:43:35 +0100
Consider the following program:
| int main(int argc, char **argv)
| {
| throw 5;
| }
If I compile and link this with libefence (electric-fence malloc
debugger), efence claims that a zero byte memory allocation is made:
| srittau@jroger:~/Programmierung/Versuche$ g++ -v -save-temps g++-efence.cc -o g++-efence -lefence -Wall
| Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.3/specs
| gcc version 2.95.3 20010125 (prerelease)
| /usr/lib/gcc-lib/i386-linux/2.95.3/cpp0 -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Wall -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ g++-efence.cc g++-efence.ii
| GNU CPP version 2.95.3 20010111 (prerelease) (i386 Linux/ELF)
| #include "..." search starts here:
| #include <...> search starts here:
| /usr/lib/gcc-lib/i386-linux/2.95.3/../../../../include/g++-3
| /usr/local/include
| /usr/lib/gcc-lib/i386-linux/2.95.3/include
| /usr/include
| End of search list.
| The following default directories have been omitted from the search path:
| /usr/lib/gcc-lib/i386-linux/2.95.3/../../../../i386-linux/include
| End of omitted list.
| /usr/lib/gcc-lib/i386-linux/2.95.3/cc1plus g++-efence.ii -quiet -dumpbase g++-efence.cc -Wall -version -o g++-efence.s
| GNU C++ version 2.95.3 20010125 (prerelease) (i386-linux) compiled by GNU C version 2.95.3 20010125 (prerelease).
| as -V -Qy -o g++-efence.o g++-efence.s
| GNU assembler version 2.10.91 (i386-linux) using BFD version 2.10.1.0.2
| /usr/lib/gcc-lib/i386-linux/2.95.3/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o g++-efence /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc-lib/i386-linux/2.95.3/crtbegin.o -L/usr/lib/gcc-lib/i386-linux/2.95.3 g++-efence.o -lefence -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/gcc-lib/i386-linux/2.95.3/crtend.o /usr/lib/crtn.o
| srittau@jroger:~$ ./g++-efence
|
| Electric Fence 2.0.5 Copyright (C) 1987-1998 Bruce Perens.
|
| ElectricFence Aborting: Allocating 0 bytes, probably a bug.
| Ungültiger Maschinenbefehl
(The last line means invalid instruction (SIGILL).)
srittau@jroger:~$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.3/specs
gcc version 2.95.3 20010125 (prerelease)
This is a Debian GNU/Linux machine (Kernel 2.4.1) with version
1:2.95.3-5 of the g++ compiler.
- Sebastian