public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
@ 2010-11-21  1:36 zsojka at seznam dot cz
  2010-11-21  7:32 ` [Bug rtl-optimization/46585] " hjl.tools at gmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: zsojka at seznam dot cz @ 2010-11-21  1:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

           Summary: [4.6 Regression] ICE: SIGSEGV in vinsn_create
                    (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns
                    -fselective-scheduling
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz
              Host: x86_64-pc-linux-gnu
            Target: x86_64-pc-linux-gnu


Created attachment 22473
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22473
reduced testcase

Compiler output:
$ gcc -fno-dce -fschedule-insns -fselective-scheduling testcase.c
==3603== Invalid read of size 1
==3603==    at 0x8539FE: vinsn_create (sel-sched-ir.c:1189)
==3603==    by 0x854303: init_global_and_expr_for_insn (sel-sched-ir.c:2907)
==3603==    by 0xFBE824: init_insns_in_bb.isra.10 (haifa-sched.c:5329)
==3603==    by 0xFCC0B7: sched_scan (haifa-sched.c:5376)
==3603==    by 0x8570A8: sel_init_global_and_expr (sel-sched-ir.c:2929)
==3603==    by 0x87A1B6: sel_sched_region (sel-sched.c:6864)
==3603==    by 0x87BF71: run_selective_scheduling (sel-sched.c:7651)
==3603==    by 0x84A85C: rest_of_handle_sched (sched-rgn.c:3508)
==3603==    by 0x7C094E: execute_one_pass (passes.c:1564)
==3603==    by 0x7C0C14: execute_pass_list (passes.c:1619)
==3603==    by 0x7C0C26: execute_pass_list (passes.c:1620)
==3603==    by 0x905065: tree_rest_of_compilation (tree-optimize.c:422)
==3603==  Address 0x2 is not stack'd, malloc'd or (recently) free'd
==3603== 
testcase.c: In function 'foo':
testcase.c:9:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r166976 - crash
r161659 - crash
r159696 - OK
4.5 r166509 - OK


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
@ 2010-11-21  7:32 ` hjl.tools at gmail dot com
  2010-11-22 10:46 ` jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: hjl.tools at gmail dot com @ 2010-11-21  7:32 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2010.11.21 02:55:16
                 CC|                            |jakub at redhat dot com
   Target Milestone|---                         |4.6.0
     Ever Confirmed|0                           |1

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2010-11-21 02:55:16 UTC ---
It is caused by revision 160219:

http://gcc.gnu.org/ml/gcc-cvs/2010-06/msg00132.html


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
  2010-11-21  7:32 ` [Bug rtl-optimization/46585] " hjl.tools at gmail dot com
@ 2010-11-22 10:46 ` jakub at gcc dot gnu.org
  2010-11-22 13:55 ` amonakov at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-22 10:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot
                   |                            |gnu.org, jakub at gcc dot
                   |                            |gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-22 10:43:01 UTC ---
This is a bug in sel-sched, which is upset about a nop insn:
(insn 8 3 9 2 (const_int 0 [0]) pr46585.c:7 638 {nop}
     (nil))

(nops exist in -O0 code mainly to carry through location information; of course
scheduling of -O0 code doesn't make any sense, but unfortunately we allow it).

I'm not familiar enough with sel-sched to find out whether it would be best not
to mark nops as SETs (and thus clonable), or just vinsn_init shouldn't instead
of
if (VINSN_SEPARABLE_P (vi))
use
if (VINSN_SEPARABLE_P (vi) && VINSN_RHS (vi))
but I guess the former.


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
  2010-11-21  7:32 ` [Bug rtl-optimization/46585] " hjl.tools at gmail dot com
  2010-11-22 10:46 ` jakub at gcc dot gnu.org
@ 2010-11-22 13:55 ` amonakov at gcc dot gnu.org
  2010-11-24 14:34 ` amonakov at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amonakov at gcc dot gnu.org @ 2010-11-22 13:55 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |amonakov at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-11-22 13:30:14 UTC ---
Investigating


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
                   ` (2 preceding siblings ...)
  2010-11-22 13:55 ` amonakov at gcc dot gnu.org
@ 2010-11-24 14:34 ` amonakov at gcc dot gnu.org
  2010-11-24 14:39 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amonakov at gcc dot gnu.org @ 2010-11-24 14:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-11-24 14:19:09 UTC ---
sel-sched doesn't expect to see nops in the function, and uses them internally
as markers in place of recently removed insns;  luckily, we can easily switch
to some other pattern, and even use an unrecognizable pattern this time
(const_int -1)

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 71c02c4..e6e8d44 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -942,6 +942,7 @@ get_clear_regset_from_pool (void)
 void
 return_regset_to_pool (regset rs)
 {
+  gcc_assert (rs);
   regset_pool.diff--;

   if (regset_pool.n == regset_pool.s)
@@ -1175,6 +1176,9 @@ vinsn_init (vinsn_t vi, insn_t insn, bool force_unique_p)
   VINSN_COUNT (vi) = 0;
   vi->cost = -1;

+  if (INSN_NOP_P (insn))
+    return;
+
   if (DF_INSN_UID_SAFE_GET (INSN_UID (insn)) != NULL)
     init_id_from_df (VINSN_ID (vi), insn, force_unique_p);
   else
@@ -1256,9 +1260,12 @@ vinsn_delete (vinsn_t vi)
 {
   gcc_assert (VINSN_COUNT (vi) == 0);

-  return_regset_to_pool (VINSN_REG_SETS (vi));
-  return_regset_to_pool (VINSN_REG_USES (vi));
-  return_regset_to_pool (VINSN_REG_CLOBBERS (vi));
+  if (!INSN_NOP_P (VINSN_INSN_RTX (vi)))
+    {
+      return_regset_to_pool (VINSN_REG_SETS (vi));
+      return_regset_to_pool (VINSN_REG_USES (vi));
+      return_regset_to_pool (VINSN_REG_CLOBBERS (vi));
+    }

   free (vi);
 }
@@ -5606,7 +5614,7 @@ setup_nop_and_exit_insns (void)
   gcc_assert (nop_pattern == NULL_RTX
           && exit_insn == NULL_RTX);

-  nop_pattern = gen_nop ();
+  nop_pattern = gen_rtx_CONST_INT (VOIDmode, -1);

   start_sequence ();
   emit_insn (nop_pattern);


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
                   ` (3 preceding siblings ...)
  2010-11-24 14:34 ` amonakov at gcc dot gnu.org
@ 2010-11-24 14:39 ` jakub at gcc dot gnu.org
  2010-11-24 14:53 ` amonakov at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2010-11-24 14:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2010-11-24 14:29:07 UTC ---
+  nop_pattern = gen_rtx_CONST_INT (VOIDmode, -1);

You could just use
  nop_pattern = constm1_rtx;
or just #define nop_pattern constm1_rtx

But, when you change nop_pattern, then INSN_NOP_P () won't match normal nops,
just your new ones.  Is that desirable?

Perhaps you want instead to define INSN_NOP_P as CONST_INT_P (PATTERN (X))
(at least, where you want to match any nops, including your special ones, where
you want to match just your special ones, PATTERN (X) == nop_pattern is
correct.


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
                   ` (4 preceding siblings ...)
  2010-11-24 14:39 ` jakub at gcc dot gnu.org
@ 2010-11-24 14:53 ` amonakov at gcc dot gnu.org
  2010-11-25  9:59 ` amonakov at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amonakov at gcc dot gnu.org @ 2010-11-24 14:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

--- Comment #6 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-11-24 14:38:47 UTC ---
(In reply to comment #5)
> +  nop_pattern = gen_rtx_CONST_INT (VOIDmode, -1);
> 
> You could just use
>   nop_pattern = constm1_rtx;
> or just #define nop_pattern constm1_rtx

Thanks.

> But, when you change nop_pattern, then INSN_NOP_P () won't match normal nops,
> just your new ones.  Is that desirable?

Yes, that's exactly what we need, because "nops" are used as special markers. 
I don't think normal nops are any different to other normal insns from the
scheduler POV; therefore, there's no need to match normal nops.

However, the name INSN_NOP_P does not have anything to do with the real pattern
after this patch ;)

> Perhaps you want instead to define INSN_NOP_P as CONST_INT_P (PATTERN (X))
> (at least, where you want to match any nops, including your special ones, where
> you want to match just your special ones, PATTERN (X) == nop_pattern is
> correct.

Per the above, no, we don't have a need for that.


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
                   ` (5 preceding siblings ...)
  2010-11-24 14:53 ` amonakov at gcc dot gnu.org
@ 2010-11-25  9:59 ` amonakov at gcc dot gnu.org
  2010-11-25 10:17 ` amonakov at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: amonakov at gcc dot gnu.org @ 2010-11-25  9:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

--- Comment #7 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-11-25 09:42:35 UTC ---
*** Bug 46649 has been marked as a duplicate of this bug. ***


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
                   ` (6 preceding siblings ...)
  2010-11-25  9:59 ` amonakov at gcc dot gnu.org
@ 2010-11-25 10:17 ` amonakov at gcc dot gnu.org
  2010-11-25 10:49 ` amonakov at gcc dot gnu.org
  2011-04-07  6:57 ` abel at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: amonakov at gcc dot gnu.org @ 2010-11-25 10:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

--- Comment #8 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-11-25 10:05:08 UTC ---
Author: amonakov
Date: Thu Nov 25 10:05:00 2010
New Revision: 167141

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=167141
Log:
    PR rtl-optimization/46585
    * sel-sched-ir.c (return_regset_to_pool): Verify that RS is not NULL.
    (vinsn_init): Skip initialization of dependencies for local NOPs.
    (vinsn_delete): Don't try to free regsets for local NOPs.
        (setup_nop_and_exit_insns): Change definition of nop_pattern.

testsuite:
    * gcc.dg/pr46585.c: New.


Added:
    trunk/gcc/testsuite/gcc.dg/pr46585.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/sel-sched-ir.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
                   ` (7 preceding siblings ...)
  2010-11-25 10:17 ` amonakov at gcc dot gnu.org
@ 2010-11-25 10:49 ` amonakov at gcc dot gnu.org
  2011-04-07  6:57 ` abel at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: amonakov at gcc dot gnu.org @ 2010-11-25 10:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

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

--- Comment #9 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-11-25 10:08:35 UTC ---
Fixed.


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

* [Bug rtl-optimization/46585] [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling
  2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
                   ` (8 preceding siblings ...)
  2010-11-25 10:49 ` amonakov at gcc dot gnu.org
@ 2011-04-07  6:57 ` abel at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: abel at gcc dot gnu.org @ 2011-04-07  6:57 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46585

--- Comment #10 from Andrey Belevantsev <abel at gcc dot gnu.org> 2011-04-07 06:56:50 UTC ---
Author: abel
Date: Thu Apr  7 06:56:47 2011
New Revision: 172082

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=172082
Log:
        Backport from mainline
        2010-11-25  Alexander Monakov  <amonakov@ispras.ru>

        PR rtl-optimization/46585
        * sel-sched-ir.c (return_regset_to_pool): Verify that RS is not NULL.
        (vinsn_init): Skip computation of dependencies for local NOPs.
        (vinsn_delete): Don't try to free regsets for local NOPs.
        (setup_nop_and_exit_insns): Change definition of nop_pattern.


Added:
    branches/gcc-4_5-branch/gcc/testsuite/gcc.dg/pr46585.c
Modified:
    branches/gcc-4_5-branch/gcc/ChangeLog
    branches/gcc-4_5-branch/gcc/sel-sched-ir.c
    branches/gcc-4_5-branch/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2011-04-07  6:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-21  1:36 [Bug rtl-optimization/46585] New: [4.6 Regression] ICE: SIGSEGV in vinsn_create (sel-sched-ir.c:1189) with -fno-dce -fschedule-insns -fselective-scheduling zsojka at seznam dot cz
2010-11-21  7:32 ` [Bug rtl-optimization/46585] " hjl.tools at gmail dot com
2010-11-22 10:46 ` jakub at gcc dot gnu.org
2010-11-22 13:55 ` amonakov at gcc dot gnu.org
2010-11-24 14:34 ` amonakov at gcc dot gnu.org
2010-11-24 14:39 ` jakub at gcc dot gnu.org
2010-11-24 14:53 ` amonakov at gcc dot gnu.org
2010-11-25  9:59 ` amonakov at gcc dot gnu.org
2010-11-25 10:17 ` amonakov at gcc dot gnu.org
2010-11-25 10:49 ` amonakov at gcc dot gnu.org
2011-04-07  6:57 ` abel 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).