[petsc-dev] technical C question

Jed Brown jed at jedbrown.org
Thu Apr 7 14:37:16 CDT 2016

Barry Smith <bsmith at mcs.anl.gov> writes:
> the clang static code analyzer reports 
> In file included from /sandbox/petsc/petsc.clone/include/petsc/private/matimpl.h:1233:
> /sandbox/petsc/petsc.clone/include/petscbt.h:85:36: warning: The result of the '<<' expression is undefined
>           BT_mask       = (char)(1 << index%PETSC_BITS_PER_BYTE),
>                                  ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Is the code wrong/unnecessary or clang?

I would guess it is complaining about C99 §

  If the value of the right operand is negative or is greater than or
  equal to the width of the promoted left operand, the behavior is
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160407/bf9d68d9/attachment.sig>

More information about the petsc-dev mailing list