------- Additional Comments From jakub at gcc dot gnu dot org 2004-09-28 10:31 ------- There seems to be multiple bugs here.
The first one I see is in cp/decl.c (duplicate_decls). extern "C" { extern int strcmp (const char *s, const char *t) throw () __attribute__ ((pure)); } duplicate_decls is called here on the new strcmp decl and olddecl being the builtin strcmp decl. /* Whether or not the builtin can throw exceptions has no bearing on this declarator. */ TREE_NOTHROW (olddecl) = 0; clears NOTHROW flag on olddecl (although it has TYPE_NOTHROW_P (TREE_TYPE (olddecl))), supposedly so that newdecl's TREE_NOTHROW flag is not influenced by that. Later on in that routine, the non-tree_common bits of newdecl are copied over the olddecl bits, but TREE_NOTHROW flag is not copied from newdecl (where it is set to 1) to olddecl. But the function returns olddecl and that's the decl that is being used. So we have a TYPE_NOTHROW_P (TREE_TYPE (fn)) function with !TREE_NOTHROW (fn). Second bug is that execute_fold_all_builtins doesn't call maybe_clean_eh_stmt and tree_purge_dead_eh_edges. Will attach the patch for that. Unfortunately, with that I get pr17697-2.C: In function `int foo(char*)': pr17697-2.C:23: error: dominator of 2 status unknown pr17697-2.C:23: internal compiler error: in verify_dominators, at dominance.c:857 -- What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at redhat dot com, | |mark at codesourcery dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17697