public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446
@ 2021-05-12 12:27 jakub at gcc dot gnu.org
  2021-05-12 12:27 ` [Bug tree-optimization/100566] " jakub at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-12 12:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100566
           Summary: [11/12 Regression] Miscompilation of mausezahn since
                    r11-2446
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

The following testcase is miscompiled at -O2 since
r11-2446-g3e61a2056335ca7d4e2009823efae4ee2dc950ee
- it loops endlessly instead of terminating.

struct S { unsigned int s1, s2; int s3, s4, s5, s6, s7; unsigned int s8; };
struct S s;
enum E { E1, E2, E3, E4, E5, E6, E7, E8, E9, E10, E11, E12, E13, E14, E15 };
enum E e;
int f, g, h;

__attribute__((noipa)) void fn1 (void *l)
{
  asm volatile ("" : : "r" (l) : "memory");
}

__attribute__((noipa)) int fn2 (void *l)
{
  asm volatile ("" : : "r" (l) : "memory");
  return 0;
}

__attribute__((noipa)) int fn3 (void)
{
  asm volatile ("" : : : "memory");
  return 0;
}

__attribute__((nothrow, leaf, noipa)) int fn4 (void)
{
  asm volatile ("" : : : "memory");
  return 0;
}

__attribute__((noipa)) int fn5 (unsigned int l)
{
  asm volatile ("" : : "r" (l) : "memory");
  return 0;
}

__attribute__((noipa)) int fn6 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn7 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn8 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn9 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn10 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn11 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn12 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn13 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa)) int fn14 (void *l, int t)
{
  asm volatile ("" : : "r" (l), "r" (t) : "memory");
  return 0;
}

__attribute__((noipa))
int test (void *l, int y, int z)
{
  int i = 0, s1;
  int s8, s7, s6, s5, s4, j = 0;
  s1 = s.s1;
  s8 = s.s8;
  s7 = s.s7;
  s6 = s.s6;
  s5 = s.s5;
  s4 = s.s4 | s.s3;
  if (e == E11)
    j = 1;
  if (s1 == 0)
    goto lab;
  for (i = 0; i < s1; i++)
    {
    lab:
      if (f)
        {
          switch (e)
            {
            case E6:
              fn12 (l, z);
              break;
            case E7:
            case E9:
            case E11:
            case E13:
              fn13 (l, z);
              break;
            case E8:
              fn14 (l, z);
              break;
            }
        }
      if (g)
        fn3 ();
      fn2 (l);
      if (h)
        s.s2 = (unsigned int) s.s2 * fn4 () / 2147483647;
      if (s.s2)
        fn5 (s.s2);
      if (s8)
        {
          if (fn11 (l, z) == 0)
            goto lab;
        }
      if (s7)
        {
          if (fn9 (l, z) == 0)
            goto lab;
        }
      if (s6)
        {
          if (fn10 (l, z) == 0)
            goto lab;
        }
      if (s5)
        {
          if (fn8 (l, y) == 0)
            goto lab;
        }
      if (s4)
        {
          if (fn7 (l, y) == 0)
            goto lab;
        }
      if (j)
        fn6 (l, z);
      if (!s1)
        goto lab;
    }
  fn1 (l);
  return 0;
}

int
main ()
{
  asm volatile ("" : : "g" (&s), "g" (&e), "g" (&f), "g" (&g), "g" (&h) :
"memory");
  s.s1 = 1;
  e = E7;
  test (0, 2, 1);
  return 0;
}

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

end of thread, other threads:[~2021-05-17  8:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-12 12:27 [Bug tree-optimization/100566] New: [11/12 Regression] Miscompilation of mausezahn since r11-2446 jakub at gcc dot gnu.org
2021-05-12 12:27 ` [Bug tree-optimization/100566] " jakub at gcc dot gnu.org
2021-05-12 12:47 ` jakub at gcc dot gnu.org
2021-05-12 12:48 ` [Bug tree-optimization/100566] [11/12 Regression] Miscompilation of mausezahn since r9-2635 jakub at gcc dot gnu.org
2021-05-12 12:54 ` [Bug tree-optimization/100566] [9/10/11/12 " rguenth at gcc dot gnu.org
2021-05-12 12:59 ` jakub at gcc dot gnu.org
2021-05-12 13:43 ` rguenth at gcc dot gnu.org
2021-05-12 15:01 ` cvs-commit at gcc dot gnu.org
2021-05-12 15:58 ` cvs-commit at gcc dot gnu.org
2021-05-17  7:47 ` [Bug tree-optimization/100566] [9/10 " cvs-commit at gcc dot gnu.org
2021-05-17  8:17 ` cvs-commit at gcc dot gnu.org
2021-05-17  8:18 ` rguenth 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).