------- Comment #9 from rguenth at gcc dot gnu dot org 2008-03-01 14:29 -------
If you remove libcall notes around all binops then the following testcase
passes in dg-torture:
/* { dg-do run { target hppa*-*-hpux* *-*-linux* powerpc*-*-darwin*
*-*-darwin[912]* } } */
/* { dg-options "-ftrapv" } */
#include <stdlib.h>
#include <limits.h>
#include <signal.h>
int ok;
void handle_abort (int sig)
{
if (sig == SIGABRT)
{
ok = 1;
exit (0);
}
}
int __attribute__((noinline))
iaddv (int a, int b)
{
return a + b;
}
volatile int x;
int main(void)
{
struct sigaction sa;
sigemptyset (&sa.sa_mask);
sa.sa_handler = handle_abort;
sa.sa_flags = SA_RESETHAND;
if (sigaction (SIGABRT, &sa, NULL) == -1)
return 0;
/* ??? iaddv is analyzed to be pure, so use the result. */
x = iaddv (INT_MAX, 1);
sa.sa_handler = SIG_DFL;
if (sigaction (SIGABRT, &sa, NULL) == -1)
return 0;
if (!ok)
abort ();
return 0;
}
but I get a build failure of libjava then:
gnu/java/nio/natVMSelector.cc: In static member function 'static jint
gnu::java::nio::VMSelector::select(JArray<__java_int>*, JArray<__java_int>*,
JArray<__java_int>*, jlong)':
gnu/java/nio/natVMSelector.cc:127: error: unable to find a register to spill in
class 'AD_REGS'
gnu/java/nio/natVMSelector.cc:127: error: this is the insn:
(insn 58 57 59 6 gnu/java/nio/natVMSelector.cc:82 (parallel [
(set (reg:DI 4 si [165])
(mult:DI (zero_extend:DI (reg:SI 0 ax))
(zero_extend:DI (reg:SI 2 cx [166]))))
(clobber (reg:CC 17 flags))
]) 304 {*umulsidi3_insn} (expr_list:REG_DEAD (reg:SI 2 cx [166])
(expr_list:REG_DEAD (reg:SI 0 ax)
(expr_list:REG_UNUSED (reg:CC 17 flags)
(expr_list:REG_EQUAL (mult:DI (zero_extend:DI (reg:SI 0 ax))
(const_int 1000 [0x3e8]))
(nil))))))
gnu/java/nio/natVMSelector.cc:127: internal compiler error: in spill_failure,
at reload1.c:2000
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
with the following patch
Index: optabs.c
===================================================================
--- optabs.c (revision 132790)
+++ optabs.c (working copy)
@@ -2148,12 +2148,9 @@ expand_binop (enum machine_mode mode, op
insns = get_insns ();
end_sequence ();
+ emit_insn (insns);
- target = gen_reg_rtx (mode);
- emit_libcall_block (insns, target, value,
- gen_rtx_fmt_ee (binoptab->code, mode, op0, op1));
-
- return target;
+ return value;
}
delete_insns_since (last);
I'll test forcing value to a register.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020