Bug 71279

Summary: [6/7 Regression] ICE on trunk gcc with knl target
Product: gcc Reporter: Anton Mitrokhin <anton.mitrokhin>
Component: middle-endAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: izamyatin, kirill.yukhin
Priority: P2    
Version: 7.0   
Target Milestone: 6.2   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2016-05-25 00:00:00
Bug Depends on:    
Bug Blocks: 103035    
Attachments: Reproducer

Description Anton Mitrokhin 2016-05-25 16:52:51 UTC
Created attachment 38567 [details]
Reproducer

Run:
> g++ -std=c++11 -O3 -march=knl -o out.o -c crash.cpp

Output:
crash.cpp: In function 'void fn1()':
crash.cpp:8:6: internal compiler error: in fold_convert_loc, at fold-const.c:2360
 void fn1() {
      ^~~
0xa86b55 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        /export/users/gnutester/stability/svn/trunk/gcc/fold-const.c:2360
0xa73d4c fold_ternary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*, tree_node*)
        /export/users/gnutester/stability/svn/trunk/gcc/fold-const.c:11624
0xacf931 fold_gimple_assign
        /export/users/gnutester/stability/svn/trunk/gcc/gimple-fold.c:408
0xad4e2f fold_stmt_1
        /export/users/gnutester/stability/svn/trunk/gcc/gimple-fold.c:3762
0xe6a316 optimize_stmt
        /export/users/gnutester/stability/svn/trunk/gcc/tree-ssa-dom.c:1792
0xe6a316 dom_opt_dom_walker::before_dom_children(basic_block_def*)
        /export/users/gnutester/stability/svn/trunk/gcc/tree-ssa-dom.c:1380
0x13a2102 dom_walker::walk(basic_block_def*)
        /export/users/gnutester/stability/svn/trunk/gcc/domwalk.c:265
0xe6b578 execute
        /export/users/gnutester/stability/svn/trunk/gcc/tree-ssa-dom.c:614
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.


> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/export/users/amitrokh/gcc_trunk/bin/../libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /export/users/gnutester/stability/svn/trunk/configure --with-arch=corei7 --with-cpu=corei7 --enable-clocale=gnu --with-system-zlib --enable-shared --with-demangler-in-ld --enable-cloog-backend=isl --with-fpmath=sse --with-pkgversion=Revision=236669/svn-rev:236669/ --prefix=/export/users/gnutester/stability/work/trunk/64/install --enable-languages=c,c++,fortran,java,lto
Thread model: posix
gcc version 7.0.0 20160524 (experimental) (Revision=236669/svn-rev:236669/)
Comment 1 Marek Polacek 2016-05-25 16:55:15 UTC
Confirmed with gcc6 and trunk.
Comment 2 Marek Polacek 2016-05-25 16:57:50 UTC
Started with r230098.
Comment 3 Ilya Enkovich 2016-05-26 11:02:01 UTC
This looks similar to PR70251 but this time transformation is performed in folding.  Here is a description of applied transformation:

/* Convert A ? 0 : 1 to !A.  This prefers the use of NOT_EXPR     
   over COND_EXPR in cases such as floating point comparisons.  */

This doesn't work for boolean vectors with scalar mode.  So we should disable transformation for vec_cond_expr or at least for boolean vectors with scalar mode.
Comment 4 Ilya Enkovich 2016-05-27 10:40:12 UTC
Author: ienkovich
Date: Fri May 27 10:39:40 2016
New Revision: 236810

URL: https://gcc.gnu.org/viewcvs?rev=236810&root=gcc&view=rev
Log:
gcc/

	PR middle-end/71279
	* fold-const.c (fold_ternary_loc): Don't fold VEC_COND_EXPR
	into comparison.

gcc/testsuite/

	PR middle-end/71279
	* gcc.dg/pr71279.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr71279.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Ilya Enkovich 2016-05-27 10:44:06 UTC
Author: ienkovich
Date: Fri May 27 10:43:34 2016
New Revision: 236811

URL: https://gcc.gnu.org/viewcvs?rev=236811&root=gcc&view=rev
Log:
gcc/

	Backport from mainline r236810.
	2016-05-27  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR middle-end/71279
	* fold-const.c (fold_ternary_loc): Don't fold VEC_COND_EXPR
	into comparison.

gcc/testsuite/

	Backport from mainline r236810.
	2016-05-27  Ilya Enkovich  <ilya.enkovich@intel.com>

	PR middle-end/71279
	* gcc.dg/pr71279.c: New test.

Added:
    branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr71279.c
Modified:
    branches/gcc-6-branch/gcc/ChangeLog
    branches/gcc-6-branch/gcc/fold-const.c
    branches/gcc-6-branch/gcc/testsuite/ChangeLog
Comment 6 Ilya Enkovich 2016-05-27 10:44:31 UTC
Fixed
Comment 7 Markus Trippelsdorf 2016-06-16 12:07:58 UTC
*** Bug 71551 has been marked as a duplicate of this bug. ***