This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/78819] New: [7 Regression] Wrong code with VRP caused by register assertions along default switch labels


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

            Bug ID: 78819
           Summary: [7 Regression] Wrong code with VRP caused by register
                    assertions along default switch labels
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: ppalka at gcc dot gnu.org
  Target Milestone: ---

Started with r238761, following test-case behaves wrongly:

$ cat /tmp/testcase.c 
#include <stdio.h>
#include <stdlib.h>

int main(unsigned argc, char **argv)
{
  if (argc <= 0)
    return 0;
  if (argc > 3)
    return 0;

  switch (argc)
  {
    case 1:
    case 3:
      fprintf (stderr, "value: %d\n", argc);
      break;
    case 2:
      fprintf (stderr, "value: %d\n", argc);
      break;
    default:
      abort();
  }

  return 1;
}

$ ./xgcc -B. /tmp/testcase.c -O0 -fdump-tree-optimized && ./a.out  1 1
value: 3
$ ./xgcc -B. /tmp/testcase.c -O2 -fdump-tree-optimized && ./a.out  1 1
value: 1

This miscompilation is detected by Python-2.7.12 package, that fails in
test_epoll test-case.

Thanks,
Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]