reassign 523086 dietlibc-dev
severity 523086 important
tag 523086 - help
tag 523086 + patch
retitle 523086 parisc/strstr.S broken
affects 523086 + mksh
thanks

I finally got it: rtc.c (reduced testcase) attached.

(sid)t...@paer:~$ diet cc rtc.c
/home/tg/dietlibc-0.32/debian/dietlibc-dev/usr/lib/diet/lib-parisc/libc.a(vprintf.o):
 In function `vprintf':
/home/tg/dietlibc-0.32/libstdio/vprintf.c:13: warning: warning: the printf 
functions add several kilobytes of bloat.
(sid)t...@paer:~$ ./a.out
broken

t...@blau:/usr/src/bin/mksh $ mgcc rtc.c
rtc.c:0: note: someone does not honour COPTS correctly, passed 0 times
t...@blau:/usr/src/bin/mksh $ ./a.out                                           
                                  
ok: <ad>

Turns out strstr.S for PA-RISC is alignment sensitive in the “needle”
argument… who would have thought?

(sid)t...@paer:~$ diet cc rtc.c dietlibc-0.32.orig/lib/strstr.c 
/home/tg/dietlibc-0.32/debian/dietlibc-dev/usr/lib/diet/lib-parisc/libc.a(vprintf.o):
 In function `vprintf':
/home/tg/dietlibc-0.32/libstdio/vprintf.c:13: warning: warning: the printf 
functions add several kilobytes of bloat.
(sid)t...@paer:~$ ./a.out 
ok: <ad>

The easy fix is, of course, to remove the offending assembly optimised
version of this functionality. I don’t know humppa assembly, so I cannot
provide a better fix. Raising severity as this can affect other packages
(but “normal” would probably be fine too). Note the actual “patch” I’ve
tagged is indeed removing the strstr.S file from build.

bye,
//mirabilos
-- 
Solange man keine schmutzigen Tricks macht, und ich meine *wirklich*
schmutzige Tricks, wie bei einer doppelt verketteten Liste beide
Pointer XORen und in nur einem Word speichern, funktioniert Boehm ganz
hervorragend.           -- Andreas Bogk über boehm-gc in d.a.s.r
/* reduced testcase */

#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char Heuhaufen[] = "mad";

int main(void) {
        char *s, *buf, *cp;

        if ((buf = malloc(32)) == NULL)
                return (255);
        /* align */
        s = (void *)((((ptrdiff_t)buf + 15) & ~15) + 12);
        s[0] = 'a';
        s[1] = '\0';

        cp = strstr(Heuhaufen, s);
        free(buf);

        if (cp)
                printf("ok: <%s>\n", cp);
        else
                printf("broken\n");
        return (cp == NULL ? 1 : 0);
}

Reply via email to