I should test ICC.. but I am scared.
--
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/0489dc9f-652e-4a55-aa6e-030ac740561d%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAFLa5WPNvjUJvP_CEnW0Xyytc%2BwHPUjKC_MqT-4JN1YU6VfYXg%40mail.gmail.com.
implement{a}
myintvec_cffgcd
{n}(iv, n) = let
//
var res
: myint(a) = myint_make_int<a> (0)
val p_res = &res
//
// HX-2015-01-27:
// fixing a bug in (clang-3.5 -O2)
//
// HX: a dummy to force clang
// *not* to optimize the value stored in [res]
val ((*void*)) = ptr_as_volatile(p_res)
//
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/CAFLa5WM-UbGtk%3DVataT-gqzZTfTKrDFB4NxvRvuaYE5x9QNWoQ%40mail.gmail.com.
--
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/CAJ7XQb5TLbxu-Att5nP_SYDujm3Zq%3DwF3yLQKqP15jMQ0m9kPw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/dabf0a54-add5-4e04-ab1c-6ebcb11e18e4%40googlegroups.com.
#include <stdio.h>
#include <setjmp.h>
static jmp_buf buf;
void
second(int *p) {
*p = 1000000;
printf("second\n"); // prints
longjmp(buf,1); // jumps back to where setjmp was called - making setjmp now return 1
}
void
first(int *p) {
second(p);
printf("first\n"); // does not print
}
int main() {
int x = 0;
if (!setjmp(buf) ) {
first(&x); // when executed, setjmp returns 0
} else { // when longjmp jumps back, setjmp returns 1
printf("main: x = %i\n", x); // prints
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <setjmp.h>
static jmp_buf buf;
void
second(int *p) {
*p = 1000000;
printf("second: *p = %i\n", *p);
longjmp(buf,1); // jumps back to where setjmp was called - making setjmp now return 1
}
void
first(int *p) {
second(p);
printf("first\n"); // does not print
}
int main() {
/*
int x = 0;
*/
int *p;
p = malloc(sizeof(int));
/*
printf("main: p = %p\n", p);
*/
if (p == 0)
{
fprintf (stderr, "malloc: failed!\n"); exit(1);
}
*p = 0;
if (!setjmp(buf) ) {
first(p); // when executed, setjmp returns 0
} else { // when longjmp jumps back, setjmp returns 1
printf("main: *p = %i\n", *p); // prints
}
return 0;
}
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/83e98e70-e320-4d7d-8776-5a6fa2804b94%40googlegroups.com.
...
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/b3219e69-000b-4d50-9db8-4e0abe6fdd36%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/713CC297-B9C2-41FA-A172-1C9361A9B437%40shealevy.com.
I read the assembly output from (clang -O2). It is
pretty clear that *p in the printf-call is replaced with
0. This would be correct if setjmp were an oridinary function.
In this case, the compiler should have assumed that setjmp may
modify the content of anything that has an address.
Let us treat setjmp specially because it is special. However, it is not so simple because+Reid
On Tue, Jan 27, 2015 at 6:29 PM, gmhwxi <gmh...@gmail.com> wrote:
> Thanks!
>
> I would really like to understand the issue.
>
>>>As the variable tmp502 is not declared volatile, its value is
>>> indeterminate
>
> When is it indeterminate? During the longjmp phase?
>
> Why does it matter whether it is indeterminate or not? It is not used during
> the
> longjmp phase.
#include <stdlib.h>
#include <setjmp.h>
int main(int argc, char **argv) {
int *p;
p = malloc(sizeof(int));
*p = 42;
jmp_buf buf;
if (setjmp(buf))
return *p;
*p = 13;
longjmp(buf, 1);
}
http://conal.net/blog/posts/the-c-language-is-purely-functional
?
--
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/CAJ7XQb6_uTx-EEXh5L_eD637h_E%2BTagutyxxgsiCHzCOEDKPdg%40mail.gmail.com.
But asking programmers to write optimized on their own would be a lot worse!I think it is time to ask/find someone to use CompCert to compile ATS2 :)
--
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/ee1267f2-985c-429f-8a74-b14da62112dc%40googlegroups.com.

--
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/ee1267f2-985c-429f-8a74-b14da62112dc%40googlegroups.com.