Discussion:
[9fans] 6c bug?
(too old to reply)
erik quanstrom
2012-02-28 04:40:13 UTC
Permalink
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
Bruce Ellis
2012-02-28 07:14:31 UTC
Permalink
what values of p[1] do you expect the test to be of use?
Post by erik quanstrom
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)
erik quanstrom
2012-02-28 07:20:35 UTC
Permalink
Post by Bruce Ellis
what values of p[1] do you expect the test to be of use?
Post by erik quanstrom
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
Bruce Ellis
2012-02-28 09:22:08 UTC
Permalink
for the example you gave the diagnostic is correct.
Post by erik quanstrom
Post by Bruce Ellis
what values of p[1] do you expect the test to be of use?
Post by erik quanstrom
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)
erik quanstrom
2012-02-28 18:37:03 UTC
Permalink
Post by Bruce Ellis
for the example you gave the diagnostic is correct.
pffft. you're right.

- erik

Continue reading on narkive:
Loading...