https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63307
Bug ID: 63307 Summary: [4.9/5 Regression] Cilk+ breaks -fcompare-debug bootstrap Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: izamyatin at gmail dot com, kyukhin at gcc dot gnu.org I've just tried a -fcompare-debug bootstrap, and one of the two reasons (other was Ada) that it failed is Cilk+: ../configure --enable-languages=all,ada,obj-c++,lto,go --enable-checking=release; GCC_COMPARE_DEBUG=1 make -j48 bootstrap > LOG 2>&1 && GCC_COMPARE_DEBUG=1 make -j48 -k check > LOGC 2>&1; ../contrib/test_summary > LOGT 2>&1 ... xg++: error: ../../../libcilkrts/runtime/cilk-abi-cilk-for.cpp: -fcompare-debug failure (length) >From what I can see, the bug is (at least) in c-family/cilk.c, where it seems in all 4 traverse handlers on decl_map it creates decls, adds fields etc. That is a big NO NO in GCC, hash table traversal order should never affect code generation. So, seeing changes like: - _cilk_spn_1 (low, grain, mid, body, loop_root_pedigree, data, w); + _cilk_spn_1 (data, body, loop_root_pedigree, w, mid, low, grain); or: -<built-in> (unsigned int D.3190, int D.3189, unsigned int D.3188, void (*<T39b>) (void *, unsigned int, unsigned int) D.3187, struct __cilkrts_pedigree * D.3186, void * D.3185, struct __cilkrts_worker * D.3184) +<built-in> (void * D.3190, void (*<T39b>) (void *, unsigned int, unsigned int) D.3189, struct __cilkrts_pedigree * D.3188, struct __cilkrts_worker * D.3187, unsigned int D.3186, unsigned int D.3185, int D.3184) in *.gimple dump between -g and -g0 is just wrong (and in this case it isn't really debug related, just different order in the hash map). If you don't have the decls (but, apparently you put also BLOCKs in there, what else?) you want to traverse in some other data structure, you can e.g. traverse the hash table but only collect the decls (do you need anything else, e.g. the BLOCKs?, types, etc.) you saw into some vector, then qsort the vector (for decls e.g. by DECL_UID, if you have also other trees, it might be harder) and then traverse the sorted vector insert of traversing random order hash map.