This very simple code runs fine when compiled with GNU, Intel, or PGI (which is really GNU, I think?). Under Cray, it never makes it to "debug6"; it fails in the "calloc" call, returning an "Illegal instruction" error. Anyone see a problem? EDIT: This is a run time error, not a compile time error.
FURTHER EDIT: If anyone wants another clue, malloc()
works where calloc()
does not.
AND ANOTHER EDIT: If you want yet another clue, I can calloc()
up to 15 chars, no prob. It fails for 16 or more.
#include <stdio.h>
#include <stdlib.h>
int attempt_something() {
char *needed_file_name = NULL;
printf("debug2\n");
needed_file_name = calloc(16, sizeof(char));
printf("debug6\n");
fflush(stdout);
free(needed_file_name);
return 0;
}
int main() {
int rst_type;
printf("debug1\n");
rst_type = attempt_something();
}