Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

zsh 3.0.0 and gcc 1.42 bug



FYI, the following code in zsh-3.0.0/Src/subst.c:

	ifdef HAVE_STRCOLL
	# ifdef __GNUC__
	    char c[strlen(*(char **) a) + 1];
	    char d[strlen(*(char **) b) + 1];
	# else  
	    char *c = halloc(strlen(*(char **) a) + 1);
	    char *d = halloc(strlen(*(char **) b) + 1);
	# endif     

doesn't work under gcc 1.42.  I've attached a test program.  If
you flip the #if value, and compile with gcc 1.42, it will fail
or succeed.

We're switching to gcc 2 for everything RSN, but figured I'd
mention it in case you guys care.

--keith

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
int
cstrpcmp(const void *a, const void *b)
{
#if 1
    char c[strlen(*(char **) a) + 1];
    char d[strlen(*(char **) b) + 1];
#else
    char c[20];
    char d[20];
#endif
    char *s, *t;
    
    for (s = *(char **) a, t = c; (*t++ = tolower(*s++)););
    for (s = *(char **) b, t = d; (*t++ = tolower(*s++)););

    return (strcmp(c, d));
}

main()
{
	char *a, *b;

	a = "HUP";
	b = "HUP";
	printf("%d\n", cstrpcmp(&a, &b));
}



Messages sorted by: Reverse Date, Date, Thread, Author