On 11/18/16 23:15, Bernd Edlinger wrote: >>> - TREE_NOTHROW (olddecl) = 0; >>> + TREE_NOTHROW (olddecl) = TREE_NOTHROW (newdecl); >> >> I still think a better fix would be to add a copy of TREE_NOTHROW to the >> else block of the if (types_match), to go with the existing copies of >> TREE_READONLY and TREE_THIS_VOLATILE. >>
Hmm, looking at it again, I start to think you are right. It looks like it is *not* possible that something other than a builtin function can reach the bottom of that function with !types_match. The upper half of duplicate_decls is structured like this: /* Check for redeclaration and other discrepancies. */ if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_ARTIFICIAL (olddecl)) { if (TREE_CODE (newdecl) != FUNCTION_DECL) { .... return NULL_TREE; } .... TREE_NOTHROW (olddecl) = 0; .... } else if (TREE_CODE (olddecl) != TREE_CODE (newdecl)) { .... return error_mark_node; } else if (!types_match) { ... if (TREE_CODE (newdecl) == TEMPLATE_DECL) { .... return NULL_TREE; } if (TREE_CODE (newdecl) == FUNCTION_DECL) { if (DECL_EXTERN_C_P (newdecl) && DECL_EXTERN_C_P (olddecl)) { ... return NULL_TREE; } else if (...) { .... return error_mark_node; } else return NULL_TREE; } else { ... return error_mark_node; } } else if (....) .... So in the case types_match=true, it can neither be that olddecl is something other than a builtin function decl, nor can newdecl be something other than a function decl. Everything else makes the function return already here. Bernd.