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/32044] udivdi3 counterproductive, unwarranted use



------- 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


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