public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/47612] New: RTL crash when cc0 setter moved away from cc0 user
@ 2011-02-04 20:31 ian at airs dot com
  2011-02-04 20:45 ` [Bug rtl-optimization/47612] " joel at gcc dot gnu.org
                   ` (23 more replies)
  0 siblings, 24 replies; 25+ messages in thread
From: ian at airs dot com @ 2011-02-04 20:31 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: RTL crash when cc0 setter moved away from cc0 user
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: ian@airs.com


Consider this C file:

extern void e (int) __attribute__ ((noreturn));
void
f (char *p, int a, int b, int c)
{
  int i, j;

  j = 0;
  for (i = 0; i < 10; ++i)
    {
      switch (a)
    {
    case 0:
      p[i] = 0;
      break;
    case 1:
      if (c == 1)
        {
          if (j < 0 | b <= j)
        e (0);
          p[j] = 0;
        }
      else
        {
          if (j < 0 | b <= j)
        e (0);
          p[j] = 0;
        }
      j++;
    }
    }
}

When I use a compiler built for the m68k-rtems4.11 target, the compiler crashes
when I compile this file with the options -O2 -mcpu=5206 -fwrapv.

/home/iant/gcc/m68k-rtems-objdir/./gcc/xgcc
-B/home/iant/gcc/m68k-rtems-objdir/./gcc/ -O2 -mcpu=5206 -S -fwrapv foo.c
foo.c: In function 'f':
foo.c:31:1: internal compiler error: in maybe_add_or_update_dep_1, at
sched-deps.c:845
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

I will describe what I think is happening, although I have not proved it.  The
crash occurs because try_head_merge_bb in cfgcleanup.c moves a CC0-setter away
from the CC0-user.  It finds a common sequence in two basic blocks--I believe
it is the finding of this common sequence which makes this test requires the
-mcpu=5206 -fwrapv options.  Finding the common sequence respects CC0
requirements.  However, it then calls can_move_insns_across.  That returns
false, because there is a register conflict--d0 is used by the predecessor
block and the common sequence.  However, can_move_insns_across also returns
move_upto, indicating which insns may be moved.  can_move_insns_across does not
check for cc0 when setting move_upto, and try_head_merge_bb doesn't check for
it when using move_upto.  The effect is that the cc0 setter is moved, leaving
the cc0 user behind.  This leads to the later crash.


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

end of thread, other threads:[~2013-04-12 16:18 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04 20:31 [Bug rtl-optimization/47612] New: RTL crash when cc0 setter moved away from cc0 user ian at airs dot com
2011-02-04 20:45 ` [Bug rtl-optimization/47612] " joel at gcc dot gnu.org
2011-02-04 20:59 ` pinskia at gcc dot gnu.org
2011-02-04 21:27 ` ian at airs dot com
2011-02-05 20:49 ` mikpe at it dot uu.se
2011-03-26 15:59 ` vincent.riviere at freesbee dot fr
2011-04-02 12:14 ` vincent.riviere at freesbee dot fr
2011-04-05 22:41 ` bernds at gcc dot gnu.org
2011-04-06 17:07 ` vincent.riviere at freesbee dot fr
2011-04-06 17:29 ` bernds at gcc dot gnu.org
2011-04-06 17:52 ` joel at gcc dot gnu.org
2011-04-07 11:45 ` joel at gcc dot gnu.org
2011-04-07 12:04 ` bernds at gcc dot gnu.org
2011-04-07 15:28 ` joel at gcc dot gnu.org
2011-04-07 15:36 ` bernds at gcc dot gnu.org
2011-04-07 15:44 ` joel at gcc dot gnu.org
2011-05-04 20:29 ` bernds at gcc dot gnu.org
2011-05-04 23:59 ` vincent.riviere at freesbee dot fr
2011-08-02  7:30 ` vincent.riviere at freesbee dot fr
2011-12-13 19:17 ` joel at gcc dot gnu.org
2011-12-13 19:47 ` mikpe at it dot uu.se
2011-12-13 23:06 ` [Bug rtl-optimization/47612] [4.6 regression] " ebotcazou at gcc dot gnu.org
2012-02-27 20:07 ` tg at mirbsd dot org
2012-03-01 15:18 ` jakub at gcc dot gnu.org
2013-04-12 16:18 ` jakub 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).