Hi - > What I'm wondering is whether or not mudflap should instrument accesses > to globals that it doesn't know the size of. In the following code: > [...] > printf("%d\n", global[3]); > [...] Mudflap does not emit any __mf_check calls.
It is probably kicking in an optimization that says that if the indexes are literals and thus statically checkable against array bounds, then there is no need for a runtime check. The problem here is of course that we can't do the static check after all because of the extern[]. There is also another complication (unhelpful TREE_ADDRESSABLE flag setting for this and a few other cases). > [...] I'd much prefer if it did go on and check all accesses to the > array because in my case, global[] will always be registered by the > compilation unit in which it is defined. [...] On the other hand, mudflap can't know that this extern[] will be registered by that other compilation unit, since that might be compiled without -fmudflap. An mf_check against it would then fail. - FChE