The error “./libc/sys/CATS/types.cats:72: Error: illegal comparison between types dev_t and dev_t.”, which appears two times, is about this:typedef dev_t ats_dev_type ; // for device IDs
ATSinline()
ats_bool_type
atslib_eq_dev_dev
(dev_t x1, dev_t x2) {
return (x1 == x2 ? ats_true_bool : ats_false_bool) ;
} // end of [atslib_eq_dev_dev]Line #72 is the one with “return (x1 == x2 ? ats_true_bool : ats_false_bool) ;”I'm surprised with this one: is there a case where C99 disallow a comparison between two value of the same type? (here, `dev_t`).
Here is a short test:#include <stdio.h>
#include <sys/types.h>
typedef int ats_bool_type;
#define ats_true_bool 1
#define ats_false_bool 0
ats_bool_type atslib_eq_dev_dev (dev_t x1, dev_t x2) {
return (x1 == x2 ? ats_true_bool : ats_false_bool) ;
} // end of [atslib_eq_dev_dev]
int main (void) {
printf("Hello!\n");
printf("Size of `dev_t is` %i bytes\n", sizeof(dev_t));
return 0;
}
Compilation fails with CompCert, even with this short snippet.If I change the type of `x1` and `x2` to `int`, then it compiles, and says the size of `dev_t` is 8 bytes.
Indeed, compiling with `compcert -D__GLIBC_HAVE_LONG_LONG=1` make the build succeed.
To clarify it, I meant the build of the tiny test file, not the build of ATS2 (I will test it later).
According to http://www.gnu.org/software/gnu-c-manual/gnu-c-manual.html , `__signed__` is a GNU extension to C, so may be the headers must be told to conform to C99, may be defining another macro on the command line, but I don't know which one. Some one who know GCC lib well have an idea?
Now it achieves compilation, but fails at link time, and I have so much link errors I'm afraid. As a side note, during compilation, there is a lot of warning messages.The very long list of link error I get (enough for now, I may try to resume later):
Hi Yannick,
This is all great!
It does seem quite plausible that we will be able to use compcert to compile ATS in the
near future.
Could you also try to use compcert to compile some examples of C code generated by ATS2?
For instance, the examples in the following directory are good ones:
https://github.com/githwxi/ATS-Postiats-contrib/tree/master/projects/MEDIUM/SHOOTOUT
These examples should give us a rough idea as to how compcert is compared with gcc/clang in
terms of the efficiency of the generated object code.
Many thanks!
--
You received this message because you are subscribed to the Google Groups "ats-lang-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-user...@googlegroups.com.
To post to this group, send email to ats-lan...@googlegroups.com.
Visit this group at http://groups.google.com/group/ats-lang-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/026704dc-895d-4a0f-843b-9c625f839ab4%40googlegroups.com.
--
What if we use compcert instead of gcc on pidigits and pidigits_gcc?For now, let us focus on pidigits. On my machine, I got:
time ./pidigits 10000 > /dev/null
real 0m1.006s
user 0m0.996s
sys 0m0.008s
time ./pidigits_gcc 10000 > /dev/null
real 0m1.004s
user 0m1.000s
sys 0m0.000s
I'm stuck with a “syntax error” in `integer_fixed.cats` at line 58, the line “typedef int64_t atstype_int64 ;”As CompCert seems to complain about syntax error when it encounters an undefined type, my guess is that it does not see the definition of the `atstype_int64`.