Bug 89656 - [9 Regression] profiledbootstrap failure on aarch64-linux since r269453
Summary: [9 Regression] profiledbootstrap failure on aarch64-linux since r269453
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 9.0
: P1 normal
Target Milestone: 9.0
Assignee: Jakub Jelinek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-11 11:59 UTC by Jakub Jelinek
Modified: 2019-05-06 12:40 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-03-11 00:00:00


Attachments
gcc9-pr89656.patch (485 bytes, patch)
2019-03-11 12:02 UTC, Jakub Jelinek
Details | Diff
gcc9-pr89656.patch (705 bytes, patch)
2019-03-11 12:49 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2019-03-11 11:59:32 UTC
aarch64-linux profiledbootstrap --enable-checking=release currently fails:
/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/./prev-gcc/xg++ -B/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/./prev-gcc/ -B/usr/aarch64-redhat-linux/bin/ -nostdinc++ -B/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/prev-aarch64-redhat-linux/libstdc++-v3/src/.libs -B/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/prev-aarch64-redhat-linux/libstdc++-v3/libsupc++/.libs  -I/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/prev-aarch64-redhat-linux/libstdc++-v3/include/aarch64-redhat-linux  -I/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/prev-aarch64-redhat-linux/libstdc++-v3/include  -I/builddir/build/BUILD/gcc-9.0.1-20190309/libstdc++-v3/libsupc++ -L/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/prev-aarch64-redhat-linux/libstdc++-v3/src/.libs -L/builddir/build/BUILD/gcc-9.0.1-20190309/obj-aarch64-redhat-linux/prev-aarch64-redhat-linux/libstdc++-v3/libsupc++/.libs -c   -O2 -g -Wall -Wformat-security -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fprofile-use -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -DGENERATOR_FILE -fno-PIE -I. -Ibuild -I../../gcc -I../../gcc/build -I../../gcc/../include  -I../../gcc/../libcpp/include  \
	-o build/genoutput.o ../../gcc/genoutput.c
virtual memory exhausted: Cannot allocate memory

The problem is that during dom when processing:
<bb 9> [count: 0]:
# p0_9 = PHI <""(93)>
# DEBUG p0 => ""
# DEBUG BEGIN_STMT
# DEBUG D#80 => MEM[(struct operand_data *)d_28(D) + 72B].predicate
# DEBUG p1 => D#80
# DEBUG BEGIN_STMT
# DEBUG p1 => pretmp_83
# DEBUG BEGIN_STMT
_81 = strcmp (p0_9, pretmp_83);
if (_81 != 0)
  goto <bb 20>; [42.83%]
else
  goto <bb 10>; [57.17%]
we fold_stmt
_81 = strcmp (p0_9, pretmp_83);
into
_17 = MEM[(const unsigned char * {ref-all})pretmp_83];
_167 = (int) _17;
_81 = -_167;
but vr_values has been constructed with num_vr_values of 167 and when we try to optimize_stmt the folded _167 = (int) _17, we first ask for value range of _167 and get:
  /* If we query the range for a new SSA name return an unmodifiable VARYING.
     We should get here at most from the substitute-and-fold stage which
     will never try to change values.  */
  if (ver >= num_vr_values)
    return CONST_CAST (value_range *, &vr_const_varying);
and then update_value_range to the [0, 255] range derived from the stmt.  That modifies the shared const vr_const_varying variable and all goes wrong from there.
Comment 1 Jakub Jelinek 2019-03-11 12:02:15 UTC
Created attachment 45935 [details]
gcc9-pr89656.patch

Untested fix.
Comment 2 Maxim Kuvyrkov 2019-03-11 12:41:44 UTC
Hi Jakub,

The above patch fixes ICE on building linux kernel for arm (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89655)
Comment 3 Jakub Jelinek 2019-03-11 12:49:16 UTC
Created attachment 45936 [details]
gcc9-pr89656.patch

Updated patch with the reduced testcase from PR89655.
Comment 4 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 5 Jakub Jelinek 2019-03-11 22:55:54 UTC
Fixed.
Comment 6 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