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]

Re: Plugin that parse tree


Do you have any opinion about adding a warning for:

int f(char c)
{
    return 10 * (c == 13) ? 1 : 2;
}

The multiplication has no effect. The function returns either 1 or 2.

It would be interesting to know how a MELT script could look like for
such a case.

As far as I see the multiplication doesn't exist in the gimple format
(looking at a.c.004t.gimple generated by -fdump-tree-all).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]