Bug 100541 - [12 Regression] -fcompare-debug failure (length) with -O3 -fno-expensive-optimizations -fno-tree-dce -fno-tree-dominator-opts
Summary: [12 Regression] -fcompare-debug failure (length) with -O3 -fno-expensive-opti...
Status: RESOLVED DUPLICATE of bug 102764
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 12.0
: P3 normal
Target Milestone: 12.0
Assignee: Not yet assigned to anyone
URL:
Keywords: compare-debug-failure
Depends on:
Blocks:
 
Reported: 2021-05-11 19:40 UTC by Zdenek Sojka
Modified: 2022-03-02 09:41 UTC (History)
2 users (show)

See Also:
Host: x86_64-pc-linux-gnu
Target:
Build:
Known to work:
Known to fail: 12.0
Last reconfirmed:


Attachments
auto-reduced testcase (from OpenTTD sources) (145 bytes, text/plain)
2021-05-11 19:40 UTC, Zdenek Sojka
Details
another testcase (needs less compiler flags) (252 bytes, text/plain)
2021-05-18 07:01 UTC, Zdenek Sojka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2021-05-11 19:40:49 UTC
Created attachment 50793 [details]
auto-reduced testcase (from OpenTTD sources)

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O3 -fno-expensive-optimizations -fno-tree-dce -fno-tree-dominator-opts -fcompare-debug testcase.C -save-temps
x86_64-pc-linux-gnu-gcc: error: testcase.C: '-fcompare-debug' failure (length)
$ diff -u *.gkd
--- a-testcase.C.gkd    2021-05-11 21:38:59.070437639 +0200
+++ a-testcase.gk.C.gkd 2021-05-11 21:38:59.103770789 +0200
@@ -93,7 +93,7 @@
                 (mult:SI (mem/c:SI (symbol_ref:DI ("y") [flags 0x2]  <var_decl # y>) [ y+0 S4 A32])
                     (const_int -1431655765 [0xffffffffaaaaaaab])))
             (clobber (reg:CC 17 flags))
-        ])# {*mulsi3_1}
+        ]) "testcase.C":8:5# {*mulsi3_1}
      (expr_list:REG_UNUSED (reg:CC 17 flags)
         (nil)))
 (insn:TI # 0 0 7 (parallel [
@@ -101,7 +101,7 @@
                 (plus:SI (reg:SI 0 ax [113])
                     (const_int 715827882 [0x2aaaaaaa])))
             (clobber (reg:CC 17 flags))
-        ])# {*addsi_1}
+        ]) "testcase.C":8:5# {*addsi_1}
      (expr_list:REG_UNUSED (reg:CC 17 flags)
         (nil)))
 (insn:TI # 0 0 7 (set (reg:CC 17 flags)
@@ -163,7 +163,7 @@
                 (mult:SI (mem/c:SI (symbol_ref:DI ("y") [flags 0x2]  <var_decl # y>) [ y+0 S4 A32])
                     (const_int -1431655765 [0xffffffffaaaaaaab])))
             (clobber (reg:CC 17 flags))
-        ])# {*mulsi3_1}
+        ]) "testcase.C":17:1# {*mulsi3_1}
      (expr_list:REG_UNUSED (reg:CC 17 flags)
         (nil)))
 (insn:TI # 0 0 10 (parallel [
@@ -171,7 +171,7 @@
                 (plus:SI (reg:SI 0 ax [100])
                     (const_int 715827882 [0x2aaaaaaa])))
             (clobber (reg:CC 17 flags))
-        ])# {*addsi_1}
+        ]) "testcase.C":17:1# {*addsi_1}
      (expr_list:REG_UNUSED (reg:CC 17 flags)
         (nil)))
 (insn:TI # 0 0 10 (set (reg:CC 17 flags)

$ x86_64-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r12-727-20210511185432-g3e3fdf3d521-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --disable-bootstrap --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r12-727-20210511185432-g3e3fdf3d521-checking-yes-rtl-df-extra-nobootstrap-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210511 (experimental) (GCC)
Comment 1 Zdenek Sojka 2021-05-18 07:01:40 UTC
Created attachment 50833 [details]
another testcase (needs less compiler flags)

$ x86_64-pc-linux-gnu-gcc -O2 -fno-tree-dce -fno-tree-dominator-opts -fcompare-debug aircraft_cmd.ii -save-temps
x86_64-pc-linux-gnu-gcc: error: aircraft_cmd.ii: '-fcompare-debug' failure (length)
$ diff -u *gkd
--- a-aircraft_cmd.gk.ii.gkd    2021-05-18 08:56:42.271670788 +0200
+++ a-aircraft_cmd.ii.gkd       2021-05-18 08:56:42.191670787 +0200
@@ -65,7 +65,7 @@
                 (mult:HI (reg:HI 0 ax [orig:89 pretmp_31 ] [89])
                     (const_int -21845 [0xffffffffffffaaab])))
             (clobber (reg:CC 17 flags))
-        ]) "aircraft_cmd.ii":18:19# {*mulhi3_1}
+        ])# {*mulhi3_1}
      (expr_list:REG_UNUSED (reg:CC 17 flags)
         (nil)))
 (insn:TI # 0 0 4 (parallel [
@@ -73,7 +73,7 @@
                 (plus:HI (reg:HI 0 ax [101])
                     (const_int 10922 [0x2aaa])))
             (clobber (reg:CC 17 flags))
-        ]) "aircraft_cmd.ii":18:19# {*addhi_1}
+        ])# {*addhi_1}
      (expr_list:REG_UNUSED (reg:CC 17 flags)
         (nil)))
 (insn:TI # 0 0 4 (set (reg:CC 17 flags)
Comment 2 Jakub Jelinek 2022-03-01 15:43:11 UTC
Started with r12-630 and got fixed with
r12-4531-g972ee845f54839e9bd2e4611bb268d75440f3845
So this looks to be a dup of PR102764.
We might want to add the testcases into the testsuite though.

*** This bug has been marked as a duplicate of bug 102764 ***
Comment 3 Jakub Jelinek 2022-03-01 15:50:36 UTC
Note, the #c1 testcase started to fail also with r12-630 but went latent with r12-2591.
Comment 4 GCC Commits 2022-03-02 09:41:28 UTC
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:5f2e72db8c03c960d8330305c1e92986373198ca

commit r12-7446-g5f2e72db8c03c960d8330305c1e92986373198ca
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Mar 2 10:38:39 2022 +0100

    testsuite: Add testcases for already fixed PR [PR100541]
    
    These testcases started failing with r12-630 and one of them
    got fixed with r12-4531 (aka PR102764 fix and r12-4616 further
    improved the fix) and the other went latent in r12-2591 (i.e. threader
    changes) and I believe was fixed for real by the PR102764 fix too.
    
    2022-03-02  Jakub Jelinek  <jakub@redhat.com>
    
            PR debug/100541
            * g++.dg/opt/pr100541-1.C: New test.
            * g++.dg/opt/pr100541-2.C: New test.