Bug 52639 - ice in supportable_widening_operation
Summary: ice in supportable_widening_operation
Status: RESOLVED DUPLICATE of bug 52870
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.8.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Reported: 2012-03-20 18:15 UTC by David Binderman
Modified: 2014-02-16 10:02 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2012-03-31 00:00:00

C source code (21.50 KB, text/x-csrc)
2012-03-20 18:15 UTC, David Binderman
C++ source code (4.25 KB, text/x-c++src)
2012-04-03 19:29 UTC, David Binderman

Note You need to log in before you can comment on or make changes to this bug.
Description David Binderman 2012-03-20 18:15:31 UTC
Created attachment 26934 [details]
C source code

I just tried to compile the package mpfr-3.1.0
on gcc-4.8 trunk dated 20120319 on an AMD x86_64 box.

The compiler said

set_f.c: In function 'mpfr_set_f':
set_f.c:27:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Here is a valgrind dump

==19223== Invalid read of size 8
==19223==    at 0xCC7B08: supportable_widening_operation(tree_code, gimple_statement_d*, tree_node*, tree_node*, tree_node**, tree_node**, tree_code*, tree_code*, int*, VEC_tree_heap**) (tree-vect-stmts.c:6096)
==19223==    by 0x1082547: vect_recog_widen_mult_pattern(VEC_gimple_heap**, tree_node**, tree_node**) (tree-vect-patterns.c:664)
==19223==    by 0x1087A57: vect_pattern_recog(_loop_vec_info*, _bb_vec_info*) (tree-vect-patterns.c:2553)
==19223==    by 0xCEBA85: vect_slp_analyze_bb(basic_block_def*) (tree-vect-slp.c:2020)
==19223==    by 0xCECA55: execute_vect_slp() (tree-vectorizer.c:265)
==19223==    by 0xA52D6C: execute_one_pass(opt_pass*) (passes.c:2084)
==19223==    by 0xA532E6: execute_pass_list(opt_pass*) (passes.c:2139)
==19223==    by 0xB91E4D: tree_rest_of_compilation(tree_node*) (tree-optimize.c:422)
==19223==    by 0x7EBD7D: cgraph_expand_function(cgraph_node*) (cgraphunit.c:1837)
==19223==    by 0x7EFB4B: cgraph_optimize() (cgraphunit.c:1904)
==19223==    by 0x7F01F9: cgraph_finalize_compilation_unit() (cgraphunit.c:1344)
==19223==    by 0x5F3B1A: cp_write_global_declarations() (decl2.c:4074)
==19223==  Address 0x10 is not stack'd, malloc'd or (recently) free'd

Preprocessed source code attached. Flag -O3 required.
Comment 1 David Binderman 2012-03-20 18:50:21 UTC
The source code is C++, not C. My mistake, sorry.
Comment 2 Paolo Carlini 2012-03-31 23:17:45 UTC
Please, do your best to reduce the size of the reproducer: http://gcc.gnu.org/wiki/A_guide_to_testcase_reduction
Comment 3 David Binderman 2012-04-03 19:29:11 UTC
Created attachment 27079 [details]
C++ source code
Comment 4 David Binderman 2012-04-03 19:31:58 UTC
Finally, I managed to get delta to do something useful.

Minimal test case attached.
Comment 5 Vincent Lefèvre 2012-04-24 13:22:08 UTC
Same problem here under Debian/unstable (x86_64), with:

gcc-snapshot -O3 -march=native -std=gnu99 -c ice-setf.i

and the testcase below, using:

gcc (Debian 20120407-1) 4.8.0 20120407 (experimental) [trunk revision 186212]

Here's a simpler testcase:

// /usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/4.8.0/cc1 -fpreprocessed ice-setf.i -march=corei7 -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=8192 -mtune=corei7 -quiet -dumpbase ice-setf.i -auxbase ice-setf -O3 -std=gnu99 -o - -frandom-seed=0
# 1 "ice-setf.i"
int a(int *, unsigned long);
int g(unsigned long);
void r(int, long);

int foo(unsigned long sy, int *x, int i)
  unsigned long sx = x[0];
  if (sy <= sx)
      unsigned long p = sx * 64;
      int m = 0;
      int tmp = i ? g(sx) : a(&m, sx);
      r(tmp, p);
  return 0;

The ICE is reproducible with -O3, but not with -O2. Also note that this is C, not C++.
Comment 6 Richard Biener 2012-04-24 14:04:42 UTC
Supposedly fixed by

2012-04-10  Ulrich Weigand  <ulrich.weigand@linaro.org>

        PR tree-optimization/52870
        * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Verify that
        presumed pattern statement is within the same loop or basic block.

meaning, I cannot reproduce it.
Comment 7 David Binderman 2012-04-24 18:08:53 UTC
(In reply to comment #6)
> Supposedly fixed by
> 2012-04-10  Ulrich Weigand  <ulrich.weigand@linaro.org>
>         PR tree-optimization/52870
>         * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Verify that
>         presumed pattern statement is within the same loop or basic block.
> meaning, I cannot reproduce it.

I checked and trunk 20120422 doesn't seem to have this bug.

So it looks fixed to me. Suggest mark resolved.
Comment 8 Vincent Lefèvre 2012-04-24 23:58:06 UTC
I confirm that rebuilding gcc-snapshot with the patch http://gcc.gnu.org/viewcvs?view=revision&revision=186272 for PR tree-optimization/52870 solves the problem.

So, I think that this bug should be closed as a duplicate of bug 52870.
Comment 9 Paolo Carlini 2012-04-25 00:17:23 UTC

*** This bug has been marked as a duplicate of bug 52870 ***
Comment 10 Jackie Rosen 2014-02-16 10:02:38 UTC Comment hidden (spam)