Dueway Qi wrote:
I have found another similar case. lang_hooks.callgraph.analyze_expr in gcc/gcc/cgraphunit.c 490 if (lang_hooks.callgraph.analyze_expr) 491 return lang_hooks.callgraph.analyze_expr (tp, walk_subtrees, 492 data); but in another part of this file 517 if ((unsigned int) TREE_CODE (t) >= LAST_AND_UNUSED_TREE_CODE) 518 return lang_hooks.callgraph.analyze_expr (tp, walk_subtrees, data);
The docs say that analyze_expr is used for unrecognized tree codes. So if a front end will generate unrecognized tree codes, then it must define the analyze_expr hook. This explains the second part of this. If we see an unrecognized tree code, then there is no real need to check if analyze_expr is defined, because it must be defined. This means someone writing a language front end would get an ICE here, but an end user would not. This could be a bit nicer for a language front end writer, but this doesn't look like a serious problem.
For the first part of this, we don't know for sure if we have any unrecognized tree codes, so we can't assume that the analyze_expr hook is defined. We must check first.
This is an analysis from just looking at the code. I haven't tried to debug it and see what is really going on.
-- Jim Wilson, GNU Tools Support, http://www.specifix.com