[Info-vax] [OT?] Should compiler warnings be treated as errors ?

Craig A. Berry craigberry at nospam.mac.com
Fri Sep 10 15:13:51 EDT 2021


On 9/10/21 12:35 PM, Simon Clubley wrote:
> On 2021-09-09, Craig A. Berry <craigberry at nospam.mac.com> wrote:


>> I still routinely see warnings with the ancient DEC/CPQ/HP/HPE/VSI C
>> compiler for code that produces no warnings with current gcc and clang.
> 
> Interesting. Are they "genuine" warnings or nonsense type warnings ?

Here's one from last week:

CC/DECC /Include=[]/Standard=Relaxed_ANSI/Prefix=All/Obj=.obj 
/NOANSI_ALIAS/float=ieee/ieee=denorm/NAMES=(SHORTENED)/Define=(_USE_STD_STAT=1,"VERSION=""3.16""","XS_VERSION=""3.16""")/Include=([--])/List/Debug/NoOpt 
  BASE64.c /OBJECT=BASE64.obj

		unsigned char uc = index_64[NATIVE_TO_ASCII(*str++)];
............................................^
%CC-W-UNDEFVARMOD, In the initializer for uc, the expression 
"(((sizeof(*str++)==1)||((U64)((*str++)|0))==((U8)(*str++))))" modifies 
the variable "str" more than once without an intervening sequence point. 
  This behavior is undefined.
at line number 360 in file D0:[CRAIG.blead.cpan.MIME-Base64]BASE64.c;1


Someone had modified a macro such that its argument was referenced
twice.  But some callers of that macro post-incremented the argument.
So presumably the argument could get incremented twice.  Or not,
depending on accidents of the implementation.  This is in the Perl
sources and gets thrown against gcc and clang dozens of times a day, as
well as MSVC, HP-UX, AIX, and z/OS compilers somewhat less often.  And
the VMS compiler whenever I get around to it, which in this case was
about a month after the change had been pushed, during which time no one
else discovered a problem with it.

This was the fix:

<https://github.com/Perl/perl5/commit/231a6d1601b9d335d75c74dc9995dda5e7201103>



More information about the Info-vax mailing list