9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] 6c bug?
@ 2012-02-28  4:40 erik quanstrom
  2012-02-28  7:14 ` Bruce Ellis
       [not found] ` <CAJQxxw=AN0dUGdu_sbdOc2Vkew3BXWPhvTOAxKKLgjHGxpxVjw@mail.gmail.c>
  0 siblings, 2 replies; 5+ messages in thread
From: erik quanstrom @ 2012-02-28  4:40 UTC (permalink / raw)
  To: 9fans

for p = uchar*, Nbus==256,

		if((uint)p[1] >= Nbus){

generates

	warning: ./mp.c:212 useless or misleading comparison: UCHAR >= 0x100

i'm pretty sure that 6c is incorrectly issuing the diagnostic before
applying the cast.  (the cast is there to shut the compiler up.)

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] 6c bug?
  2012-02-28  4:40 [9fans] 6c bug? erik quanstrom
@ 2012-02-28  7:14 ` Bruce Ellis
       [not found] ` <CAJQxxw=AN0dUGdu_sbdOc2Vkew3BXWPhvTOAxKKLgjHGxpxVjw@mail.gmail.c>
  1 sibling, 0 replies; 5+ messages in thread
From: Bruce Ellis @ 2012-02-28  7:14 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

what values of p[1] do you expect the test to be of use?

On 28 February 2012 15:40, erik quanstrom <quanstro@quanstro.net> wrote:
> for p = uchar*, Nbus==256,
>
>                if((uint)p[1] >= Nbus){
>
> generates
>
>        warning: ./mp.c:212 useless or misleading comparison: UCHAR >= 0x100
>
> i'm pretty sure that 6c is incorrectly issuing the diagnostic before
> applying the cast.  (the cast is there to shut the compiler up.)
>
> - erik
>

-- 
Don't meddle in the mouth -- MVS (0416935147, +1-513-3BRUCEE)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] 6c bug?
       [not found] ` <CAJQxxw=AN0dUGdu_sbdOc2Vkew3BXWPhvTOAxKKLgjHGxpxVjw@mail.gmail.c>
@ 2012-02-28  7:20   ` erik quanstrom
  2012-02-28  9:22     ` Bruce Ellis
       [not found]     ` <CAJQxxwka-EGOgyTV-xBB1YOWTXLzyL=qtRWDkfz0NmD82koFpQ@mail.gmail.c>
  0 siblings, 2 replies; 5+ messages in thread
From: erik quanstrom @ 2012-02-28  7:20 UTC (permalink / raw)
  To: 9fans

On Tue Feb 28 02:16:04 EST 2012, bruce.ellis@gmail.com wrote:
> what values of p[1] do you expect the test to be of use?
> 
> On 28 February 2012 15:40, erik quanstrom <quanstro@quanstro.net> wrote:
> > for p = uchar*, Nbus==256,
> >
> >                if((uint)p[1] >= Nbus){
> >
> > generates
> >
> >        warning: ./mp.c:212 useless or misleading comparison: UCHAR >= 0x100
> >
> > i'm pretty sure that 6c is incorrectly issuing the diagnostic before
> > applying the cast.  (the cast is there to shut the compiler up.)

it is not a given that Nbus >= 255.

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] 6c bug?
  2012-02-28  7:20   ` erik quanstrom
@ 2012-02-28  9:22     ` Bruce Ellis
       [not found]     ` <CAJQxxwka-EGOgyTV-xBB1YOWTXLzyL=qtRWDkfz0NmD82koFpQ@mail.gmail.c>
  1 sibling, 0 replies; 5+ messages in thread
From: Bruce Ellis @ 2012-02-28  9:22 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

for the example you gave the diagnostic is correct.

On 28 February 2012 18:20, erik quanstrom <quanstro@quanstro.net> wrote:
> On Tue Feb 28 02:16:04 EST 2012, bruce.ellis@gmail.com wrote:
>> what values of p[1] do you expect the test to be of use?
>>
>> On 28 February 2012 15:40, erik quanstrom <quanstro@quanstro.net> wrote:
>> > for p = uchar*, Nbus==256,
>> >
>> >                if((uint)p[1] >= Nbus){
>> >
>> > generates
>> >
>> >        warning: ./mp.c:212 useless or misleading comparison: UCHAR >= 0x100
>> >
>> > i'm pretty sure that 6c is incorrectly issuing the diagnostic before
>> > applying the cast.  (the cast is there to shut the compiler up.)
>
> it is not a given that Nbus >= 255.
>
> - erik
>



-- 
Don't meddle in the mouth -- MVS (0416935147, +1-513-3BRUCEE)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9fans] 6c bug?
       [not found]     ` <CAJQxxwka-EGOgyTV-xBB1YOWTXLzyL=qtRWDkfz0NmD82koFpQ@mail.gmail.c>
@ 2012-02-28 18:37       ` erik quanstrom
  0 siblings, 0 replies; 5+ messages in thread
From: erik quanstrom @ 2012-02-28 18:37 UTC (permalink / raw)
  To: 9fans

On Tue Feb 28 04:23:56 EST 2012, bruce.ellis@gmail.com wrote:
> for the example you gave the diagnostic is correct.

pffft.  you're right.

- erik



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-02-28 18:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-28  4:40 [9fans] 6c bug? erik quanstrom
2012-02-28  7:14 ` Bruce Ellis
     [not found] ` <CAJQxxw=AN0dUGdu_sbdOc2Vkew3BXWPhvTOAxKKLgjHGxpxVjw@mail.gmail.c>
2012-02-28  7:20   ` erik quanstrom
2012-02-28  9:22     ` Bruce Ellis
     [not found]     ` <CAJQxxwka-EGOgyTV-xBB1YOWTXLzyL=qtRWDkfz0NmD82koFpQ@mail.gmail.c>
2012-02-28 18:37       ` erik quanstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).