public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/55281] New: [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
@ 2012-11-12 10:06 vincenzo.innocente at cern dot ch
  2012-11-12 10:33 ` [Bug tree-optimization/55281] " jakub at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-11-12 10:06 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 55281
           Summary: [4.8 Regression] ICE in  build_int_cst_wide, at
                    tree.c:1217  (with Ofast, ok with O3)
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vincenzo.innocente@cern.ch


Created attachment 28666
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28666
preprocesse real-file code

c++ -std=gnu++11  -Ofast -c PhiPattern.ii
plugins/PhiPattern.cc: In member function 'virtual int
PhiPattern::produce(WhiteBoard&)':
plugins/PhiPattern.cc:26:5: internal compiler error: in build_int_cst_wide, at
tree.c:1217
 int PhiPattern::produce(WhiteBoard & event) {
     ^
0xd393ab build_int_cst_wide(tree_node*, unsigned long, long)
    ../../gcc-trunk/gcc/tree.c:1217
0xd3990e double_int_to_tree(tree_node*, double_int)
    ../../gcc-trunk/gcc/tree.c:1067
0xd39dea build_int_cst(tree_node*, long)
    ../../gcc-trunk/gcc/tree.c:1044
0xbefd2b fold_relational_const(tree_code, tree_node*, tree_node*, tree_node*)
[clone .437619]
    ../../gcc-trunk/gcc/fold-const.c:16163
0xb870b9 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
    ../../gcc-trunk/gcc/fold-const.c:9801
0xba8eef fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
    ../../gcc-trunk/gcc/fold-const.c:14676
0xc9f217 fold_binary_op_with_conditional_arg(unsigned int, tree_code,
tree_node*, tree_node*, tree_node*, tree_node*, tree_node*, int) [clone
.437722]
    ../../gcc-trunk/gcc/fold-const.c:6011
0xb89fb4 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
    ../../gcc-trunk/gcc/fold-const.c:9887
0xa3d04a combine_cond_expr_cond
    ../../gcc-trunk/gcc/tree-ssa-forwprop.c:367
0xa3d2c4 forward_propagate_into_comparison_1(gimple_statement_d*, tree_code,
tree_node*, tree_node*, tree_node*) [clone .1031067]
    ../../gcc-trunk/gcc/tree-ssa-forwprop.c:414
0x5fccc5 forward_propagate_into_cond
    ../../gcc-trunk/gcc/tree-ssa-forwprop.c:562
0x5fccc5 ssa_forward_propagate_and_combine
    ../../gcc-trunk/gcc/tree-ssa-forwprop.c:3012
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
[innocent@vinavx0 Octave]$ c++ -std=gnu++11 -O3 -c PhiPattern.ii
[innocent@vinavx0 Octave]$ c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/afs/cern.ch/user/i/innocent/w2/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure
--prefix=/afs/cern.ch/user/i/innocent/w2 --enable-languages=c,c++,lto,fortran
-enable-gold=yes --enable-lto --with-build-config=bootstrap-lto
--with-gmp-lib=/usr/local/lib64 --with-mpfr-lib=/usr/local/lib64
-with-mpc-lib=/usr/local/lib64 --enable-cloog-backend=isl
--with-cloog=/usr/local --with-ppl-lib=/usr/local/lib64 CFLAGS='-O2
-ftree-vectorize -fPIC' CXXFLAGS='-O2 -fPIC -ftree-vectorize
-fvisibility-inlines-hidden -march=native' -enable-libitm -disable-multilib
Thread model: posix
gcc version 4.8.0 20121112 (experimental) [trunk revision 193427] (GCC) 

same with
bzip2 -d PhiPattern.ii.bz2 
pb-d-128-141-131-26:bugs48 innocent$ c++ -std=gnu++11 -O3 -c PhiPattern.ii
pb-d-128-141-131-26:bugs48 innocent$ c++ -std=gnu++11 -Ofast -c PhiPattern.ii
plugins/PhiPattern.cc: In member function ‘virtual int
PhiPattern::produce(WhiteBoard&)’:
plugins/PhiPattern.cc:26:5: internal compiler error: in build_int_cst_wide, at
tree.c:1217

plugins/PhiPattern.cc:26:5: internal compiler error: Abort trap: 6


c++: internal compiler error: Abort trap: 6 (program cc1plus)
Abort trap: 6
pb-d-128-141-131-26:bugs48 innocent$ 
pb-d-128-141-131-26:bugs48 innocent$ 
pb-d-128-141-131-26:bugs48 innocent$ c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin12.2.0/4.8.0/lto-wrapper
Target: x86_64-apple-darwin12.2.0
Configured with: ./configure --enable-languages=c,c++,fortran
--disable-multilib --disable-bootstrap --enable-lto -disable-libitm
Thread model: posix
gcc version 4.8.0 20121109 (experimental) [trunk revision 193360] (GCC)


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
@ 2012-11-12 10:33 ` jakub at gcc dot gnu.org
  2012-11-12 11:46 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-12 10:33 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-11-12
                 CC|                            |jakub at gcc dot gnu.org
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |
   Target Milestone|---                         |4.8.0
     Ever Confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-12 10:33:27 UTC ---
Short testcase:

typedef float VF __attribute__((vector_size (16)));

VF x;

void
foo (void)
{
  VF a, b, c;
  a = (VF) { 1.0, 2.0, 3.0, 4.0 };
  b = (VF) { 5.0, 6.0, 7.0, 8.0 };
  c = (VF) { 0.0, 0.0, 0.0, 0.0 };
  x = c != ((VF) { 0.0, 0.0, 0.0, 0.0 }) ? a : b;
}

with -Ofast.  I was surprised only C++ handles this and not C BTW.


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
  2012-11-12 10:33 ` [Bug tree-optimization/55281] " jakub at gcc dot gnu.org
@ 2012-11-12 11:46 ` jakub at gcc dot gnu.org
  2012-11-12 15:12 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-12 11:46 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-12 11:46:30 UTC ---
Actually, that shorter testcase ICEs for a different reason.
static inline float
bar (float k, float j)
{
  float l = 0.0f;
  if (k > j)
    l = k;
  float t = k / j;
  float v = t * t;
  if (k == 0)
    v = 0.0f;
  if (t > 0.4f)
    v += 0.7;
  if (l != 0)
    v = 1.5 - v;
  return v;
}

void
foo (int *a, int b, float *d, float *e, int *f)
{
  for (int l = 0; l != b; ++l)
    for (int i = 0; i != 8; ++i)
      f[i] = e[i] + bar (a[i], d[i]);
}

is where the original testcase ICEs (-Ofast, both C and C++).


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
  2012-11-12 10:33 ` [Bug tree-optimization/55281] " jakub at gcc dot gnu.org
  2012-11-12 11:46 ` jakub at gcc dot gnu.org
@ 2012-11-12 15:12 ` jakub at gcc dot gnu.org
  2012-11-12 15:37 ` vincenzo.innocente at cern dot ch
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-12 15:12 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-12 15:12:20 UTC ---
Created attachment 28668
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28668
gcc48-pr55281.patch

Untested fix.


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
                   ` (2 preceding siblings ...)
  2012-11-12 15:12 ` jakub at gcc dot gnu.org
@ 2012-11-12 15:37 ` vincenzo.innocente at cern dot ch
  2012-11-12 16:19 ` glisse at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-11-12 15:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #4 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-11-12 15:37:23 UTC ---
regression removed by the patch
at first sight performances are similar to 4.7.2, so also vectorization is ok


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
                   ` (3 preceding siblings ...)
  2012-11-12 15:37 ` vincenzo.innocente at cern dot ch
@ 2012-11-12 16:19 ` glisse at gcc dot gnu.org
  2012-11-12 16:23 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-11-12 16:19 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> 2012-11-12 16:18:52 UTC ---
(In reply to comment #1)
[ Using ?: with a vector condition ]
> I was surprised only C++ handles this and not C BTW.

Sorry, I didn't have time to do a C version (harder than C++ because of things
like c_wrap_maybe_const that I don't understand yet). Even the C++ version
isn't documented yet (I should do it), because it has a number of bugs like
this one.

By the way, I assume you are not calling pedantic_omit_one_operand_loc because
the vector operand is unlikely to have a side effect?


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
                   ` (4 preceding siblings ...)
  2012-11-12 16:19 ` glisse at gcc dot gnu.org
@ 2012-11-12 16:23 ` jakub at gcc dot gnu.org
  2012-11-12 16:39 ` glisse at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-12 16:23 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-12 16:23:29 UTC ---
I'm just testing that, so I know it doesn't have side-effects.  COND_EXPR
handling which I've copied was doing the same thing.  The reason for the
fold-const.c change was that while you handle that case in forwprop, it only
triggers if forwprop actually simplifies the condition, but if e.g. copyprop
does that, then nothing will fix it up afterwards till expansion.


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
                   ` (5 preceding siblings ...)
  2012-11-12 16:23 ` jakub at gcc dot gnu.org
@ 2012-11-12 16:39 ` glisse at gcc dot gnu.org
  2012-11-13  7:26 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: glisse at gcc dot gnu.org @ 2012-11-12 16:39 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #7 from Marc Glisse <glisse at gcc dot gnu.org> 2012-11-12 16:39:27 UTC ---
(In reply to comment #6)
> I'm just testing that, so I know it doesn't have side-effects.

I meant: instead of testing, so the optimization still occurs when there is a
side effect.

> COND_EXPR handling which I've copied was doing the same thing.

Ah, indeed.

> The reason for the
> fold-const.c change was that while you handle that case in forwprop, it only
> triggers if forwprop actually simplifies the condition, but if e.g. copyprop
> does that, then nothing will fix it up afterwards till expansion.

Understood.


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
                   ` (6 preceding siblings ...)
  2012-11-12 16:39 ` glisse at gcc dot gnu.org
@ 2012-11-13  7:26 ` jakub at gcc dot gnu.org
  2012-11-13  7:44 ` jakub at gcc dot gnu.org
  2012-11-13  8:04 ` vincenzo.innocente at cern dot ch
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-13  7:26 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-13 07:25:41 UTC ---
Author: jakub
Date: Tue Nov 13 07:25:36 2012
New Revision: 193471

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193471
Log:
    PR tree-optimization/55281
    * tree-vect-generic.c (expand_vector_condition): Accept any
    is_gimple_val rather than just SSA_NAME if not COMPARISON_CLASS_P.
    * fold-const.c (fold_ternary_loc): Fold VEC_COND_EXPR if arg0 is
    either integer_all_onesp or integer_zerop.
    * tree-vect-stmts.c (vectorizable_condition): Build the condition
    using corresponding vector integer type instead of vectype.

    * gcc.dg/vect/fast-math-pr55281.c: New test.
    * g++.dg/opt/pr55281.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/opt/pr55281.C
    trunk/gcc/testsuite/gcc.dg/vect/fast-math-pr55281.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-vect-generic.c
    trunk/gcc/tree-vect-stmts.c


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
                   ` (7 preceding siblings ...)
  2012-11-13  7:26 ` jakub at gcc dot gnu.org
@ 2012-11-13  7:44 ` jakub at gcc dot gnu.org
  2012-11-13  8:04 ` vincenzo.innocente at cern dot ch
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-11-13  7:44 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-11-13 07:44:31 UTC ---
Fixed.


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

* [Bug tree-optimization/55281] [4.8 Regression] ICE in  build_int_cst_wide, at tree.c:1217  (with Ofast, ok with O3)
  2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
                   ` (8 preceding siblings ...)
  2012-11-13  7:44 ` jakub at gcc dot gnu.org
@ 2012-11-13  8:04 ` vincenzo.innocente at cern dot ch
  9 siblings, 0 replies; 11+ messages in thread
From: vincenzo.innocente at cern dot ch @ 2012-11-13  8:04 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #10 from vincenzo Innocente <vincenzo.innocente at cern dot ch> 2012-11-13 08:04:35 UTC ---
confirmed fixed in
gcc version 4.8.0 20121113 (experimental) [trunk revision 193471] (GCC)


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

end of thread, other threads:[~2012-11-13  8:04 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-12 10:06 [Bug tree-optimization/55281] New: [4.8 Regression] ICE in build_int_cst_wide, at tree.c:1217 (with Ofast, ok with O3) vincenzo.innocente at cern dot ch
2012-11-12 10:33 ` [Bug tree-optimization/55281] " jakub at gcc dot gnu.org
2012-11-12 11:46 ` jakub at gcc dot gnu.org
2012-11-12 15:12 ` jakub at gcc dot gnu.org
2012-11-12 15:37 ` vincenzo.innocente at cern dot ch
2012-11-12 16:19 ` glisse at gcc dot gnu.org
2012-11-12 16:23 ` jakub at gcc dot gnu.org
2012-11-12 16:39 ` glisse at gcc dot gnu.org
2012-11-13  7:26 ` jakub at gcc dot gnu.org
2012-11-13  7:44 ` jakub at gcc dot gnu.org
2012-11-13  8:04 ` vincenzo.innocente at cern dot ch

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