Bug 94286 - [10 Regression] ICE: in decompose, at rtl.h:2279 with __builtin_sub_overflow() at -O -g
Summary: [10 Regression] ICE: in decompose, at rtl.h:2279 with __builtin_sub_overflow(...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 10.0
: P3 normal
Target Milestone: 10.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-03-23 14:58 UTC by Zdenek Sojka
Modified: 2020-03-24 09:37 UTC (History)
1 user (show)

See Also:
Host: x86_64-pc-linux-gnu
Target: armv7a-hardfloat-linux-gnueabi
Build:
Known to work: 9.3.1
Known to fail: 10.0
Last reconfirmed: 2020-03-23 00:00:00


Attachments
reduced testcase (88 bytes, text/plain)
2020-03-23 14:58 UTC, Zdenek Sojka
Details
gcc10-pr94286.patch (648 bytes, patch)
2020-03-23 18:29 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2020-03-23 14:58:17 UTC
Created attachment 48091 [details]
reduced testcase

Compiler output:
$ armv7a-hardfloat-linux-gnueabi-gcc -O -g testcase.c 
during RTL pass: vartrack
testcase.c: In function 'foo':
testcase.c:7:1: internal compiler error: in decompose, at rtl.h:2279
    7 | }
      | ^
0x705186 neg_poly_int_rtx
        /repo/gcc-trunk/gcc/rtl.h:2279
0x10120f9 simplify_binary_operation_1
        /repo/gcc-trunk/gcc/simplify-rtx.c:2677
0x1013d05 simplify_binary_operation(rtx_code, machine_mode, rtx_def*, rtx_def*)
        /repo/gcc-trunk/gcc/simplify-rtx.c:2291
0x1013d78 simplify_gen_binary(rtx_code, machine_mode, rtx_def*, rtx_def*)
        /repo/gcc-trunk/gcc/simplify-rtx.c:189
0x1339eca reverse_op
        /repo/gcc-trunk/gcc/var-tracking.c:5942
0x1339eca add_stores
        /repo/gcc-trunk/gcc/var-tracking.c:6211
0xfcc887 note_pattern_stores(rtx_def const*, void (*)(rtx_def*, rtx_def const*, void*), void*)
        /repo/gcc-trunk/gcc/rtlanal.c:1940
0x1333759 add_with_sets
        /repo/gcc-trunk/gcc/var-tracking.c:6634
0xbc03ed cselib_record_sets
        /repo/gcc-trunk/gcc/cselib.c:2644
0xbc196a cselib_process_insn(rtx_insn*)
        /repo/gcc-trunk/gcc/cselib.c:2806
0x13403d8 vt_initialize
        /repo/gcc-trunk/gcc/var-tracking.c:10221
0x134b347 variable_tracking_main_1
        /repo/gcc-trunk/gcc/var-tracking.c:10450
0x134b347 variable_tracking_main()
        /repo/gcc-trunk/gcc/var-tracking.c:10503
0x134b347 execute
        /repo/gcc-trunk/gcc/var-tracking.c:10540
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.

$ armv7a-hardfloat-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-armv7a-hardfloat/bin/armv7a-hardfloat-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r10-7327-20200323085706-g2fa4b1ffd6e-checking-yes-rtl-df-extra-armv7a-hardfloat/bin/../libexec/gcc/armv7a-hardfloat-linux-gnueabi/10.0.1/lto-wrapper
Target: armv7a-hardfloat-linux-gnueabi
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --with-float=hard --with-fpu=vfpv4 --with-arch=armv7-a --with-sysroot=/usr/armv7a-hardfloat-linux-gnueabi --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=armv7a-hardfloat-linux-gnueabi --with-ld=/usr/bin/armv7a-hardfloat-linux-gnueabi-ld --with-as=/usr/bin/armv7a-hardfloat-linux-gnueabi-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r10-7327-20200323085706-g2fa4b1ffd6e-checking-yes-rtl-df-extra-armv7a-hardfloat
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 10.0.1 20200323 (experimental) (GCC)
Comment 1 Zdenek Sojka 2020-03-23 15:00:26 UTC
Maybe somehow related to PR89506 , which is fixed on trunk, but has a similar testcase.
Comment 2 Jakub Jelinek 2020-03-23 18:29:36 UTC
Created attachment 48098 [details]
gcc10-pr94286.patch

Untested fix.
Comment 3 Zdenek Sojka 2020-03-23 19:15:42 UTC
(In reply to Jakub Jelinek from comment #2)
> Created attachment 48098 [details]
> gcc10-pr94286.patch
> 
> Untested fix.

Thanks, it fixes the testcase for me.
Comment 4 GCC Commits 2020-03-24 09:29:57 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:596c90d35591589e0efddda65c81609fb422a986

commit r10-7352-g596c90d35591589e0efddda65c81609fb422a986
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Mar 24 10:28:58 2020 +0100

    arm: Fix arm {,u}subvdi4 and usubvsi4 expanders [PR94286]
    
    The following testcase ICEs, because these expanders will happily create
    a SImode 0x80000000 CONST_INT, which is not valid RTL, as CONST_INTs need to
    be sign extended from the mode precision to full HWI.
    
    2020-03-24  Jakub Jelinek  <jakub@redhat.com>
    
            PR target/94286
            * config/arm/arm.md (subvdi4, usubvsi4, usubvdi4): Use gen_int_mode
            instead of GEN_INT.
    
            * gcc.dg/pr94286.c: New test.
Comment 5 Jakub Jelinek 2020-03-24 09:37:21 UTC
Fixed.