summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/20031204-1.c
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gcc.c-torture/execute/20031204-1.c
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/20031204-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20031204-1.c49
1 files changed, 49 insertions, 0 deletions
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 000000000..a9c2f0195
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20031204-1.c
@@ -0,0 +1,49 @@
+/* PR optimization/13260 */
+
+#include <string.h>
+
+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;
+}