Tom Tromey <[EMAIL PROTECTED]> writes: | >>>>> "Gabriel" == Gabriel Dos Reis <[EMAIL PROTECTED]> writes: | | Gabriel> I just hit this one from tree-ssa-into.c:rewrite_into_ssa() | Gabriel> /* Initialize dominance frontier. */ | Gabriel> dfs = (bitmap *) xmalloc (last_basic_block * sizeof (bitmap *)); | Gabriel> ^^^^^^^^ | | Maybe we should be using the XNEWVEC macro (libiberty.h) everywhere. | That would avoid this problem.
Absolutely. | | How did you catch this btw? (If gcc or g++ warns about this, it is | cool news... and if it doesn't, wouldn't that be nice?) The way I got it was simple: I just grepped for xmalloc/xcalloc in tree-* (most of them rely on implicit void * -> T* which C++ does not like) and was going to replace them with XNEWVEC/XCNEWVEC and my eyes could not parse that line :-) No, gcc/g++ -- unfortunately -- cannot catch such things. Yes, it would be nice (e.g. useful), if it could warn about them. I think it is a common mistake. Of source if works only for syntactic construct like (T) allocate (sizeof (U)) or (T) allocate (n * sizeof (U)) where T are not equivalent. But, I guess that would already be an improvement. -- Gaby