summaryrefslogtreecommitdiff
path: root/test/regression
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-11-12 13:42:22 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-11-12 13:42:22 +0000
commitce4951549999f403446415c135ad1403a16a15c3 (patch)
treecac9bbb2fea29fce331916b277c38ed8fe29e471 /test/regression
parentdcb9f48f51cec5e864565862a700c27df2a1a7e6 (diff)
Globalenvs: allocate one-byte block with permissions Nonempty for each
function definition, so that comparisons between function pointers are correctly defined. AST, Globalenvs, and many other files: represent programs as a list of (function or variable) definitions instead of two lists, one for functions and the other for variables. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@2067 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/regression')
-rw-r--r--test/regression/Makefile2
-rw-r--r--test/regression/Results/funptr23
-rw-r--r--test/regression/Results/initializers1
-rw-r--r--test/regression/funptr2.c14
-rw-r--r--test/regression/initializers.c3
5 files changed, 22 insertions, 1 deletions
diff --git a/test/regression/Makefile b/test/regression/Makefile
index a649f88..e8fb236 100644
--- a/test/regression/Makefile
+++ b/test/regression/Makefile
@@ -9,7 +9,7 @@ LIBS=$(LIBMATH)
TESTS=attribs1 bitfields1 bitfields2 bitfields3 bitfields4 \
bitfields5 bitfields6 bitfields7 \
- expr1 expr6 initializers volatile1 volatile2 volatile3 \
+ expr1 expr6 funptr2 initializers volatile1 volatile2 volatile3 \
funct3 expr5 struct7 struct8 struct11 casts1 casts2 char1 \
sizeof1 sizeof2 packedstruct1 packedstruct2 \
instrsel bool compar
diff --git a/test/regression/Results/funptr2 b/test/regression/Results/funptr2
new file mode 100644
index 0000000..f364c59
--- /dev/null
+++ b/test/regression/Results/funptr2
@@ -0,0 +1,3 @@
+f == f is 1
+f == g is 0
+f + 1 == f is 0
diff --git a/test/regression/Results/initializers b/test/regression/Results/initializers
index d3fc91a..7474148 100644
--- a/test/regression/Results/initializers
+++ b/test/regression/Results/initializers
@@ -1,3 +1,4 @@
+x0 = 0
x1 = 'x'
x2 = 12345
x3 = 3.14159
diff --git a/test/regression/funptr2.c b/test/regression/funptr2.c
new file mode 100644
index 0000000..5c31dd2
--- /dev/null
+++ b/test/regression/funptr2.c
@@ -0,0 +1,14 @@
+/* Comparisons of pointers to functions */
+
+#include <stdio.h>
+
+int f(void) { return 0; }
+int g(void) { return 1; }
+
+int main(void) {
+ printf ("f == f is %d\n", &f == &f);
+ printf ("f == g is %d\n", &f == &g);
+ /* The following is undefined behavior */
+ printf ("f + 1 == f is %d\n", ((char *) &f) + 1 == (char *) &f);
+ return 0;
+}
diff --git a/test/regression/initializers.c b/test/regression/initializers.c
index f831c67..d0a35f3 100644
--- a/test/regression/initializers.c
+++ b/test/regression/initializers.c
@@ -1,5 +1,7 @@
#include <stdio.h>
+int x0;
+
char x1 = 'x';
int x2 = 12345;
@@ -67,6 +69,7 @@ int main()
{
int i;
+ printf("x0 = %d\n", x0);
printf("x1 = '%c'\n", x1);
printf("x2 = %d\n", x2);
printf("x3 = %.5f\n", x3);