]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/53703 (verify_ssa: definition in block 105 does not dominate...
authorBill Schmidt <wschmidt@linux.ibm.com>
Mon, 18 Jun 2012 12:22:37 +0000 (12:22 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Mon, 18 Jun 2012 12:22:37 +0000 (12:22 +0000)
gcc:

2012-06-18  Bill Schmidt  <wschmidt@linux.ibm.com>

PR tree-optimization/53703
* tree-ssa-phiopt.c (hoist_adjacent_loads): Skip virtual phis;
correctly set bb_for_def[12].

gcc/testsuite:

2012-06-18  Bill Schmidt  <wschmidt@linux.ibm.com>

PR tree-optimization/53703
* gcc.dg/torture/pr53703.c: New test.

From-SVN: r188731

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr53703.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.c

index f1f564fde42a0426407679137c584ea3c3d71b79..194601dc714cbc796fa73c1c64522f5a0a5381f7 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-18  Bill Schmidt  <wschmidt@linux.ibm.com>
+
+       PR tree-optimization/53703
+       * tree-ssa-phiopt.c (hoist_adjacent_loads): Skip virtual phis;
+       correctly set bb_for_def[12].
+
 2012-06-18  Steven Bosscher  <steven@gcc.gnu.org>
 
        * config/vax/vax.h (VMS_TARGET): Remove.
index ccdc4ca8a1632d0ac215d342a943d689779d560a..933dca32d824eed26afc6f04a02de5ac98f7236e 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-18  Bill Schmidt  <wschmidt@linux.ibm.com>
+
+       PR tree-optimization/53703
+       * gcc.dg/torture/pr53703.c: New test.
+
 2012-06-18  Richard Sandiford  <rdsandiford@googlemail.com>
 
        PR middle-end/53698
diff --git a/gcc/testsuite/gcc.dg/torture/pr53703.c b/gcc/testsuite/gcc.dg/torture/pr53703.c
new file mode 100644 (file)
index 0000000..c9e10ab
--- /dev/null
@@ -0,0 +1,149 @@
+/* Reduced test case from PR53703.  Used to ICE.  */
+
+/* { dg-do compile } */
+/* { dg-options "-w" } */
+
+typedef long unsigned int size_t;
+typedef unsigned short int sa_family_t;
+struct sockaddr   {};
+typedef unsigned char __u8;
+typedef unsigned short __u16;
+typedef unsigned int __u32;
+struct nlmsghdr {
+  __u32 nlmsg_len;
+  __u16 nlmsg_type;
+};
+struct ifaddrmsg {
+  __u8 ifa_family;
+};
+enum {
+  IFA_ADDRESS,
+  IFA_LOCAL,
+};
+enum {
+  RTM_NEWLINK = 16,
+  RTM_NEWADDR = 20,
+};
+struct rtattr {
+  unsigned short rta_len;
+  unsigned short rta_type;
+};
+struct ifaddrs {
+  struct ifaddrs *ifa_next;
+  unsigned short ifa_flags;
+};
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+struct nlmsg_list {
+  struct nlmsg_list *nlm_next;
+  int size;
+};
+struct rtmaddr_ifamap {
+  void *address;
+  void *local;
+  int address_len;
+  int local_len;
+};
+int usagi_getifaddrs (struct ifaddrs **ifap)
+{
+  struct nlmsg_list *nlmsg_list, *nlmsg_end, *nlm;
+  size_t dlen, xlen, nlen;
+  int build;
+  for (build = 0; build <= 1; build++)
+    {
+      struct ifaddrs *ifl = ((void *)0), *ifa = ((void *)0);
+      struct nlmsghdr *nlh, *nlh0;
+      uint16_t *ifflist = ((void *)0);
+      struct rtmaddr_ifamap ifamap;
+      for (nlm = nlmsg_list; nlm; nlm = nlm->nlm_next)
+       {
+         int nlmlen = nlm->size;
+         for (nlh = nlh0;
+              ((nlmlen) >= (int)sizeof(struct nlmsghdr)
+               && (nlh)->nlmsg_len >= sizeof(struct nlmsghdr)
+               && (nlh)->nlmsg_len <= (nlmlen));
+              nlh = ((nlmlen) -= ( (((nlh)->nlmsg_len)+4U -1) & ~(4U -1) ),
+                     (struct nlmsghdr*)(((char*)(nlh))
+                                        + ( (((nlh)->nlmsg_len)+4U -1)
+                                            & ~(4U -1) ))))
+           {
+             struct ifinfomsg *ifim = ((void *)0);
+             struct ifaddrmsg *ifam = ((void *)0);
+             struct rtattr *rta;
+             sa_family_t nlm_family = 0;
+             uint32_t nlm_scope = 0, nlm_index = 0;
+             memset (&ifamap, 0, sizeof (ifamap));
+             switch (nlh->nlmsg_type)
+               {
+               case RTM_NEWLINK:
+                 ifim = (struct ifinfomsg *)
+                   ((void*)(((char*)nlh)
+                            + ((0)+( ((((int)
+                                        ( ((sizeof(struct nlmsghdr))+4U -1)
+                                          & ~(4U -1) )))+4U -1)
+                                     & ~(4U -1) ))));
+               case RTM_NEWADDR:
+                 ifam = (struct ifaddrmsg *)
+                   ((void*)(((char*)nlh)
+                            + ((0)+( ((((int)
+                                        ( ((sizeof(struct nlmsghdr))+4U -1)
+                                          & ~(4U -1) )))+4U -1)
+                                     & ~(4U -1) ))));
+                 nlm_family = ifam->ifa_family;
+                 if (build)
+                   ifa->ifa_flags = ifflist[nlm_index];
+                 break;
+               default:
+                 continue;
+               }
+             if (!build)
+               {
+                 void *rtadata = ((void*)(((char*)(rta))
+                                          + (( ((sizeof(struct rtattr))+4 -1)
+                                               & ~(4 -1) ) + (0))));
+                 size_t rtapayload = ((int)((rta)->rta_len)
+                                      - (( ((sizeof(struct rtattr))+4 -1)
+                                           & ~(4 -1) ) + (0)));
+                 switch (nlh->nlmsg_type)
+                   {
+                   case RTM_NEWLINK:
+                     break;
+                   case RTM_NEWADDR:
+                     if (nlm_family == 17)
+                       break;
+                     switch (rta->rta_type)
+                       {
+                       case IFA_ADDRESS:
+                         ifamap.address = rtadata;
+                         ifamap.address_len = rtapayload;
+                       case IFA_LOCAL:
+                         ifamap.local = rtadata;
+                       }
+                   }
+               }
+             if (nlh->nlmsg_type == RTM_NEWADDR && nlm_family != 17)
+               {
+                 if (!ifamap.local)
+                   {
+                     ifamap.local = ifamap.address;
+                     ifamap.local_len = ifamap.address_len;
+                   }
+                 if (!ifamap.address)
+                   {
+                     ifamap.address = ifamap.local;
+                   }
+                 if (ifamap.address_len != ifamap.local_len
+                     || (ifamap.address != ((void *)0)
+                         && memcmp (ifamap.address, ifamap.local,
+                                    ifamap.address_len)))
+                   {
+                     if (!build)
+                       dlen += (((ifa_sa_len (nlm_family,
+                                              ifamap.address_len))+4U -1)
+                                & ~(4U -1) );
+                   }
+               }
+           }
+       }
+    }
+}
index c64e8e2a984eef4138a7fb14db3d571968d0945d..52be15006d07be986568aba4557f19d4b7dbb53d 100644 (file)
@@ -1853,7 +1853,9 @@ hoist_adjacent_loads (basic_block bb0, basic_block bb1,
       if (TREE_CODE (arg1) != SSA_NAME
          || TREE_CODE (arg2) != SSA_NAME
          || SSA_NAME_IS_DEFAULT_DEF (arg1)
-         || SSA_NAME_IS_DEFAULT_DEF (arg2))
+         || SSA_NAME_IS_DEFAULT_DEF (arg2)
+         || !is_gimple_reg (arg1)
+         || !is_gimple_reg (arg2))
        continue;
 
       def1 = SSA_NAME_DEF_STMT (arg1);
@@ -1914,17 +1916,11 @@ hoist_adjacent_loads (basic_block bb0, basic_block bb1,
          defswap = def1;
          def1 = def2;
          def2 = defswap;
-         /* Don't swap bb1 and bb2 as we may have more than one
-            phi to process successfully.  */
-         bb_for_def1 = bb2;
-         bb_for_def2 = bb1;
-       }
-      else
-       {
-         bb_for_def1 = bb1;
-         bb_for_def2 = bb2;
        }
 
+      bb_for_def1 = gimple_bb (def1);
+      bb_for_def2 = gimple_bb (def2);
+
       /* Check for proper alignment of the first field.  */
       tree_offset1 = bit_position (field1);
       tree_offset2 = bit_position (field2);