This is the mail archive of the gcc-bugs@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]

[Bug middle-end/16631] Problems inlining with enums


------- Additional Comments From roger at eyesopen dot com  2004-07-19 20:09 -------
Indeed.  This warning should only be emitted w.r.t. the original type as written
by the programmer, preferably by the language front-end.  The problem here is
that tree-ssa or some other middle-end optimization is eliminating a NOP_EXPR,
possibly that it shouldn't, but certainly it shouldn't complain that it has.

If the middle-end can prove that the value is a limited subset of the case's
range, that's good and can be used prune the jump table, but it shouldn't
automatically be diagnosed as a warning:

switch (x & 7)
{
case 8: foo();
case 3: bar();
}

Getting rid of case labels because they are unreachable is clever, but not
necessarily an error.  Especially, if this restricted range is purely an
artifact of tree inlining.  If inlining the code above results in "x" always
having the value 2 in the inlined instance, then obviously "case 3" shouldn't
then become a warning.

*IF* we're sure that this isn't an incorrect misuse of "useless type conversion"
(which isn't yet clear), then perhaps this should become a "c" component PR,
requiring the warning to be moved from the middle-end into each of the langauge
front-ends.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16631


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