public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
@ 2014-04-01 13:22 rppawlo at sandia dot gov
  2014-04-01 13:28 ` [Bug c++/60729] " rppawlo at sandia dot gov
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: rppawlo at sandia dot gov @ 2014-04-01 13:22 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4513 bytes --]

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

            Bug ID: 60729
           Summary: Compiler failure for combination of -ftrapv and -O3:
                    compiler error: in prepare_cmp_insn
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rppawlo at sandia dot gov

Created attachment 32514
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32514&action=edit
test file

Hi,

I'm running stock Ubuntu 13.10 and get a g++ compiler error when using a
certain commbination of compiler options.  

The attached file reproduces the bug:

*************************BEGIN FILE***********************

// This test generates an inernal compiler failure in g++ 4.8.1 on
// ubuntu 13.10.  The combination of -O3 and -ftrapv causes the issue.
// You can drop to -O2 or remove -ftrapv to fix.

// The following compile works:
// g++ -O3 -c test.cpp
// g++ -O2 -ftrapv -c test.cpp

// The following compile fails:
// g++ -ftrapv -O3 -c test.cpp

#include <cmath>

void doSomething(int dim, double *Y, double *A) 
{
  for (int k=0; k<dim; k++) 
    Y[k] += std::abs(A[k]);
}

*************************END FILE***********************

Here's the output:

rppawlo@drekar:~$ g++ -O3 -c test.cpp
rppawlo@drekar:~$ g++ -O2 -ftrapv -c test.cpp
rppawlo@drekar:~$ g++ -ftrapv -O3 -c test.cpp
test.cpp: In function ‘void doSomething(int, double*, double*)’:
test.cpp:17:27: internal compiler error: in prepare_cmp_insn, at optabs.c:4190
     Y[k] += std::abs(A[k]);
                           ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
Preprocessed source stored into /tmp/cccvQgai.out file, please attach this to
your bugreport.
rppawlo@drekar:~$


Here's some info about my machine/environment:

rppawlo@drekar:~$ g++ --version
g++ (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rppawlo@drekar:~$ uname -a
Linux drekar 3.11.0-18-generic #32-Ubuntu SMP Tue Feb 18 21:11:14 UTC 2014
x86_64 x86_64 x86_64 GNU/Linux
>From gcc-bugs-return-448034-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Apr 01 13:23:09 2014
Return-Path: <gcc-bugs-return-448034-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 12671 invoked by alias); 1 Apr 2014 13:23:08 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 12642 invoked by uid 48); 1 Apr 2014 13:23:05 -0000
From: "rppawlo at sandia dot gov" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/60729] Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
Date: Tue, 01 Apr 2014 13:23:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.8.1
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rppawlo at sandia dot gov
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-60729-4-8sfcV9e1yB@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-60729-4@http.gcc.gnu.org/bugzilla/>
References: <bug-60729-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-04/txt/msg00054.txt.bz2
Content-length: 236

http://gcc.gnu.org/bugzilla/show_bug.cgi?id`729

--- Comment #1 from rppawlo at sandia dot gov ---
Created attachment 32515
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id2515&actioníit
output file generated with -save-temps


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

* [Bug c++/60729] Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
  2014-04-01 13:22 [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn rppawlo at sandia dot gov
@ 2014-04-01 13:28 ` rppawlo at sandia dot gov
  2014-04-01 14:35 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rppawlo at sandia dot gov @ 2014-04-01 13:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from rppawlo at sandia dot gov ---
Created attachment 32516
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32516&action=edit
error file generated from compiler failure


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

* [Bug c++/60729] Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
  2014-04-01 13:22 [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn rppawlo at sandia dot gov
  2014-04-01 13:28 ` [Bug c++/60729] " rppawlo at sandia dot gov
@ 2014-04-01 14:35 ` rguenth at gcc dot gnu.org
  2014-04-02  8:27 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-01 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-04-01
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  The issue is that we vectorize the abs() but fail to provide
a negv_optab for V2DFmode and the fallback expansion fails as well
(this path isn't able to handle the vector case at all).

Issue with expand_abs_nojump which uses absv_optab for FP modes.

Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c        (revision 208988)
+++ gcc/optabs.c        (working copy)
@@ -3384,7 +3384,8 @@ expand_abs_nojump (enum machine_mode mod
 {
   rtx temp;

-  if (! flag_trapv)
+  if (GET_MODE_CLASS (mode) != MODE_INT
+      || ! flag_trapv)
     result_unsignedp = 1;

   /* First try to do it with a special abs instruction.  */
@@ -3407,7 +3408,8 @@ expand_abs_nojump (enum machine_mode mod
     {
       rtx last = get_last_insn ();

-      temp = expand_unop (mode, neg_optab, op0, NULL_RTX, 0);
+      temp = expand_unop (mode, result_unsignedp ? neg_optab : negv_optab,
+                         op0, NULL_RTX, 0);
       if (temp != 0)
        temp = expand_binop (mode, smax_optab, op0, temp, target, 0,
                             OPTAB_WIDEN);
@@ -3449,7 +3451,8 @@ expand_abs (enum machine_mode mode, rtx
 {
   rtx temp, op1;

-  if (! flag_trapv)
+  if (GET_MODE_CLASS (mode) != MODE_INT
+      || ! flag_trapv)
     result_unsignedp = 1;

   temp = expand_abs_nojump (mode, op0, target, result_unsignedp);


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

* [Bug c++/60729] Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
  2014-04-01 13:22 [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn rppawlo at sandia dot gov
  2014-04-01 13:28 ` [Bug c++/60729] " rppawlo at sandia dot gov
  2014-04-01 14:35 ` rguenth at gcc dot gnu.org
@ 2014-04-02  8:27 ` rguenth at gcc dot gnu.org
  2014-04-02  8:28 ` [Bug middle-end/60729] [4.8 Regression] " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-02  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Apr  2 08:26:57 2014
New Revision: 209012

URL: http://gcc.gnu.org/viewcvs?rev=209012&root=gcc&view=rev
Log:
2014-04-02  Richard Biener  <rguenther@suse.de>

    PR middle-end/60729
    * optabs.c (expand_abs_nojump): Honor flag_trapv only for
    MODE_INTs.  Properly use negv_optab.
    (expand_abs): Likewise.

    * g++.dg/vect/pr60729.cc: New testcase.

Added:
    trunk/gcc/testsuite/g++.dg/vect/pr60729.cc
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/optabs.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug middle-end/60729] [4.8 Regression] Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
  2014-04-01 13:22 [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn rppawlo at sandia dot gov
                   ` (2 preceding siblings ...)
  2014-04-02  8:27 ` rguenth at gcc dot gnu.org
@ 2014-04-02  8:28 ` rguenth at gcc dot gnu.org
  2014-04-23 12:49 ` rguenth at gcc dot gnu.org
  2014-04-23 12:52 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-02  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |middle-end
      Known to work|                            |4.7.3, 4.9.0
   Target Milestone|---                         |4.8.3
            Summary|Compiler failure for        |[4.8 Regression] Compiler
                   |combination of -ftrapv and  |failure for combination of
                   |-O3: compiler error: in     |-ftrapv and -O3: compiler
                   |prepare_cmp_insn            |error: in prepare_cmp_insn

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.


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

* [Bug middle-end/60729] [4.8 Regression] Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
  2014-04-01 13:22 [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn rppawlo at sandia dot gov
                   ` (3 preceding siblings ...)
  2014-04-02  8:28 ` [Bug middle-end/60729] [4.8 Regression] " rguenth at gcc dot gnu.org
@ 2014-04-23 12:49 ` rguenth at gcc dot gnu.org
  2014-04-23 12:52 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-23 12:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Author: rguenth
Date: Wed Apr 23 12:49:04 2014
New Revision: 209697

URL: http://gcc.gnu.org/viewcvs?rev=209697&root=gcc&view=rev
Log:
2014-04-23  Richard Biener  <rguenther@suse.de>

    Backport from mainline
    2014-04-02  Richard Biener  <rguenther@suse.de>

    PR middle-end/60729
    * optabs.c (expand_abs_nojump): Honor flag_trapv only for
    MODE_INTs.  Properly use negv_optab.
    (expand_abs): Likewise.

    * g++.dg/vect/pr60729.cc: New testcase.

    2014-04-03  Richard Biener  <rguenther@suse.de>

    PR tree-optimization/60740
    * graphite-scop-detection.c (stmt_simple_for_scop_p): Iterate
    over all GIMPLE_COND operands.

    * gcc.dg/graphite/pr60740.c: New testcase.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/vect/pr60729.cc
    branches/gcc-4_8-branch/gcc/testsuite/gcc.dg/graphite/pr60740.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/graphite-scop-detection.c
    branches/gcc-4_8-branch/gcc/optabs.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


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

* [Bug middle-end/60729] [4.8 Regression] Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn
  2014-04-01 13:22 [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn rppawlo at sandia dot gov
                   ` (4 preceding siblings ...)
  2014-04-23 12:49 ` rguenth at gcc dot gnu.org
@ 2014-04-23 12:52 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-04-23 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.


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

end of thread, other threads:[~2014-04-23 12:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-01 13:22 [Bug c++/60729] New: Compiler failure for combination of -ftrapv and -O3: compiler error: in prepare_cmp_insn rppawlo at sandia dot gov
2014-04-01 13:28 ` [Bug c++/60729] " rppawlo at sandia dot gov
2014-04-01 14:35 ` rguenth at gcc dot gnu.org
2014-04-02  8:27 ` rguenth at gcc dot gnu.org
2014-04-02  8:28 ` [Bug middle-end/60729] [4.8 Regression] " rguenth at gcc dot gnu.org
2014-04-23 12:49 ` rguenth at gcc dot gnu.org
2014-04-23 12:52 ` rguenth at gcc dot gnu.org

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