C++ Standard Library
  1. C++ Standard Library
  2. STDCXX-695

[HP aCC 6.15] lots of noise due to compiler remarks

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 4.2.0
    • Fix Version/s: 4.2.2
    • Component/s: Build and Installation
    • Labels:
      None
    • Environment:

      HP aCC 6.15

    • Severity:
      Compiler Warning

      Description

      The latest HP compiler on IPF issues lots of remarks, making our builds exceedingly noisy.

      Here's a breakdown of all the remarks we get in a recent 12S build along with the number of each:

      F=hpux-11.31-ia64-acc-6.15-12S-610576-log; \
      R=`sed -n "s/.*: remark \(#[1-9][0-9]*-.\): .*/\1/p" $F | sort | uniq`; \
      for r in $R; do \
          n=`grep ": remark $r: " $F | wc -l`; echo $r: $n; \
      done
      
      #2177-D: 8   variable was declared but never referenced
      #2181-D: 9   argument is incompatible with corresponding format string conversion
      #2550-D: 28   variable was set but never used
      #2826-D: 44   parameter was never referenced
      #2961-D: 1   use of a type with no linkage to declare a variable with linkage
      #3235-D: 1   nonstandard conversion between pointer to function and pointer to data
      #3348-D: 799   declaration hides constant or variable
      #4217-D: 3   comparison of enum (represented as an unsigned integer) with zero
      #4219-D: 250   64 bit migration: type conversion may truncate value
      #4234-D: 28   type conversion may lose significant bits
      #4239-D: 2   case type mismatch with switch expression type
      #4244-D: 4   extern storage class used with a function definition
      #4248-D: 4   comparison of unsigned integer with a signed integer
      #4271-D: 780   type conversion may lose sign
      #4273-D: 18   floating-point equality and inequality comparisons may be inappropriate due to roundoff common in floating-point computation
      #4278-D: 3   the subexpression in logical expression is a constant
      #4282-D: 34   virtual function is called from constructor/destructor
      #4283-D: 3   access global variable in constructor
      #4296-D: 695   arithmetic operation on boolean type
      #4297-D: 1220   boolean value is used as array index
      #4298-D: 124   64 bit migration: addition result could be truncated before cast to bigger sized type
      #4299-D: 20   64 bit migration: multiply result could be truncated before cast to bigger sized type
      #4300-D: 60   Overflow while computing constant in left shift operation
      #4315-D: 60   while loop without body, did you insert an extra ';'?
      

        Issue Links

          Activity

          Hide
          Martin Sebor added a comment -

          Dennis' comments:

          -------- Original Message --------
          Subject: Re: aCC 6.15 bogus remark #3348
          Date: Fri, 11 Jan 2008 18:03:44 -0800 (PST)
          From: Dennis Handly <dhandly@cup.hp.com>
          To: sebor@roguewave.com, zhang@cup.hp.com
          CC: acxx@cup.hp.com

          >From: Martin Sebor <sebor@roguewave.com>
          >We get over 800 of these remarks in each of our builds. I haven't
          >analyzed them all but I did reduce one to a test case showing that
          >at least in some instances the warning is wrong.

          I've seen cases where it was right but we know what we are doing.
          And a few broken cases.

          struct S { enum

          { X }

          ; };
          template <class T>
          int foo()

          { const int X = 1; return X; }

          int main()

          { return foo<int>(); }

          aCC: HP C/aC++ B3910B A.06.14 [Feb 22 2007]
          line 4: remark #3348-D: declaration hides constant "S::X" (declared at line 1)
          const int X = 1;
          detected during instantiation of "int foo<T>() [with T=int]" at line 8

          So this is an enum X that is in struct S, not even in scope here.

          We released a new compiler A.06.15 in Sept, with a patch A.06.16 in Dec.

          >From: "Xiaohua zhang" <zhang@cup.hp.com>
          >This bug has been fixed in ToT, you can try next week's weekly tarball to

          Martin doesn't get them.

          >From: Martin Sebor <sebor@roguewave.com>
          >Btw., I just counted the number of remarks we get in stdcxx builds
          >with aCC 6.15 and put together a breakdown. You might find the
          >results interesting:
          http://issues.apache.org/jira/browse/STDCXX-695

          Well, interesting in that you haven't figured out that you should just
          suppress some of them.

          You do know that there is a command "cadvise report logs ..." that
          can produce a nice summary??

          #2177-D: 8 variable was declared but never referenced
          #2550-D: 28 variable was set but never used
          #2826-D: 44 parameter was never referenced

          Suppress with +W2177,2550,2826.

          #2181-D: 9 argument is incompatible with corresponding format string conversion

          This is usually your bug.

          #3235-D: 1 nonstandard conversion between pointer to function and pointer to data

          This isn't legal. You must use a type pun, or bigger hammer.

          #3348-D: 799 declaration hides constant or variable

          As you said, most are bogus.

          #4219-D: 250 64 bit migration: type conversion may truncate value
          #4298-D: 124 64 bit migration: addition result could be truncated before cast to bigger sized type
          #4299-D: 20 64 bit migration: multiply result could be truncated before cast to bigger sized type

          Probably not helpful. We have removed it from +wlint.

          #4244-D: 4 extern storage class used with a function definition

          A useless coding standard that no right thinking developer would want.
          We are thinking of hiding it.

          #4296-D: 695 arithmetic operation on boolean type
          #4297-D: 1220 boolean value is used as array index
          Another two that might not be useful.

          #4282-D: 34 virtual function is called from constructor/destructor

          A comment in that these aren't virtual.

          #4300-D: 60 Overflow while computing constant in left shift operation

          Probably a bug.

          #4315-D: 60 while loop without body, did you insert an extra ';'?

          An attempt to find typos.

          Show
          Martin Sebor added a comment - Dennis' comments: -------- Original Message -------- Subject: Re: aCC 6.15 bogus remark #3348 Date: Fri, 11 Jan 2008 18:03:44 -0800 (PST) From: Dennis Handly <dhandly@cup.hp.com> To: sebor@roguewave.com, zhang@cup.hp.com CC: acxx@cup.hp.com >From: Martin Sebor <sebor@roguewave.com> >We get over 800 of these remarks in each of our builds. I haven't >analyzed them all but I did reduce one to a test case showing that >at least in some instances the warning is wrong. I've seen cases where it was right but we know what we are doing. And a few broken cases. struct S { enum { X } ; }; template <class T> int foo() { const int X = 1; return X; } int main() { return foo<int>(); } aCC: HP C/aC++ B3910B A.06.14 [Feb 22 2007] line 4: remark #3348-D: declaration hides constant "S::X" (declared at line 1) const int X = 1; detected during instantiation of "int foo<T>() [with T=int] " at line 8 So this is an enum X that is in struct S, not even in scope here. We released a new compiler A.06.15 in Sept, with a patch A.06.16 in Dec. >From: "Xiaohua zhang" <zhang@cup.hp.com> >This bug has been fixed in ToT, you can try next week's weekly tarball to Martin doesn't get them. >From: Martin Sebor <sebor@roguewave.com> >Btw., I just counted the number of remarks we get in stdcxx builds >with aCC 6.15 and put together a breakdown. You might find the >results interesting: http://issues.apache.org/jira/browse/STDCXX-695 Well, interesting in that you haven't figured out that you should just suppress some of them. You do know that there is a command "cadvise report logs ..." that can produce a nice summary?? #2177-D: 8 variable was declared but never referenced #2550-D: 28 variable was set but never used #2826-D: 44 parameter was never referenced Suppress with +W2177,2550,2826. #2181-D: 9 argument is incompatible with corresponding format string conversion This is usually your bug. #3235-D: 1 nonstandard conversion between pointer to function and pointer to data This isn't legal. You must use a type pun, or bigger hammer. #3348-D: 799 declaration hides constant or variable As you said, most are bogus. #4219-D: 250 64 bit migration: type conversion may truncate value #4298-D: 124 64 bit migration: addition result could be truncated before cast to bigger sized type #4299-D: 20 64 bit migration: multiply result could be truncated before cast to bigger sized type Probably not helpful. We have removed it from +wlint. #4244-D: 4 extern storage class used with a function definition A useless coding standard that no right thinking developer would want. We are thinking of hiding it. #4296-D: 695 arithmetic operation on boolean type #4297-D: 1220 boolean value is used as array index Another two that might not be useful. #4282-D: 34 virtual function is called from constructor/destructor A comment in that these aren't virtual. #4300-D: 60 Overflow while computing constant in left shift operation Probably a bug. #4315-D: 60 while loop without body, did you insert an extra ';'? An attempt to find typos.
          Hide
          Martin Sebor added a comment -

          Disabled formatting and bumped up the Original Estimate to 2 hours.

          Show
          Martin Sebor added a comment - Disabled formatting and bumped up the Original Estimate to 2 hours.
          Hide
          Martin Sebor added a comment -

          Most instances of remark #3348 are caused by the compiler bug described in STDCXX-694.

          Show
          Martin Sebor added a comment - Most instances of remark #3348 are caused by the compiler bug described in STDCXX-694 .
          Hide
          Martin Sebor added a comment -

          Remarks #4296-D arithmetic operation on boolean type (695 occurrences) and #4297-D boolean value is used as array index (1220 occurrences) are useless even according to HP. We should silence them.

          Out of the total of 780 occurrences of remark #4271-D type conversion may lose sign, only about 120 are distinct. 11 of these are emitted from the library headers so we should silence those first:

          $ grep "remark #4271" hpux-11.31-ia64-acc-6.15-15S-620132-log | grep "(TOPDIR)/include" | sort | uniq
          "$(TOPDIR)/include/algorithm.cc", line 612: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/algorithm", line 82: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/list", line 407: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/loc/_messages.cc", line 108: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/loc/_money_get.cc", line 323: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/loc/_money_get.cc", line 328: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/sstream", line 201: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/string.cc", line 539: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/string.cc", line 633: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/string.cc", line 646: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/include/string", line 613: remark #4271-D: type conversion may lose sign
          

          And another 11 come from our examples:

          $ grep "remark #4271" hpux-11.31-ia64-acc-6.15-15S-620132-log | grep "(TOPDIR)/examples" | sort | uniq
          "$(TOPDIR)/examples/manual/priority_queue.cpp", line 61: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/manual/priority_queue.cpp", line 78: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/manual/stack.cpp", line 67: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/graph.cpp", line 86: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/icecream.cpp", line 220: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/radix.cpp", line 56: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/sieve.cpp", line 45: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/sieve.cpp", line 47: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/sieve.cpp", line 51: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/teller.cpp", line 60: remark #4271-D: type conversion may lose sign
          "$(TOPDIR)/examples/tutorial/teller.cpp", line 64: remark #4271-D: type conversion may lose sign
          
          Show
          Martin Sebor added a comment - Remarks #4296-D arithmetic operation on boolean type (695 occurrences) and #4297-D boolean value is used as array index (1220 occurrences) are useless even according to HP. We should silence them. Out of the total of 780 occurrences of remark #4271-D type conversion may lose sign, only about 120 are distinct. 11 of these are emitted from the library headers so we should silence those first: $ grep "remark #4271" hpux-11.31-ia64-acc-6.15-15S-620132-log | grep "(TOPDIR)/include" | sort | uniq "$(TOPDIR)/include/algorithm.cc", line 612: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/algorithm", line 82: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/list", line 407: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/loc/_messages.cc", line 108: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/loc/_money_get.cc", line 323: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/loc/_money_get.cc", line 328: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/sstream", line 201: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/string.cc", line 539: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/string.cc", line 633: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/string.cc", line 646: remark #4271-D: type conversion may lose sign "$(TOPDIR)/include/string", line 613: remark #4271-D: type conversion may lose sign And another 11 come from our examples: $ grep "remark #4271" hpux-11.31-ia64-acc-6.15-15S-620132-log | grep "(TOPDIR)/examples" | sort | uniq "$(TOPDIR)/examples/manual/priority_queue.cpp", line 61: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/manual/priority_queue.cpp", line 78: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/manual/stack.cpp", line 67: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/graph.cpp", line 86: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/icecream.cpp", line 220: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/radix.cpp", line 56: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/sieve.cpp", line 45: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/sieve.cpp", line 47: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/sieve.cpp", line 51: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/teller.cpp", line 60: remark #4271-D: type conversion may lose sign "$(TOPDIR)/examples/tutorial/teller.cpp", line 64: remark #4271-D: type conversion may lose sign
          Hide
          Farid Zaripov added a comment -

          Fix merged in 4.2.x branch thus: http://svn.apache.org/viewcvs?view=rev&rev=637130

          Show
          Farid Zaripov added a comment - Fix merged in 4.2.x branch thus: http://svn.apache.org/viewcvs?view=rev&rev=637130
          Hide
          Martin Sebor added a comment -

          Scheduled for 4.2.1.

          Show
          Martin Sebor added a comment - Scheduled for 4.2.1.
          Hide
          Martin Sebor added a comment - - edited

          Here's nicer output from the duplicate STDCXX-788:

          Latest HP aCC 6.16 builds produce many remarks making them exceedingly noisy:

          $ gunzip -c hpux-11.31-ia64-acc-6.16-12D-637671-log.gz | grep "remark #" | wc -l
          4187
          

          The breakdown by remark produced by the following script is in the table below:

          $ W=`gunzip -c hpux-11.31-ia64-acc-6.16-12D-637671-log.gz | sed -n "s/.* remark #\([1-9][0-9]*\)-D:.*/\1/p" | sort | uniq`; \
            for w in $W; do \
              printf "%s " $w && gunzip -c hpux-11.31-ia64-acc-6.16-12D-637671-log.gz | grep " remark #$w-D:" | wc -l; \
            done
          
          remark count description disabled
          2177 10 variable was declared but never referenced  
          2550 28 variable was set but never used  
          2826 44 variable was never referenced  
          2961 1 use of a type with no linkage to declare a variable with linkage  
          3348 799 declaration hides variable r639003
          4217 3 comparison of enum (represented as an unsigned integer) with zero  
          4219 251 64 bit migration: type conversion may truncate value  
          4234 28 type conversion may lose significant bits  
          4239 2 case type mismatch with switch expression type  
          4244 4 extern storage class used with a function definition  
          4248 4 comparison of unsigned integer with a signed integer  
          4271 712 type conversion may lose sign  
          4273 18 floating-point equality and inequality comparisons may be inappropriate due to roundoff common in floating-point computation  
          4278 3 the subexpression in logical expression is a constant  
          4282 1 virtual function is called from constructor/destructor  
          4283 3 access global variable in constructor  
          4296 779 operation on boolean type r639003
          4297 1220 boolean value is used as array index r639003
          4298 124 64 bit migration: addition result could be truncated before cast to bigger sized type  
          4299 20 64 bit migration: multiply result could be truncated before cast to bigger sized type  
          4300 72 Overflow while computing constant in left shift operation  
          4315 61 loop without body, did you insert an extra ';'?  
          Show
          Martin Sebor added a comment - - edited Here's nicer output from the duplicate STDCXX-788 : Latest HP aCC 6.16 builds produce many remarks making them exceedingly noisy: $ gunzip -c hpux-11.31-ia64-acc-6.16-12D-637671-log.gz | grep "remark #" | wc -l 4187 The breakdown by remark produced by the following script is in the table below: $ W=`gunzip -c hpux-11.31-ia64-acc-6.16-12D-637671-log.gz | sed -n "s/.* remark #\([1-9][0-9]*\)-D:.*/\1/p" | sort | uniq`; \ for w in $W; do \ printf "%s " $w && gunzip -c hpux-11.31-ia64-acc-6.16-12D-637671-log.gz | grep " remark #$w-D:" | wc -l; \ done remark count description disabled 2177 10 variable was declared but never referenced   2550 28 variable was set but never used   2826 44 variable was never referenced   2961 1 use of a type with no linkage to declare a variable with linkage   3348 799 declaration hides variable r639003 4217 3 comparison of enum (represented as an unsigned integer) with zero   4219 251 64 bit migration: type conversion may truncate value   4234 28 type conversion may lose significant bits   4239 2 case type mismatch with switch expression type   4244 4 extern storage class used with a function definition   4248 4 comparison of unsigned integer with a signed integer   4271 712 type conversion may lose sign   4273 18 floating-point equality and inequality comparisons may be inappropriate due to roundoff common in floating-point computation   4278 3 the subexpression in logical expression is a constant   4282 1 virtual function is called from constructor/destructor   4283 3 access global variable in constructor   4296 779 operation on boolean type r639003 4297 1220 boolean value is used as array index r639003 4298 124 64 bit migration: addition result could be truncated before cast to bigger sized type   4299 20 64 bit migration: multiply result could be truncated before cast to bigger sized type   4300 72 Overflow while computing constant in left shift operation   4315 61 loop without body, did you insert an extra ';'?  
          Hide
          Martin Sebor added a comment -

          This is remotely related to the cadvise warnings issue.

          Show
          Martin Sebor added a comment - This is remotely related to the cadvise warnings issue.
          Hide
          Martin Sebor added a comment -

          Even though all the subtasks have been resolved we're still not done. We forgot about 32-bit builds... As the dump below shows, we have two noisy remarks to worry about there:

          $ for r in `sed -n "s/.*: remark #\([1-9][0-9]*\)-.*/\1/p" hpux-11.31-ia64-acc-6.16-12d-650697.log | sort | uniq`; do \
                n=`grep ": remark #$r-D" hpux-11.31-ia64-acc-6.16-12d-650697.log | wc -l`; \
                printf "remark #$r: %4u\n" $n; \
            done
          remark #2177:    8
          remark #2181:   22
          remark #2550:   28
          remark #2826:    6
          remark #2961:    1
          remark #4217:    3
          remark #4219:   32
          remark #4230: 2892   # 64 bit migration: conversion may cause target of pointers to have a different size
          remark #4234:   29
          remark #4239:    2
          remark #4244:    4
          remark #4248:    4
          remark #4271:  692   # type conversion may lose sign
          remark #4273:   18
          remark #4278:    3
          remark #4280:    1
          remark #4282:    1
          remark #4283:    3
          remark #4298:   18
          remark #4300:   27
          remark #4315:   61
          
          Show
          Martin Sebor added a comment - Even though all the subtasks have been resolved we're still not done. We forgot about 32-bit builds... As the dump below shows, we have two noisy remarks to worry about there: $ for r in `sed -n "s/.*: remark #\([1-9][0-9]*\)-.*/\1/p" hpux-11.31-ia64-acc-6.16-12d-650697.log | sort | uniq`; do \ n=`grep ": remark #$r-D" hpux-11.31-ia64-acc-6.16-12d-650697.log | wc -l`; \ printf "remark #$r: %4u\n" $n; \ done remark #2177: 8 remark #2181: 22 remark #2550: 28 remark #2826: 6 remark #2961: 1 remark #4217: 3 remark #4219: 32 remark #4230: 2892 # 64 bit migration: conversion may cause target of pointers to have a different size remark #4234: 29 remark #4239: 2 remark #4244: 4 remark #4248: 4 remark #4271: 692 # type conversion may lose sign remark #4273: 18 remark #4278: 3 remark #4280: 1 remark #4282: 1 remark #4283: 3 remark #4298: 18 remark #4300: 27 remark #4315: 61
          Hide
          Martin Sebor added a comment -

          Deferred until 4.2.2.

          Show
          Martin Sebor added a comment - Deferred until 4.2.2.

            People

            • Assignee:
              Martin Sebor
              Reporter:
              Martin Sebor
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 17h Original Estimate - 17h
                17h
                Remaining:
                Time Spent - 10h Remaining Estimate - 7h 5m
                7h 5m
                Logged:
                Time Spent - 10h Remaining Estimate - 7h 5m
                10h

                  Development