public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
@ 2005-12-14 18:32 ` pinskia at gcc dot gnu dot org
  2006-04-22 15:41 ` pinskia at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-14 18:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-12-14 18:32 -------
*** Bug 25418 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |someone42 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
  2005-12-14 18:32 ` [Bug middle-end/19020] libcalls are removed (-ftrapv does not work) pinskia at gcc dot gnu dot org
@ 2006-04-22 15:41 ` pinskia at gcc dot gnu dot org
  2007-01-17 15:35 ` rguenth at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-22 15:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2006-04-22 15:41 -------
*** Bug 27261 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
  2005-12-14 18:32 ` [Bug middle-end/19020] libcalls are removed (-ftrapv does not work) pinskia at gcc dot gnu dot org
  2006-04-22 15:41 ` pinskia at gcc dot gnu dot org
@ 2007-01-17 15:35 ` rguenth at gcc dot gnu dot org
  2007-05-30 19:59 ` rguenth at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-01-17 15:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2007-01-17 15:35 -------
There are a few issues, first we use emit_libcall_block to emit the trapping
PLUS
which sets a REG_EQUAL note with a non-trapping PLUS.

Second we analyze iaddv as not possibly throwing so we remove the call from
main()
during tree optimization as the result is unused.

Third, we widen the integer addition to DImode and dispatch to libgcc2
__addvdi3
which looks like

Dump of assembler code for function __addvdi3:
0x0000000000400580 <__addvdi3+0>:       sub    $0x8,%rsp
0x0000000000400584 <__addvdi3+4>:       test   %rsi,%rsi
0x0000000000400587 <__addvdi3+7>:       lea    (%rdi,%rsi,1),%rax
0x000000000040058b <__addvdi3+11>:      js     0x4005a0 <__addvdi3+32>
0x000000000040058d <__addvdi3+13>:      cmp    %rax,%rdi

so it tests for 64bit overflow instead of 32bit one.  Obviously allowind
LIBCALL_WIDEN is wrong for the trapping optabs, too.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu dot
                   |                            |org
           Keywords|                            |wrong-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-01-17 15:35 ` rguenth at gcc dot gnu dot org
@ 2007-05-30 19:59 ` rguenth at gcc dot gnu dot org
  2008-03-01 10:54 ` steven at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-05-30 19:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from rguenth at gcc dot gnu dot org  2007-05-30 19:59 -------
*** Bug 32153 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kloedej at knmi dot nl


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-05-30 19:59 ` rguenth at gcc dot gnu dot org
@ 2008-03-01 10:54 ` steven at gcc dot gnu dot org
  2008-03-01 13:53 ` rguenth at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-03-01 10:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from steven at gcc dot gnu dot org  2008-03-01 10:50 -------
With trunk as of today, the test case of comment #0 does trap if optimization
is disabled. At -O, the libcall is optimized away, but the call to iaddv() from
main() is also optimized away because iaddv is found to be pure.  You must use
the result of iaddv() to avoid this:

#include <limits.h>

int __attribute__((noinline))
iaddv (int a, int b)
{
  return a + b;
}

int main(void)
{
  return iaddv (INT_MAX, 1);
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2008-03-01 10:54 ` steven at gcc dot gnu dot org
@ 2008-03-01 13:53 ` rguenth at gcc dot gnu dot org
  2008-03-01 14:30 ` rguenth at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-01 13:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2008-03-01 13:52 -------
On the expand side it is just wrong (and asking for trouble) to go the usual
expand_binop way for expanding trapping arithmetic.  At least we would need to
pass down a flag.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2008-03-01 13:53 ` rguenth at gcc dot gnu dot org
@ 2008-03-01 14:30 ` rguenth at gcc dot gnu dot org
  2008-03-01 15:24 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-01 14:30 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2008-03-01 14:30 ` rguenth at gcc dot gnu dot org
@ 2008-03-01 15:24 ` rguenth at gcc dot gnu dot org
  2008-03-03 19:36 ` steven at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-03-01 15:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from rguenth at gcc dot gnu dot org  2008-03-01 15:24 -------
Doesn't help.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2008-03-01 15:24 ` rguenth at gcc dot gnu dot org
@ 2008-03-03 19:36 ` steven at gcc dot gnu dot org
  2008-05-31  7:26 ` bonzini at gnu dot org
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-03-03 19:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from steven at gcc dot gnu dot org  2008-03-03 19:35 -------
Quoting your insn once more:

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

The register allocator failed to make your insn satisfy its constraints.
Operand 0 is (reg:DI 4 si) but the constraint for it is "=A", i.e. the ax
register.

The funny thing is that reload wants to make operand 0 be (reg:DI 0 ax), but
somehow it can't, even though (reg:SI 0 ax) dies in this insn. So apparently
the high part of (reg:DI 0 ax), i.e. (reg:SI 1 dx), lives across the insn.

This looks to me like a case of PR35404.  What do you think, Ian?


-- 

steven at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|                            |ian@airs.com,
                   |                            |zadeck@naturalbridge.com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2008-03-03 19:36 ` steven at gcc dot gnu dot org
@ 2008-05-31  7:26 ` bonzini at gnu dot org
  2008-07-18 18:23 ` rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: bonzini at gnu dot org @ 2008-05-31  7:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from bonzini at gnu dot org  2008-05-31 07:25 -------
*** Bug 36398 has been marked as a duplicate of this bug. ***


-- 

bonzini at gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2008-05-31  7:26 ` bonzini at gnu dot org
@ 2008-07-18 18:23 ` rguenth at gcc dot gnu dot org
  2008-11-29 22:21 ` ebotcazou at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 15+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-07-18 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from rguenth at gcc dot gnu dot org  2008-07-18 18:22 -------
*** Bug 36868 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrs at apple dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2008-07-18 18:23 ` rguenth at gcc dot gnu dot org
@ 2008-11-29 22:21 ` ebotcazou at gcc dot gnu dot org
  2008-11-29 22:25 ` steven at gcc dot gnu dot org
  2008-11-29 22:30 ` ebotcazou at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-11-29 22:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from ebotcazou at gcc dot gnu dot org  2008-11-29 22:19 -------
libcalls are gone in 4.4 and later.


-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2008-11-29 22:21 ` ebotcazou at gcc dot gnu dot org
@ 2008-11-29 22:25 ` steven at gcc dot gnu dot org
  2008-11-29 22:30 ` ebotcazou at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: steven at gcc dot gnu dot org @ 2008-11-29 22:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from steven at gcc dot gnu dot org  2008-11-29 22:23 -------
I'm not sure if this bug is fixed, though.  -ftrapv is still broken afaik.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
                   ` (12 preceding siblings ...)
  2008-11-29 22:25 ` steven at gcc dot gnu dot org
@ 2008-11-29 22:30 ` ebotcazou at gcc dot gnu dot org
  13 siblings, 0 replies; 15+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2008-11-29 22:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from ebotcazou at gcc dot gnu dot org  2008-11-29 22:29 -------
> I'm not sure if this bug is fixed, though.  -ftrapv is still broken afaik.

Probably, but let's ditch antiquated stuff and start afresh.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Bug middle-end/19020] libcalls are removed (-ftrapv does not work)
       [not found] <bug-19020-4@http.gcc.gnu.org/bugzilla/>
@ 2014-02-16 13:17 ` jackie.rosen at hushmail dot com
  0 siblings, 0 replies; 15+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 13:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19020

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #17 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-02-16 13:17 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-19020-226@http.gcc.gnu.org/bugzilla/>
2005-12-14 18:32 ` [Bug middle-end/19020] libcalls are removed (-ftrapv does not work) pinskia at gcc dot gnu dot org
2006-04-22 15:41 ` pinskia at gcc dot gnu dot org
2007-01-17 15:35 ` rguenth at gcc dot gnu dot org
2007-05-30 19:59 ` rguenth at gcc dot gnu dot org
2008-03-01 10:54 ` steven at gcc dot gnu dot org
2008-03-01 13:53 ` rguenth at gcc dot gnu dot org
2008-03-01 14:30 ` rguenth at gcc dot gnu dot org
2008-03-01 15:24 ` rguenth at gcc dot gnu dot org
2008-03-03 19:36 ` steven at gcc dot gnu dot org
2008-05-31  7:26 ` bonzini at gnu dot org
2008-07-18 18:23 ` rguenth at gcc dot gnu dot org
2008-11-29 22:21 ` ebotcazou at gcc dot gnu dot org
2008-11-29 22:25 ` steven at gcc dot gnu dot org
2008-11-29 22:30 ` ebotcazou at gcc dot gnu dot org
     [not found] <bug-19020-4@http.gcc.gnu.org/bugzilla/>
2014-02-16 13:17 ` jackie.rosen at hushmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).