Bug 66449 - [6 Regression] ICE: in build2_stat, at tree.c:4376 with -O3
Summary: [6 Regression] ICE: in build2_stat, at tree.c:4376 with -O3
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-07 11:00 UTC by Dmitry G. Dyachenko
Modified: 2015-06-24 01:51 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-06-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry G. Dyachenko 2015-06-07 11:00:20 UTC
r223920 PASS
r224193 FAIL

gcc -fpreprocessed -Werror -Wall -O2 -c x.i PASS
gcc -fpreprocessed -Werror -Wall -O3 -c x.i FAIL

$ cat x.i
void *fn1(void *p1, void *p2, long p3) {
  long a = (long)p1, b = (long)p2, c = p3;
  while (c) {
    int d = ((int *)b)[0];
    c--;
    ((char *)a)[0] = d;
    a++;
  }
  return 0;
}


$ /usr/local/gcc_current/bin/gcc -v
Using built-in specs.
COLLECT_GCC=/usr/local/gcc_current/bin/gcc
COLLECT_LTO_WRAPPER=/usr/local/gcc_current/libexec/gcc/x86_64-unknown-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /home/dimhen/src/gcc_current/configure --prefix=/usr/local/gcc_current --enable-static --enable-checking=yes,df,fold,rtl --enable-languages=c,c++,lto --enable-plugin --disable-libstdcxx-dual-abi --disable-multilib
Thread model: posix
gcc version 6.0.0 20150606 (experimental) [trunk revision 224193] (GCC)



$ /usr/local/gcc_current/bin/gcc -fpreprocessed -Werror -Wall -O3 -c x.i
x.i: In function ‘fn1’:
x.i:1:7: internal compiler error: in build2_stat, at tree.c:4376
 void *fn1(void *p1, void *p2, long p3) {
       ^
0xe180cd build2_stat(tree_code, tree_node*, tree_node*, tree_node*)
	/home/dimhen/src/gcc_current/gcc/tree.c:4375
0x862c78 build2_stat_loc
	/home/dimhen/src/gcc_current/gcc/tree.h:3702
0x862c78 fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/home/dimhen/src/gcc_current/gcc/fold-const.c:14281
0xd05015 loop_exits_before_overflow
	/home/dimhen/src/gcc_current/gcc/tree-ssa-loop-niter.c:3900
0xd05015 scev_probably_wraps_p(tree_node*, tree_node*, gimple_statement_base*, loop*, bool)
	/home/dimhen/src/gcc_current/gcc/tree-ssa-loop-niter.c:4031
0x13d3108 convert_affine_scev(loop*, tree_node*, tree_node**, tree_node**, gimple_statement_base*, bool)
	/home/dimhen/src/gcc_current/gcc/tree-chrec.c:1275
0x13d3510 chrec_convert_1
	/home/dimhen/src/gcc_current/gcc/tree-chrec.c:1330
0xc7e6c8 interpret_rhs_expr
	/home/dimhen/src/gcc_current/gcc/tree-scalar-evolution.c:1886
0xc7acca interpret_gimple_assign
	/home/dimhen/src/gcc_current/gcc/tree-scalar-evolution.c:1928
0xc7acca analyze_scalar_evolution_1
	/home/dimhen/src/gcc_current/gcc/tree-scalar-evolution.c:2010
0xc7b737 analyze_scalar_evolution(loop*, tree_node*)
	/home/dimhen/src/gcc_current/gcc/tree-scalar-evolution.c:2065
0xc7f12a analyze_scalar_evolution_in_loop
	/home/dimhen/src/gcc_current/gcc/tree-scalar-evolution.c:2161
0xc7f26f simple_iv(loop*, loop*, tree_node*, affine_iv*, bool)
	/home/dimhen/src/gcc_current/gcc/tree-scalar-evolution.c:3269
0x13dc669 dr_analyze_innermost(data_reference*, loop*)
	/home/dimhen/src/gcc_current/gcc/tree-data-ref.c:829
0x13e1742 create_data_ref(loop*, loop*, tree_node*, gimple_statement_base*, bool)
	/home/dimhen/src/gcc_current/gcc/tree-data-ref.c:1100
0x13e261c find_data_references_in_stmt(loop*, gimple_statement_base*, vec<data_reference*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_current/gcc/tree-data-ref.c:4532
0x13e27ea find_data_references_in_bb(loop*, basic_block_def*, vec<data_reference*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_current/gcc/tree-data-ref.c:4585
0x13e2a10 find_data_references_in_loop(loop*, vec<data_reference*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_current/gcc/tree-data-ref.c:4618
0x13e3b4a compute_data_dependences_for_loop(loop*, bool, vec<loop*, va_heap, vl_ptr>*, vec<data_reference*, va_heap, vl_ptr>*, vec<data_dependence_relation*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_current/gcc/tree-data-ref.c:4694
0xc65565 tree_predictive_commoning_loop
	/home/dimhen/src/gcc_current/gcc/tree-predcom.c:2486
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.
Comment 1 Dmitry G. Dyachenko 2015-06-07 19:27:29 UTC
start FAIL for me : r224020

configure as
$ ~/src/gcc_r224020/configure --prefix=/usr/local/gcc_current --enable-static --enable-checking=release --enable-languages=c,c++,lto --enable-plugin --disable-libstdcxx-dual-abi --disable-multilib
$ make
[build fail, fixed in r224030]

check as
$ /home/dimhen/build/gcc_r224020/./prev-gcc/xgcc -B/home/dimhen/build/gcc_r224020/./prev-gcc/ -B/usr/local/gcc_current/x86_64-unknown-linux-gnu/bin/ -fpreprocessed -Werror -Wall -O3 -c x.i
x.i: In function ‘fn1’:
x.i:1:7: internal compiler error: in build2_stat, at tree.c:4381
 void *fn1(void *p1, void *p2, long p3) {
       ^
0xfb436b build2_stat(tree_code, tree_node*, tree_node*, tree_node*)
	/home/dimhen/src/gcc_r224020/gcc/tree.c:4380
0x9afcef build2_stat_loc
	/home/dimhen/src/gcc_r224020/gcc/tree.h:3702
0x9da548 fold_build2_stat_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*)
	/home/dimhen/src/gcc_r224020/gcc/fold-const.c:14286
0xe992d3 loop_exits_before_overflow
	/home/dimhen/src/gcc_r224020/gcc/tree-ssa-loop-niter.c:3905
0xe99711 scev_probably_wraps_p(tree_node*, tree_node*, gimple_statement_base*, loop*, bool)
	/home/dimhen/src/gcc_r224020/gcc/tree-ssa-loop-niter.c:4036
0x14c96e1 convert_affine_scev(loop*, tree_node*, tree_node**, tree_node**, gimple_statement_base*, bool)
	/home/dimhen/src/gcc_r224020/gcc/tree-chrec.c:1279
0x14c9832 chrec_convert_1
	/home/dimhen/src/gcc_r224020/gcc/tree-chrec.c:1334
0x14c9b3c chrec_convert(tree_node*, tree_node*, gimple_statement_base*, bool)
	/home/dimhen/src/gcc_r224020/gcc/tree-chrec.c:1423
0xe0d3e6 interpret_rhs_expr
	/home/dimhen/src/gcc_r224020/gcc/tree-scalar-evolution.c:1893
0xe0d52a interpret_gimple_assign
	/home/dimhen/src/gcc_r224020/gcc/tree-scalar-evolution.c:1935
0xe0d793 analyze_scalar_evolution_1
	/home/dimhen/src/gcc_r224020/gcc/tree-scalar-evolution.c:2017
0xe0d94b analyze_scalar_evolution(loop*, tree_node*)
	/home/dimhen/src/gcc_r224020/gcc/tree-scalar-evolution.c:2072
0xe0da08 analyze_scalar_evolution_in_loop
	/home/dimhen/src/gcc_r224020/gcc/tree-scalar-evolution.c:2168
0xe0f848 simple_iv(loop*, loop*, tree_node*, affine_iv*, bool)
	/home/dimhen/src/gcc_r224020/gcc/tree-scalar-evolution.c:3276
0x14cd658 dr_analyze_innermost(data_reference*, loop*)
	/home/dimhen/src/gcc_r224020/gcc/tree-data-ref.c:834
0x14ce1e7 create_data_ref(loop*, loop*, tree_node*, gimple_statement_base*, bool)
	/home/dimhen/src/gcc_r224020/gcc/tree-data-ref.c:1105
0x14d6180 find_data_references_in_stmt(loop*, gimple_statement_base*, vec<data_reference*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_r224020/gcc/tree-data-ref.c:4537
0x14d635b find_data_references_in_bb(loop*, basic_block_def*, vec<data_reference*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_r224020/gcc/tree-data-ref.c:4590
0x14d640c find_data_references_in_loop(loop*, vec<data_reference*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_r224020/gcc/tree-data-ref.c:4623
0x14d656b compute_data_dependences_for_loop(loop*, bool, vec<loop*, va_heap, vl_ptr>*, vec<data_reference*, va_heap, vl_ptr>*, vec<data_dependence_relation*, va_heap, vl_ptr>*)
	/home/dimhen/src/gcc_r224020/gcc/tree-data-ref.c:4699
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.
Comment 2 Marek Polacek 2015-06-08 08:49:15 UTC
Confirmed.
Comment 3 bin cheng 2015-06-23 02:28:21 UTC
Author: amker
Date: Tue Jun 23 02:27:49 2015
New Revision: 224769

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

	PR tree-optimization/66449
	* tree-ssa-loop-niter.c (loop_exits_before_overflow): Use
	POINTER_PLUS_EXPR for pointers.

	gcc/testsuite
	PR tree-optimization/66449
	* gcc.dg/vect/pr66449.c: New test.


Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/pr66449.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-loop-niter.c
Comment 4 Dmitry G. Dyachenko 2015-06-23 09:54:58 UTC
(In reply to amker from comment #3)
> Author: amker
> Date: Tue Jun 23 02:27:49 2015
> New Revision: 224769
> 
> URL: https://gcc.gnu.org/viewcvs?rev=224769&root=gcc&view=rev
> Log:
> 
> 	PR tree-optimization/66449
> 	* tree-ssa-loop-niter.c (loop_exits_before_overflow): Use
> 	POINTER_PLUS_EXPR for pointers.
> 
> 	gcc/testsuite
> 	PR tree-optimization/66449
> 	* gcc.dg/vect/pr66449.c: New test.
> 
> 
> Added:
>     trunk/gcc/testsuite/gcc.dg/tree-ssa/pr66449.c
> Modified:
>     trunk/gcc/ChangeLog
>     trunk/gcc/testsuite/ChangeLog
>     trunk/gcc/tree-ssa-loop-niter.c

PASS for me. Thanks!
Comment 5 bin cheng 2015-06-24 01:51:16 UTC
Close according to comment#4