summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorStefan Kempf <stefan@cvs.openbsd.org>2007-11-06 14:59:46 +0000
committerStefan Kempf <stefan@cvs.openbsd.org>2007-11-06 14:59:46 +0000
commit65df628f3423603e70ba0b39f8f60f4c9f1d35dc (patch)
treee772fd12547f707d6bc5152e8fb3a5d33a2d7809 /regress
parentbad78159d4f99dbf2b465948861a8d13c192a090 (diff)
Add testcases for switch. ok otto@
Diffstat (limited to 'regress')
-rw-r--r--regress/usr.bin/pcc/ccom/Makefile7
-rw-r--r--regress/usr.bin/pcc/ccom/switch001.c11
-rw-r--r--regress/usr.bin/pcc/ccom/switch002.c11
-rw-r--r--regress/usr.bin/pcc/ccom/switch003.c16
4 files changed, 43 insertions, 2 deletions
diff --git a/regress/usr.bin/pcc/ccom/Makefile b/regress/usr.bin/pcc/ccom/Makefile
index 2084258ac37..c8de94bea6c 100644
--- a/regress/usr.bin/pcc/ccom/Makefile
+++ b/regress/usr.bin/pcc/ccom/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.3 2007/10/30 07:05:37 otto Exp $
+# $OpenBSD: Makefile,v 1.4 2007/11/06 14:59:45 stefan Exp $
CC=/usr/local/bin/cc
@@ -8,17 +8,20 @@ REGRESS_TARGETS=\
darray001 \
enum001 \
init001 init004 \
+ switch003 \
tmpalloc001 \
shouldfail
.c:
@echo ${*}
- ${CC} ${.CURDIR}/${*}.c -o ${*}.out && ${*}.out
+ ${CC} ${.CURDIR}/${*}.c -o ${*}.out && ${.CURDIR}/${*}.out
shouldfail:
@echo ${*}
if ${CC} ${.CURDIR}/init002.c; then false; else true; fi
if ${CC} ${.CURDIR}/init003.c; then false; else true; fi
+ if ${CC} ${.CURDIR}/switch001.c; then false; else true; fi
+ if ${CC} ${.CURDIR}/switch002.c; then false; else true; fi
clean:
rm -f *.out
diff --git a/regress/usr.bin/pcc/ccom/switch001.c b/regress/usr.bin/pcc/ccom/switch001.c
new file mode 100644
index 00000000000..dfa75eaa125
--- /dev/null
+++ b/regress/usr.bin/pcc/ccom/switch001.c
@@ -0,0 +1,11 @@
+/* Should not compile. */
+int
+main(int argc, char **argv)
+{
+ double d = 0.0;
+
+ switch (d) {
+ }
+
+ return 0;
+}
diff --git a/regress/usr.bin/pcc/ccom/switch002.c b/regress/usr.bin/pcc/ccom/switch002.c
new file mode 100644
index 00000000000..b0c9037f04f
--- /dev/null
+++ b/regress/usr.bin/pcc/ccom/switch002.c
@@ -0,0 +1,11 @@
+/* Should not compile. */
+int
+main(int argc, char **argv)
+{
+ int *p = 0;
+
+ switch (p) {
+ }
+
+ return 0;
+}
diff --git a/regress/usr.bin/pcc/ccom/switch003.c b/regress/usr.bin/pcc/ccom/switch003.c
new file mode 100644
index 00000000000..c6bcf90cfe7
--- /dev/null
+++ b/regress/usr.bin/pcc/ccom/switch003.c
@@ -0,0 +1,16 @@
+/*
+ * Returns 1 if sizeof(unsigned long) < sizeof(unsigned long long), but
+ * should return 0.
+ */
+int
+main(int argc, char **argv)
+{
+ unsigned long long i = (unsigned long)~0 + (unsigned long long)2;
+
+ switch (i) {
+ case 1:
+ return 1;
+ }
+
+ return 0;
+}