public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
@ 2020-11-10 11:06 zsojka at seznam dot cz
  2020-11-12 18:14 ` [Bug rtl-optimization/97777] " ubizjak at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: zsojka at seznam dot cz @ 2020-11-10 11:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

            Bug ID: 97777
           Summary: ICE: in df_refs_verify, at df-scan.c:3991 with -O
                    -ffinite-math-only -fzero-call-used-regs=all
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu

Created attachment 49537
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49537&action=edit
reduced testcase

The compiler is configured with --enable-checking=yes,rtl,df,extra

Compiler output:
$ x86_64-pc-linux-gnu-gcc -O -ffinite-math-only -fzero-call-used-regs=all
testcase.c
during RTL pass: zero_call_used_regs
testcase.c: In function 'foo':
testcase.c:5:1: internal compiler error: in df_refs_verify, at df-scan.c:3991
    5 | }
      | ^
0x63bf73 df_refs_verify
        /repo/gcc-trunk/gcc/df-scan.c:3991
0xbd44a6 df_insn_refs_verify
        /repo/gcc-trunk/gcc/df-scan.c:4074
0xbd644c df_bb_verify
        /repo/gcc-trunk/gcc/df-scan.c:4107
0xbd6807 df_scan_verify()
        /repo/gcc-trunk/gcc/df-scan.c:4228
0xbc0757 df_verify()
        /repo/gcc-trunk/gcc/df-core.c:1818
0xbc0757 df_analyze_1
        /repo/gcc-trunk/gcc/df-core.c:1214
0xce77ec execute
        /repo/gcc-trunk/gcc/function.c:6656
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.

$ 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-r11-4863-20201110102300-gfb54c3032b8-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/11.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
--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-r11-4863-20201110102300-gfb54c3032b8-checking-yes-rtl-df-extra-amd64
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.0.0 20201110 (experimental) (GCC)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/97777] ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
  2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
@ 2020-11-12 18:14 ` ubizjak at gmail dot com
  2020-11-12 20:52 ` qinzhao at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ubizjak at gmail dot com @ 2020-11-12 18:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

Uroš Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qing.zhao at oracle dot com
   Last reconfirmed|                            |2020-11-12
             Status|UNCONFIRMED                 |NEW
   Target Milestone|---                         |11.0
     Ever confirmed|0                           |1

--- Comment #1 from Uroš Bizjak <ubizjak at gmail dot com> ---
Confirmed (compiler must be configured with checking enabled).

CC author.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/97777] ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
  2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
  2020-11-12 18:14 ` [Bug rtl-optimization/97777] " ubizjak at gmail dot com
@ 2020-11-12 20:52 ` qinzhao at gcc dot gnu.org
  2020-11-12 22:17 ` qinzhao at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-11-12 20:52 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

qinzhao at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |qinzhao at gcc dot gnu.org

--- Comment #2 from qinzhao at gcc dot gnu.org ---
when configured the gcc with --enable-checking=df, I can repeat the failure.
will check what's wrong with the data flow information.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/97777] ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
  2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
  2020-11-12 18:14 ` [Bug rtl-optimization/97777] " ubizjak at gmail dot com
  2020-11-12 20:52 ` qinzhao at gcc dot gnu.org
@ 2020-11-12 22:17 ` qinzhao at gcc dot gnu.org
  2020-11-16 16:37 ` qinzhao at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-11-12 22:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

--- Comment #3 from qinzhao at gcc dot gnu.org ---
This does not look like a bug in the new -fzero-call-used-regs implemenation.

it's more likely an existing bug in data flow analysis. 

I made the following change in gcc/function.c to make the new pass to do
nothing except a df_analyze:

qinzhao@gcc10:~/Work/write_gcc/gcc$ git diff function.c
diff --git a/gcc/function.c b/gcc/function.c
index 004fa389207..658b08ae215 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -6658,13 +6658,14 @@ pass_zero_call_used_regs::execute (function *fun)
   /* Iterate over the function's return instructions and insert any
      register zeroing required by the -fzero-call-used-regs command-line
      option or the "zero_call_used_regs" function attribute.  */
+#if 0
   FOR_EACH_EDGE (e, ei, EXIT_BLOCK_PTR_FOR_FN (cfun)->preds)
     {
       rtx_insn *insn = BB_END (e->src);
       if (JUMP_P (insn) && ANY_RETURN_P (JUMP_LABEL (insn)))
        gen_call_used_regs_seq (insn, zero_regs_type);
     }
-
+#endif
   return 0;
 }

with this gcc, the exactly same ICE still there.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/97777] ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
  2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2020-11-12 22:17 ` qinzhao at gcc dot gnu.org
@ 2020-11-16 16:37 ` qinzhao at gcc dot gnu.org
  2020-11-16 21:13 ` qinzhao at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-11-16 16:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

--- Comment #4 from qinzhao at gcc dot gnu.org ---
this should be a bug in the pass "stack".
if I modify the file "reg-stack.c" as following:
qinzhao@gcc10:~/Work/write_gcc/gcc$ git diff reg-stack.c
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 8f98bd85750..3d6519c95c9 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3428,6 +3428,7 @@ rest_of_handle_stack_regs (void)
 #ifdef STACK_REGS
   reg_to_stack ();
   regstack_completed = 1;
+  df_analyze ();
 #endif
   return 0;
 }

the testing case will core dump at:
t.c: In function ‘foo’:
t.c:5:1: internal compiler error: in df_refs_verify, at df-scan.c:3991
    5 | }
      | ^
0xc3e634 df_refs_verify
        ../../write_gcc/gcc/df-scan.c:3991
0xc3e8a5 df_insn_refs_verify
        ../../write_gcc/gcc/df-scan.c:4075
0xc3ea83 df_bb_verify
        ../../write_gcc/gcc/df-scan.c:4107
0xc3f046 df_scan_verify()
        ../../write_gcc/gcc/df-scan.c:4228
0xc2576c df_verify()
        ../../write_gcc/gcc/df-core.c:1818
0xc23fdd df_analyze_1
        ../../write_gcc/gcc/df-core.c:1214
0xc2439e df_analyze()
        ../../write_gcc/gcc/df-core.c:1290
0x115d581 rest_of_handle_stack_regs
        ../../write_gcc/gcc/reg-stack.c:3431
0x115d5d2 execute
        ../../write_gcc/gcc/reg-stack.c:3461

looks like that the pass reg stack does not maintain the df information
correctly during its transformation.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/97777] ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
  2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2020-11-16 16:37 ` qinzhao at gcc dot gnu.org
@ 2020-11-16 21:13 ` qinzhao at gcc dot gnu.org
  2020-12-02 22:48 ` cvs-commit at gcc dot gnu.org
  2020-12-02 22:49 ` qinzhao at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-11-16 21:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

--- Comment #5 from qinzhao at gcc dot gnu.org ---
the following patch in reg-stack.c fixed the failure:

qinzhao@gcc10:~/Work/write_gcc/gcc$ git diff reg-stack.c
diff --git a/gcc/reg-stack.c b/gcc/reg-stack.c
index 8f98bd85750..3dab843f803 100644
--- a/gcc/reg-stack.c
+++ b/gcc/reg-stack.c
@@ -3426,7 +3426,8 @@ static unsigned int
 rest_of_handle_stack_regs (void)
 {
 #ifdef STACK_REGS
-  reg_to_stack ();
+  if (reg_to_stack ())
+    df_insn_rescan_all ();
   regstack_completed = 1;
 #endif
   return 0;

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/97777] ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
  2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2020-11-16 21:13 ` qinzhao at gcc dot gnu.org
@ 2020-12-02 22:48 ` cvs-commit at gcc dot gnu.org
  2020-12-02 22:49 ` qinzhao at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-02 22:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Qing Zhao <qinzhao@gcc.gnu.org>:

https://gcc.gnu.org/g:2cace1cd683318e83e8a613f1aa2f2b16e37a342

commit r11-5684-g2cace1cd683318e83e8a613f1aa2f2b16e37a342
Author: qing zhao <qinzhao@gcc.gnu.org>
Date:   Wed Dec 2 23:48:02 2020 +0100

    rtl-optimization: Fix data flow maintenance bug in reg-stack.c [pr97777]

    reg-stack pass does not maintain the data flow information correctly.
    call df_insn_rescan_all after the transformation is done.

            gcc/
            PR rtl-optimization/97777
            * reg-stack.c (rest_of_handle_stack_regs): call
            df_insn_rescan_all if reg_to_stack return true.

            gcc/testsuite/
            PR rtl-optimization/97777
            * gcc.target/i386/pr97777.c: New test.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug rtl-optimization/97777] ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all
  2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2020-12-02 22:48 ` cvs-commit at gcc dot gnu.org
@ 2020-12-02 22:49 ` qinzhao at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: qinzhao at gcc dot gnu.org @ 2020-12-02 22:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97777

qinzhao at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #7 from qinzhao at gcc dot gnu.org ---
fixed in gcc11

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-12-02 22:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 11:06 [Bug rtl-optimization/97777] New: ICE: in df_refs_verify, at df-scan.c:3991 with -O -ffinite-math-only -fzero-call-used-regs=all zsojka at seznam dot cz
2020-11-12 18:14 ` [Bug rtl-optimization/97777] " ubizjak at gmail dot com
2020-11-12 20:52 ` qinzhao at gcc dot gnu.org
2020-11-12 22:17 ` qinzhao at gcc dot gnu.org
2020-11-16 16:37 ` qinzhao at gcc dot gnu.org
2020-11-16 21:13 ` qinzhao at gcc dot gnu.org
2020-12-02 22:48 ` cvs-commit at gcc dot gnu.org
2020-12-02 22:49 ` qinzhao at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).