[Mimedefang] putc failed: Error 0 line 848 - revisited

Alberto.daSilva at rmb.co.za Alberto.daSilva at rmb.co.za
Thu Dec 5 12:32:01 EST 2002


I've been investigating this outstanding Solaris 8 / gcc 3.2 problem
and it seems that gcc optimizer at level -O2 or higher is broken.

I had a look at the assembler code generated for

    if (putc(*s, data->fp) == EOF) {
        syslog(LOG_WARNING, "putc failed: %m line %d", __LINE__);

using gcc -g -O1 -S, the return value is compared to -1

        cmp     %o2, -1
        bne,a   .LL141
        call    syslog, 0
        ...
.LL141:



and using gcc -g -O2 -S, the code is somewhat reordered (optimized)
and the return value is compared to 255!

        cmp     %o1, 255
        be      .LL183
        ...

.LL183:
        call    syslog, 0


I'm not an expert on compilers, but my recommendation
is to use only "-O1" on Sun Solaris.

Can anyone tell me if gcc 3.2.1 is OK?
What about Sun Forte/Sun ONE C?

Hope this helps,

Alberto da Silva





More information about the MIMEDefang mailing list