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]

Builtin argument type conversion and ftrapv-2.c failure





Hello,

we're seeing an ICE in emit_move_insn when building the gcc.dg/ftrapv-2.c
test case on s390x-ibm-linux.  The test case contains this function:

long __attribute__((noinline))
labsv(long a)
{
  return abs(a);
}

Now, this is in inself most likely a test case bug; it was probably
intended to use labs instead of abs.  But even so, the current code
should certainly not lead to an ICE.

What appears to happen is that builtin expansion generates an ABS_EXPR
tree with type 'int' that has as argument a tree with type 'long',
without any explicit type conversion operation.

By my reading of tree.def, this construct is invalid in the first place.
However, when *not* using -ftrapv, the expand_abs routine is able to
cope with such a tree anyway; it will automatically insert an appropriate
mode conversion on RTL level.

When using -ftrapv, however, this conversion is not performed; expand_abs
simply calls emit_move_insn (target, op0) (optabs.c:2613), which will
abort due to the mode mismatch.

Any suggestion who's at fault here and how to fix it?


Mit freundlichen Gruessen / Best Regards

Ulrich Weigand

--
  Dr. Ulrich Weigand
  Linux for S/390 Design & Development
  IBM Deutschland Entwicklung GmbH, Schoenaicher Str. 220, 71032 Boeblingen
  Phone: +49-7031/16-3727   ---   Email: Ulrich.Weigand@de.ibm.com


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