This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/32044] udivdi3 counterproductive, unwarranted use
- From: "ian at airs dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 May 2007 22:18:12 -0000
- Subject: [Bug middle-end/32044] udivdi3 counterproductive, unwarranted use
- References: <bug-32044-11706@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from ian at airs dot com 2007-05-22 23:18 -------
The bug report as stated is clearly incorrect. gcc is perfectly free to insert
calls to __udivdi3. This is not forbidden by any part of the C language
standards.
To clarify for future readers, I gather that the actual problem here is that
the code is written to assume that the quotient is small, and that it will be
more efficient to use a loop than to actually divide. So this is an
optimization issue. Normally eliminating loops is a good idea. In this case
it may not be.
It would of course be easy to prevent the optimization by declaring nsec to be
volatile. The question is whether the compiler can reasonably determine that
the optimization is inappropriate in this particular case.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32044