Re: 5c bug

Charles Forsyth <[email protected]>
Newsgroups gmane.os.plan9.general
Message-ID <CAOw7k5h7sgZ+jrr3MAJuLPX-dLSzW=p-zAwPwkGKAMOdRFvPMw@mail.gmail.com>
5c shouldn't discard the cast, which implies a mask, but you should also
rewrite the code as you suggest.
(it's not just 5c, since it's the same for several other RISCy ones.)


On Thu, Jul 25, 2019 at 12:20 PM Steve Simon <[email protected]> wrote:

> Hi,
>
> I traced a long standing cifs issue to 5c the compiler.
>
> The code in lib9p to validate wstat calls
> uses a neat bit of casting which fails when using 5c.
>
> /sys/src/lib9p/srv.c:658-669
>
> These following lines missfire reporting type or qid change
> when trying to rename files over cifs.
>
>         if((ushort)~r->d.type){
>         ...
>         if((uchar)~r->d.qid.type || .. ){
>
> but rewriting them like this makes the code work as expected:
>
>         if(r->d.type != (ushort)~0){
>         ...
>         if(r->d.qid.type != (uchar)~0 || ... )
>
> Personally I am happy to hack lib9p but the worry is that
> this bug might be affecting other things.
>
> I have no knowledge of the internals of the compilers so
> I am afraid I have made no attempt to dig deeper.
>
> -Steve
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.