Re: Can't compile with netbsd-7 or -current

Björn Johannesson <[email protected]> Mon, 5 Jan 2015 14:59:18 -0800
Newsgroups gmane.os.netbsd.ports.sh3
Message-ID <[email protected]>
Hi.

Since I can't seem to keep my hands out of anything these days...
This is from my netbsd-7 jornada 690 (sh3)

This is a different issue than what Oshima-san found.

After some fiddling I came up with the following test case code:
#include <stdio.h>
#include <errno.h>
#include <sys/select.h>

int main(void)
{
        int fd, rs;
        //fd_set t;

        for(;;) {
                fd_set t;
                rs =3D select(fd, &t, NULL, NULL, NULL);
                if (rs =3D=3D -1) {
                        if (errno =3D=3D EAGAIN || errno =3D=3D EINTR)
                                continue;
                }

        }
        return 0;
}

Compiling this with -O1 crashes the compiler.
ratatosk# gcc -O1 nt2.c
nt2.c: In function 'main':
nt2.c:5:5: internal compiler error: Segmentation fault
 int main(void)
     ^
no stack trace because unwind library not available
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
ratatosk#

If you move "fd_set t;" out of the for-loop no crash happens.
This is, I would assume, the important part.

Compiling with -O0 works. I did not find which optimization flag it is that=
 causes this crash.
I think I turned off everything listed under -O1 on https://gcc.gnu.org/onl=
inedocs/gcc/Optimize-Options.html
but the crash still happens.

Please advise.

/B