[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-cxx-dev
Subject:    Re:  CXX-DEV: warning 20206 question
From:       Dennis Handly <dhandly () cup ! hp ! com>
Date:       2008-02-06 1:39:07
Message-ID: 200802060139.RAA11059 () hpcll183 ! hp ! com
[Download RAW message or body]

>From: Stan Sieler <sieler@allegro.com>
>HP C/aC++ B3910B A.06.15 [May 16 2007]
>and now get some annoying (and incorrect) 20206 warnings when we use +wlint.

They are correct in that they don't see anything but the strcpy.
Or the one case, the "if" and strcpy.

>Note that foo.c has 4 essentially identical strcpy statements ...
>all four are doing "proper" bounds checking ... none should get a warning.

Only the last two have guarded strcpy.

>Is HP aware of this bug?  

I don't think so.  You should file an enhancement request.

>My contention is that a proper implementation of 20206 checking is:
>   When checking bounds for strcpy (or memcpy), if the prior executable
>   line makes a reference to the sizeof the target, then the warning generator
>   can assume that the programmer has done a proper check.
Stan Sieler

Please mention this.

>From: Stan Sieler <sieler@allegro.com>
>This was a very recent change to the compiler (sometime in the last few
>months, it seems), so I thought it would be fresh in the minds of the
>compiler authors who seem to be conspicuously quiet on this thread.

Why do you think that?  It was probably done a year ago.

>From: Stan Sieler <sieler@allegro.com>
>OTOH, I learned decades ago that one should optimize only where it 
>really makes sense

That's why you should use memcpy after you computed the length.  :-)

 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE cxx-dev
 _________________________________________________________________
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic