aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.ibm.com>2012-06-18 12:22:37 +0000
committerWilliam Schmidt <wschmidt@gcc.gnu.org>2012-06-18 12:22:37 +0000
commit9b10be32fd3295d086c4a4cef68e9139a7a07f85 (patch)
tree050a04211fcff225eb26ab491fbd34278b2cb418
parentd421b10cd17c92b2705aeb4f279792dced9f896d (diff)
downloadgcc-9b10be32fd3295d086c4a4cef68e9139a7a07f85.zip
gcc-9b10be32fd3295d086c4a4cef68e9139a7a07f85.tar.gz
gcc-9b10be32fd3295d086c4a4cef68e9139a7a07f85.tar.bz2
re PR tree-optimization/53703 (verify_ssa: definition in block 105 does not dominate use in block 103)
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr53703.c149
-rw-r--r--gcc/tree-ssa-phiopt.c16
4 files changed, 166 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f1f564f..194601d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ccdc4ca..933dca3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..c9e10ab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr53703.c
@@ -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) );
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index c64e8e2..52be150 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -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);