Bug 89655 - GCC crashes building linux kernel for arm 32-bit (culprit r269453)
Summary: GCC crashes building linux kernel for arm 32-bit (culprit r269453)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks: 89595
  Show dependency treegraph
 
Reported: 2019-03-11 11:32 UTC by Maxim Kuvyrkov
Modified: 2019-05-06 12:40 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Reproducer tarball (491.06 KB, application/x-xz)
2019-03-11 11:32 UTC, Maxim Kuvyrkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maxim Kuvyrkov 2019-03-11 11:32:07 UTC
Created attachment 45933 [details]
Reproducer tarball

After r269453 GCC ICEs when building linux kernel for AArch32 in allmodconfig and allyesconfig kernel configurations.

I've reduced the crash down to a single preprocessed file, but could not eliminate all kernel plugins -- one plugin is still left.

The attached tarball has preprocessed source, binary plugin and GCC's configuration string.

Culprit:
<cut>
commit 791a496442cb02f7ab6b50e291e1f0669e09e99d
Author: rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Mar 7 12:46:44 2019 +0000

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

   	PR tree-optimization/89595
   	* tree-ssa-dom.c (dom_opt_dom_walker::optimize_stmt): Take
   	stmt iterator as reference, take boolean output parameter to
   	indicate whether the stmt was removed and thus the iterator
   	already advanced.
   	(dom_opt_dom_walker::before_dom_children): Re-iterate over
   	stmts created by folding.

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


   git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@269453 138bc75d-0d04-0410-961f-82ee72b054a4
</cut>

Reproduction instructions from Linaro TCWG's automated bisections (just in case):
Reproduce builds:
<cut>
mkdir investigate-gcc-791a496442cb02f7ab6b50e291e1f0669e09e99d
cd investigate-gcc-791a496442cb02f7ab6b50e291e1f0669e09e99d

git clone https://git.linaro.org/toolchain/jenkins-scripts

mkdir -p artifacts/manifests
curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_kernel-bisect-gnu-master-arm-lts-allyesconfig/11/artifact/artifacts/manifests/build-baseline.sh
curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_kernel-bisect-gnu-master-arm-lts-allyesconfig/11/artifact/artifacts/manifests/build-parameters.sh
curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_kernel-bisect-gnu-master-arm-lts-allyesconfig/11/artifact/artifacts/test.sh
chmod +x artifacts/test.sh

# Reproduce the baseline build (build all pre-requisites)
./jenkins-scripts/tcwg_kernel-build.sh @@ artifacts/manifests/build-baseline.sh

cd gcc

# Reproduce first_bad build
git checkout --detach 791a496442cb02f7ab6b50e291e1f0669e09e99d
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach 02a7fc594d3a0b1f2b2fc8d5fd8ea425ff45d418
../artifacts/test.sh

cd ..
</cut>
Comment 1 Maxim Kuvyrkov 2019-03-11 11:33:13 UTC
Hi Richi,

Would you please investigate?  Ping me on IRC (maximk) if you have problems with reproducing the ICE.
Comment 2 Richard Biener 2019-03-11 11:47:05 UTC
Can you provide the GCC ICE backtrace?  I suspect it's the same thing Jakub sees.
Comment 3 Maxim Kuvyrkov 2019-03-11 11:56:23 UTC
ICE backtrace:
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_ATTRIBUTES                | latent_entropy_plugin
PLUGIN_START_UNIT                | latent_entropy_plugin
during GIMPLE pass: vrp
net/6lowpan/nhc.c: In function  lowpan_nhc_do_uncompression :
net/6lowpan/nhc.c:157:5: internal compiler error: in min_value, at wide-int.cc:332
0xf4e9ee wi::min_value(unsigned int, signop)
	/home/maxim.kuvyrkov/tcwg_kernel-gnu/abe/snapshots/gcc.git~master/gcc/wide-int.cc:332
0xe33c2c set_range_info(tree_node*, value_range_kind, generic_wide_int<wide_int_ref_storage<false, true> > const&, generic_wide_int<wide_int_ref_storage<false, true> > const&)
	/home/maxim.kuvyrkov/tcwg_kernel-gnu/abe/snapshots/gcc.git~master/gcc/tree-ssanames.c:384
0xe34056 set_range_info(tree_node*, value_range_base const&)
	/home/maxim.kuvyrkov/tcwg_kernel-gnu/abe/snapshots/gcc.git~master/gcc/tree-ssanames.c:408
0xeacb5a vrp_prop::vrp_finalize(bool)
	/home/maxim.kuvyrkov/tcwg_kernel-gnu/abe/snapshots/gcc.git~master/gcc/tree-vrp.c:6692
0xebda8e execute_vrp
	/home/maxim.kuvyrkov/tcwg_kernel-gnu/abe/snapshots/gcc.git~master/gcc/tree-vrp.c:6780
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Comment 4 David Binderman 2019-03-11 12:21:43 UTC
I can seen a similar ice when using -O3 on x86_64. It seems to go wrong 
between revisions 269450 and 269500. 

I've got a single file that demonstrates the problem.
Reducing now.
Comment 5 David Binderman 2019-03-11 12:29:12 UTC
a, b, d;
char *c;
e() {
  int f = a;
  for (;;) {
    f = 0;
    for (; f < (a > 3 ?: a); f++)
      b = c[f] ? c[(f + 2 > a - 1 ? a - 1 : 2) * d] : 0;
  }
}

$ ~/gcc/results/bin/gcc -c -O3 -w bug509.c
during GIMPLE pass: vrp
bug509.c: In function ‘e’:
bug509.c:3:1: internal compiler error: in min_value, at wide-int.cc:332
    3 | e() {
      | ^
0x75094c wi::min_value(unsigned int, signop)
	../../trunk/gcc/wide-int.cc:332
0x109bdeb set_range_info(tree_node*, value_range_kind, generic_wide_int<wide_int_ref_storage<false, true> > const&, generic_wide_int<wide_int_ref_storage<false, true> > const&)
	../../trunk/gcc/tree-ssanames.c:384
0x109c2ea set_range_info(tree_node*, value_range_base const&)
	../../trunk/gcc/tree-ssanames.c:408
0x1123bf2 vrp_prop::vrp_finalize(bool)
	../../trunk/gcc/tree-vrp.c:6692
0x1130844 execute_vrp
	../../trunk/gcc/tree-vrp.c:6780
Comment 6 Maxim Kuvyrkov 2019-03-11 12:40:52 UTC
Jakub's patch in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89656 fixes ICE on linux kernel for arm.
Comment 7 Jakub Jelinek 2019-03-11 21:59:14 UTC
Author: jakub
Date: Mon Mar 11 21:58:43 2019
New Revision: 269597

URL: https://gcc.gnu.org/viewcvs?rev=269597&root=gcc&view=rev
Log:
	PR middle-end/89655
	PR bootstrap/89656
	* vr-values.c (vr_values::update_value_range): If
	old_vr->varying_p (), don't update it, make new_vr also VARYING
	and return false.

	* gcc.c-torture/compile/pr89655.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr89655.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/vr-values.c
Comment 8 Jakub Jelinek 2019-03-11 22:55:44 UTC
Fixed.
Comment 9 Richard Biener 2019-05-06 12:40:50 UTC
Author: rguenth
Date: Mon May  6 12:40:18 2019
New Revision: 270907

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

	PR bootstrap/90359
	Backport from mainline
	2019-03-11  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/89655
	PR bootstrap/89656
	* vr-values.c (vr_values::update_value_range): If
	old_vr->varying_p (), don't update it, make new_vr also VARYING
	and return false.

	* gcc.c-torture/compile/pr89655.c: New test.

Added:
    branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/compile/pr89655.c
Modified:
    branches/gcc-8-branch/gcc/ChangeLog
    branches/gcc-8-branch/gcc/testsuite/ChangeLog
    branches/gcc-8-branch/gcc/vr-values.c