Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-785

[HP aCC 6.16] bogus cadvise warning #20200 with +d on a conditional and for statement

Add voteWatch issue
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • External
    • None
    • HP C/aC++ B3910B A.06.16 [Nov 26 2007]

    • Incorrect Behavior

    Description

      ------- Original Message --------
      Subject: aCC 6.16 bogus warning #20200 with +d on a conditional and for statement
      Date: Tue, 18 Mar 2008 13:39:00 -0600
      From: Martin Sebor <sebor@roguewave.com>
      Organization: Rogue Wave Software, Inc.
      To: acxx@cup.hp.com <acxx@cup.hp.com>

      Here's another bogus warning #20200. This one goes away if I drop +d,
      or the first call to strchr(), or use s directly instead of assigning
      it to ss in the for loop.

      Martin

      $ cat u.cpp && aCC -V -c +d +w u.cpp
      #include <string.h>
      
      char *s;
      
      void foo () {
          if (s && strchr (s, 'x')) {
      
              for (const char *ss = s; *ss; ++ss) {
      
                 ss = strchr (ss, 'x');
                 if (!ss)
                     break;
              }
          }
      }
      aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
      "u.cpp", line 10, procedure foo: warning #20200-D: Potential null pointer
                dereference through ss is detected (null definition:u.cpp, line 10)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sebor Martin Sebor

              Dates

                Created:
                Updated:

                Slack

                  Issue deployment