From c3b615f875ed2cf8418453c79c4621d2dc61b0a0 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 26 Nov 2014 15:50:36 +0100 Subject: Wrong handling of block-local function declarations (in Elab.ml). --- test/regression/decl1.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/regression/decl1.c (limited to 'test/regression/decl1.c') diff --git a/test/regression/decl1.c b/test/regression/decl1.c new file mode 100644 index 00000000..d2aedba7 --- /dev/null +++ b/test/regression/decl1.c @@ -0,0 +1,21 @@ +#include + +/* Local function declarations */ + +int f (int p) +{ + p = p + 1; + return p; +} + +int main (int argc, char **argv) +{ + int (*p)(); + int f(); + int i; + + p = f; + i = (*p)(1); + printf("Result is %d\n", i); + return 0; +} -- cgit From 9a0cc571c98ca2ce41891c09c24aabfea4bfe639 Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Wed, 17 Dec 2014 10:36:41 +0100 Subject: Prototype the pointer so that the program has well defined semantics and passes the reference interpreter. --- test/regression/decl1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/regression/decl1.c') diff --git a/test/regression/decl1.c b/test/regression/decl1.c index d2aedba7..6049b4af 100644 --- a/test/regression/decl1.c +++ b/test/regression/decl1.c @@ -10,7 +10,7 @@ int f (int p) int main (int argc, char **argv) { - int (*p)(); + int (*p)(int); int f(); int i; -- cgit