From: Stuart Menefy Date: Thu, 4 Dec 2003 21:02:34 +0000 (+0000) Subject: re PR rtl-optimization/13260 (Incorrect optimisation of loop termination condition) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc64a2476d2d99686121a4696ace5c2e4abaa32e;p=gcc.git re PR rtl-optimization/13260 (Incorrect optimisation of loop termination condition) 2003-12-04 Stuart Menefy J"orn Rennecke PR optimization/13260 * gcc.c-torture/execute/20031204-1.c: New test. Co-Authored-By: J"orn Rennecke From-SVN: r74297 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 55a94c95bea..ff1d874ce2c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2003-12-04 Stuart Menefy + J"orn Rennecke + + PR optimization/13260 + * gcc.c-torture/execute/20031204-1.c: New test. + 2003-12-03 Mark Mitchell PR c++/9127 diff --git a/gcc/testsuite/gcc.c-torture/execute/20031204-1.c b/gcc/testsuite/gcc.c-torture/execute/20031204-1.c new file mode 100644 index 00000000000..a9c2f0195bd --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/20031204-1.c @@ -0,0 +1,49 @@ +/* PR optimization/13260 */ + +#include + +typedef unsigned long u32; + +u32 in_aton(const char* x) +{ + return 0x0a0b0c0d; +} + +u32 root_nfs_parse_addr(char *name) +{ + u32 addr; + int octets = 0; + char *cp, *cq; + + cp = cq = name; + while (octets < 4) { + while (*cp >= '0' && *cp <= '9') + cp++; + if (cp == cq || cp - cq > 3) + break; + if (*cp == '.' || octets == 3) + octets++; + if (octets < 4) + cp++; + cq = cp; + } + + if (octets == 4 && (*cp == ':' || *cp == '\0')) { + if (*cp == ':') + *cp++ = '\0'; + addr = in_aton(name); + strcpy(name, cp); + } else + addr = (-1); + + return addr; +} + +int +main() +{ + static char addr[] = "10.11.12.13:/hello"; + u32 result = root_nfs_parse_addr(addr); + if (result != 0x0a0b0c0d) { abort(); } + return 0; +}