I have a very simple program here, namely: ---------- #include <malloc.h>
void __attribute__((malloc)) intersect(int list) { int* shite = (int *)malloc(sizeof(int)); } int main() { intersect(5); } ---------- Attempting to compile this using GCC 3.4 with `gcc bug.c` causes a segmentation fault. Output of `gcc -v --save-temps bug.c`: ---------- Reading specs from /usr/lib/gcc/i486-linux/3.4.4/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-libstdcxx-allocator=mt --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk --disable-werror i486-linux Thread model: posix gcc version 3.4.4 20050209 (prerelease) (Debian 3.4.3-9ubuntu3) /usr/lib/gcc/i486-linux/3.4.4/cc1 -E -quiet -v bug.c -mtune=i486 -o bug.i ignoring nonexistent directory "/usr/lib/gcc/i486-linux/3.4.4/../../../../i486-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/i486-linux/3.4.4/include /usr/include End of search list. /usr/lib/gcc/i486-linux/3.4.4/cc1 -fpreprocessed bug.i -quiet -dumpbase bug.c -mtune=i486 -auxbase bug -version -o bug.s GNU C version 3.4.4 20050209 (prerelease) (Debian 3.4.3-9ubuntu3) (i486-linux) compiled by GNU C version 3.4.4 20050209 (prerelease) (Debian 3.4.3-9ubuntu3). GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64543 bug.c: In function `main': bug.c:10: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-3.4/README.Bugs>. ---------- This interface for bug submissions is horrible (no offense). If I can figure out how to attach files to this bug, I will attach the .i file. -- Summary: __attribute__((malloc)) causes segfault in GCC 3.4 Product: gcc Version: 3.4.4 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: lkosewsk at uwaterloo dot ca CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20613