I'm writing a set of tests for functionality of GCC generic vectors. Several very large tests result in internal compiler errors or seg faults because a type node that is reused has been garbage-collected. I'll leave it to someone who understands the garbage collector to figure out how to fix this. The node in question is allocated in build_word_node_vector_type. It's easier to detect the problem with the following patch: --- tree-complex.c.orig 2004-10-12 14:43:10.574920072 -0700 +++ tree-complex.c 2004-10-12 14:43:50.232015984 -0700 @@ -521,7 +521,10 @@ build_word_mode_vector_type (int nunits) if (!innertype) innertype = lang_hooks.types.type_for_mode (word_mode, 1); else if (last_nunits == nunits) - return last; + { + gcc_assert (TREE_CODE (last) == VECTOR_TYPE); + return last; + }
/* We build a new type, but we canonicalize it nevertheless, because it still saves some memory. */ ... and by forcing garbage collection to happen frequently, like so. laptop% /home/janis/tools/gcc-mline-20041012/bin/gcc -c --param ggc-min-expand=0 --param ggc-min-heapsize=0 bug1.c bug1.c: In function 'vsub': bug1.c:17: internal compiler error: in build_word_mode_vector_type, at /tree-complex.c:525 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. This happens for me on powerpc64-unknown-linux-gnu and i686-pc-linux-gnu using today's mainline sources, with the patch above to detect the problem more quickly. -- Summary: vector type node used after garbage-collected Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: janis187 at us dot ibm dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17957