summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/misc-ps.m
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/Analysis/misc-ps.m')
-rw-r--r--clang/test/Analysis/misc-ps.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps.m b/clang/test/Analysis/misc-ps.m
index 88c73bc22e0..949c51019f2 100644
--- a/clang/test/Analysis/misc-ps.m
+++ b/clang/test/Analysis/misc-ps.m
@@ -879,3 +879,17 @@ void foo_rev95192(int **x) {
**x = 1; // no-warning
}
+//===----------------------------------------------------------------------===//
+// Handle casts of a function to a function pointer with a different return
+// value. We don't yet emit an error for such cases, but we now we at least
+// don't crash when the return value gets interpreted in a way that
+// violates our invariants.
+//===----------------------------------------------------------------------===//
+
+void *foo_rev95267();
+int bar_rev95267() {
+ char (*Callback_rev95267)(void) = (char (*)(void)) foo_rev95267;
+ if ((*Callback_rev95267)() == (char) 0)
+ return 1;
+ return 0;
+}
OpenPOWER on IntegriCloud