Bug 70022 - [4.9 Regression] ICE: in tree_to_shwi, at tree.c:7328 with out-of-bounds vector index
Summary: [4.9 Regression] ICE: in tree_to_shwi, at tree.c:7328 with out-of-bounds vect...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 6.0
: P3 normal
Target Milestone: 4.9.4
Assignee: Richard Biener
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2016-03-01 07:16 UTC by Zdenek Sojka
Modified: 2017-02-14 10:46 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.7.4, 5.4.0, 6.0
Known to fail: 4.8.5, 4.9.3, 5.3.1
Last reconfirmed: 2016-03-01 00:00:00


Attachments
reduced testcase (92 bytes, text/plain)
2016-03-01 07:16 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2016-03-01 07:16:43 UTC
Created attachment 37827 [details]
reduced testcase

Compiler output:
$ gcc testcase.c 
testcase.c: In function 'foo':
testcase.c:6:4: internal compiler error: in tree_to_shwi, at tree.c:7328
   v[~0ULL];
   ~^~~~~~~
0xe40e42 tree_to_shwi(tree_node const*)
        /repo/gcc-trunk/gcc/tree.c:7328
0x87c2b4 fold_indirect_ref_1(unsigned int, tree_node*, tree_node*)
        /repo/gcc-trunk/gcc/fold-const.c:14221
0x89c9e3 fold_indirect_ref_loc(unsigned int, tree_node*)
        /repo/gcc-trunk/gcc/fold-const.c:14300
0x8fe098 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
        /repo/gcc-trunk/gcc/gimplify.c:10276
0x900b96 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.c:5644
0x901dd5 gimplify_bind_expr
        /repo/gcc-trunk/gcc/gimplify.c:1142
0x8fbe62 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int)
        /repo/gcc-trunk/gcc/gimplify.c:10363
0x900b96 gimplify_stmt(tree_node**, gimple**)
        /repo/gcc-trunk/gcc/gimplify.c:5644
0x9029f4 gimplify_body(tree_node*, bool)
        /repo/gcc-trunk/gcc/gimplify.c:11295
0x903086 gimplify_function_tree(tree_node*)
        /repo/gcc-trunk/gcc/gimplify.c:11451
0x7639c7 cgraph_node::analyze()
        /repo/gcc-trunk/gcc/cgraphunit.c:625
0x766d33 analyze_functions
        /repo/gcc-trunk/gcc/cgraphunit.c:1086
0x767a78 symbol_table::finalize_compilation_unit()
        /repo/gcc-trunk/gcc/cgraphunit.c:2540
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.

All targets seem to be affected.

Tested revisions:
trunk r233801 - FAIL
5-branch r233800 - FAIL
4_9-branch r233802 - FAIL
4_8-branch r224828 - FAIL (in tree_low_cst)
4_7-branch r211571 - OK
Comment 1 Richard Biener 2016-03-01 09:51:53 UTC
Mine.
Comment 2 Richard Biener 2016-03-01 13:32:27 UTC
Fixed on trunk sofar.
Comment 3 Richard Biener 2016-03-01 13:32:45 UTC
Author: rguenth
Date: Tue Mar  1 13:32:13 2016
New Revision: 233852

URL: https://gcc.gnu.org/viewcvs?rev=233852&root=gcc&view=rev
Log:
2016-03-01  Richard Biener  <rguenther@suse.de>

	PR middle-end/70022
	* fold-const.c (fold_indirect_ref_1): Fix range checking for
	vector BIT_FIELD_REF extract.

	* gcc.dg/pr70022.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/pr70022.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Jakub Jelinek 2016-03-02 13:11:54 UTC
Author: jakub
Date: Wed Mar  2 13:11:21 2016
New Revision: 233905

URL: https://gcc.gnu.org/viewcvs?rev=233905&root=gcc&view=rev
Log:
	PR c/68062
	* c-c++-common/vector-compare-4.c: Add -Wno-psabi to dg-options.

	PR middle-end/70022
	* gcc.dg/pr70022.c: Add -w -Wno-psabi to dg-options.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/vector-compare-4.c
    trunk/gcc/testsuite/gcc.dg/pr70022.c
Comment 5 Richard Biener 2016-04-06 07:51:51 UTC
Author: rguenth
Date: Wed Apr  6 07:51:19 2016
New Revision: 234773

URL: https://gcc.gnu.org/viewcvs?rev=234773&root=gcc&view=rev
Log:
2016-04-06  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2016-03-01  Richard Biener  <rguenther@suse.de>

	PR middle-end/70022
	* fold-const.c (fold_indirect_ref_1): Fix range checking for
	vector BIT_FIELD_REF extract.

	* gcc.dg/pr70022.c: New testcase.

	2016-03-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/70115
	* tree-ssa-loop-ivcanon.c (propagate_into_all_uses): Remove.
	(propagate_constants_for_unrolling): Use replace_uses_by.

	* gcc.dg/torture/pr70115.c: New testcase.

	2016-03-29  Richard Biener  <rguenther@suse.de>

	PR middle-end/70424
	* ipa-prop.c (ipa_compute_jump_functions_for_edge): Always
	use alignment returned by get_pointer_alignment_1 if it is
	bigger than BITS_PER_UNIT.
	* builtins.c (get_pointer_alignment_1): Do not return true
	for alignment extracted from SSA info.

Added:
    branches/gcc-5-branch/gcc/testsuite/gcc.dg/pr70022.c
    branches/gcc-5-branch/gcc/testsuite/gcc.dg/torture/pr70115.c
Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/builtins.c
    branches/gcc-5-branch/gcc/ipa-prop.c
    branches/gcc-5-branch/gcc/testsuite/ChangeLog
    branches/gcc-5-branch/gcc/tree-ssa-loop-ivcanon.c
Comment 6 Richard Biener 2016-07-07 11:46:18 UTC
Fixed.
Comment 7 Richard Biener 2016-07-07 11:46:40 UTC
Author: rguenth
Date: Thu Jul  7 11:46:08 2016
New Revision: 238087

URL: https://gcc.gnu.org/viewcvs?rev=238087&root=gcc&view=rev
Log:
2016-07-07  Richard Biener  <rguenther@suse.de>

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

	PR rtl-optimization/70484
	* rtl.h (canon_output_dependence): Declare.
	* alias.c (canon_output_dependence): New function.
	* dse.c (record_store): Use canon_output_dependence rather
	than canon_true_dependence.

	* gcc.dg/torture/pr70484.c: New testcase.

	2016-06-08  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/71452
	* tree-ssa.c (non_rewritable_lvalue_p): Make sure that the
	type used for the SSA rewrite has enough precision to cover
	the dynamic type of the location.

	* gcc.dg/torture/pr71452.c: New testcase.

	2016-05-06  Richard Biener  <rguenther@suse.de>

	PR middle-end/70931
	* dwarf2out.c (native_encode_initializer): Skip zero-sized fields.

	* gfortran.dg/pr70931.f90: New testcase.

	2016-03-01  Richard Biener  <rguenther@suse.de>

	PR middle-end/70022
	* fold-const.c (fold_indirect_ref_1): Fix range checking for
	vector BIT_FIELD_REF extract.

	* gcc.dg/pr70022.c: New testcase.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/torture/pr71452.C
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr70022.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr70484.c
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/torture/pr71452.c
    branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/pr70931.f90
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/alias.c
    branches/gcc-4_9-branch/gcc/dse.c
    branches/gcc-4_9-branch/gcc/dwarf2out.c
    branches/gcc-4_9-branch/gcc/fold-const.c
    branches/gcc-4_9-branch/gcc/rtl.h
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/tree-ssa.c
Comment 8 Jakub Jelinek 2016-07-07 21:44:43 UTC
Author: jakub
Date: Thu Jul  7 21:44:11 2016
New Revision: 238133

URL: https://gcc.gnu.org/viewcvs?rev=238133&root=gcc&view=rev
Log:
	Backported from mainline
	2016-03-02  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/70022
	* gcc.dg/pr70022.c: Add -w -Wno-psabi to dg-options.

Modified:
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_9-branch/gcc/testsuite/gcc.dg/pr70022.c
Comment 9 Martin Liška 2017-02-14 10:46:16 UTC
Author: marxin
Date: Tue Feb 14 10:45:31 2017
New Revision: 245426

URL: https://gcc.gnu.org/viewcvs?rev=245426&root=gcc&view=rev
Log:
2016-03-01  Richard Biener  <rguenther@suse.de>

2017-02-14  Martin Liska  <mliska@suse.cz>

	Backport from mainline
	2016-03-01  Richard Biener  <rguenther@suse.de>

	PR middle-end/70022
	PR target/79498
	* fold-const.c (fold_indirect_ref_1): Fix range checking for
	vector BIT_FIELD_REF extract.

Modified:
    branches/gcc-5-branch/gcc/ChangeLog
    branches/gcc-5-branch/gcc/fold-const.c