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]

Re: dead code elim && div-by-0 warnings


On Mar 27, 2000, Andrew Morton <andrewm@uow.edu.au> wrote:

> int foo(int i) { return i / 0; }

> I'd suggest that a warning be generated for this.  (Bearing in mind that
> '0' could be the result of a complex macro expansion and not obvious).

Actually, if it often the case that, when it is the result of a
complex macro expansion, it is protected by an `if (... != 0)', so the
warning would often be just an annoyance.  But, of course, if it is
not enabled by default, nor with -W -Wall, but only with
-Wdivide-by-zero, for example, it could be useful.  Patches are
welcome :-)

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me


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