This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Stan Shebs wrote:Mark Mitchell wrote:
[...] I have long argued that only front ends should be permitted to issue warnings, and that all attempts to use back-end data flow analysis to issue warnings are mistaken, no matter how clever they seem.
inline bool f() { return true; }
void g() { int i; bool b = f();
if (b) i = 3;
h(i);
}
Here, GCC with -O2 will probably not warn about the use of "i", since the assignment always takes place. (The compiler will do inlining, constant propagation, remove the branch, etc.)
Arguably, GCC's behavior is not what people want anyhow; a change to the implementation of "f" will cause the code above to become unsafe.
Lint was a difficult program to write...partially because users usually don’t notice bugs which cause lint to miss errors which it should have caught. (By contrast, if lint incorrectly complains about something that is correct, the programmer reports that immediately!)
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |