C program hangs in ctime on Linux/Alpha

olsson@cs.ucdavis.edu
Thu, 12 Sep 1996 09:08:21 -0700


The attached C program hangs on Alphas running 2.0.17 and 2.0.18. (To
be clear, I mean the program just sits there apparently looping,
although the system remains functional to other processes.) gdb shows
it in:

#0 0x120002560 in timesub ()
#1 0x120002134 in localsub ()
#2 0x120002194 in localtime ()
#3 0x120002784 in ctime ()
#4 0x120000418 in main ()

I'm not sure whether it's hanging in the library routine or kernel.

It does leave messages in /var/log/messages such as:

Sep 10 13:21:41 tigris kernel: b.out(1489): unaligned trap at
000000012000092c: 000000011ffffd84 2d 1

Sep 10 13:21:38 euphrates kernel: b.out(14689): unaligned trap at
00000001200009 2c: 000000011ffffd74 2d 1

The program does not hang on x86 running Linux or on an Alpha running
OSF/1.

----------------------------------------------------------------------

static void P_ctime();
static void P_time();

main()
{
int t1, t2;
int i1;
int *p1, *p2;

char *result;
char *ctime();

printf("begin external test\n");

/**** w/o time *or* ctime call, it doesn't hang. ****/

t1=1;
t2=2;

p1 = (int *) &t2;

i1=time(p1);

t1= i1;

printf("before ctime\n");

/* with p2 = &i1; instead of following, it doesn't hang. */

p2 = &t1;

result = "abcdefghijklmnopqrstuvwxyz";

/*original*/
result=ctime(p2);

printf("after ctime\n");

exit(1);
}