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]

Error at division by constant zero


Hello,

When dividing an integer by constant zero, the GCC does emit a library call to
the corresponding routine. On Sparc this is .rem or .div, on Linux this might be
__modsi3 or __divsi3.

I think this is an error in expand_divmod. EXACT_POWER_OF_2_OR_ZERO_P gives
true. So we think we could use a shift optab. optab2 is a shift optab.

In case of zero we bypass the special code for dividing by a constant. We then
call sign_expand_binop.

But the decision whether to use OPTAB_DIRECT or OPTAB_WIDEN is based on the
existence of a shift insn, which is a mistake.

        Erwin

Erwin Unruh, Fujitsu Siemens Computers, C/C++ compiler group


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