diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2015-10-11 10:16:51 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2015-10-11 10:16:51 +0200 |
commit | 9a62a6663a25c74c537f79bfc767f75fd4994181 (patch) | |
tree | c92c3c2a881a54208ad4f63295daec0dd6836c02 /test/regression/parsing.c | |
parent | 378ac3925503e6efd24cc34796e85d95c031e72d (diff) | |
parent | 659b735ed2dbefcbe8bcb2ec2123b66019ddaf14 (diff) | |
download | compcert-9a62a6663a25c74c537f79bfc767f75fd4994181.tar.gz compcert-9a62a6663a25c74c537f79bfc767f75fd4994181.zip |
Merge branch 'master' into ppc64
Resolved conflicts in:configure powerpc/Asmexpand.ml
Diffstat (limited to 'test/regression/parsing.c')
-rw-r--r-- | test/regression/parsing.c | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/test/regression/parsing.c b/test/regression/parsing.c new file mode 100644 index 00000000..24b954c1 --- /dev/null +++ b/test/regression/parsing.c @@ -0,0 +1,104 @@ +#include<stdio.h> + +typedef signed int T; + +T f(T(T)); +T f(T a(T)) { + T b; + return 1; +} +int g(int x) { + T:; + T y; + T T; + T=1; + + return 1; +} + +void h() { + for(int T; ;) + if(1) + ; + T *x; + x = 0; +} + +void h2() { + for(int T; ;) + if(1) + ; + else T; +} + +struct S { + const T:3; + unsigned T:3; + const T:3; +}; + +void i() { + struct S s; + s.T = -1; + if(s.T < 0) printf("ERROR i\n"); +} + +/* These ones are parsed correctly, but rejected by the elaborator. */ +/* void j() { */ +/* typedef int I; */ +/* {sizeof(enum{I=2}); return I;} */ +/* {do sizeof(enum{I=2}); while((I)1);} */ +/* {if(1) return sizeof(enum{I=2}); */ +/* else return (I)1;} */ +/* {if(sizeof(enum{I=2})) return I; */ +/* else return I;} */ +/* {sizeof(enum{I=2})+I;} */ +/* {for(int i = sizeof(enum{I=2}); I; I) I; (I)1;} */ +/* } */ +/* int f2(enum{I=2} x) { */ +/* return I; */ +/* } */ +/* void k(A, B) */ +/* int B; */ +/* int A[B]; */ +/* { } */ +/* int l(A) */ +/* enum {T=1} A; */ +/* { return T * A; } */ + +void m() { + if(0) + if(1); + else printf("ERROR m\n"); + if(0) + for(int i; ; ) + if(1); + else printf("ERROR m\n"); + if(0) + for(1; ; ) + if(1); + else printf("ERROR m\n"); + if(0) + while(1) + if(1); + else printf("ERROR m\n"); + if(0) + L: if(1); + else printf("ERROR m\n"); + + if(0) + LL:for(1;;) + for(int i;;) + while(1) + switch(1) + case 1: + if(1); + else printf("ERROR m\n"); +} + +int main () { + f(g); + i(); + m(); + return 0; +} |