Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Ben Pfaff
On Mon, Jun 12, 2017 at 07:36:48PM -0400, Lance Richardson wrote: > > > - Original Message - > > From: "Greg Rose" > > To: "Lance Richardson" > > Cc: d...@openvswitch.org > > Sent: Monday, 12 June, 2017 6:44:43 PM > > Subjec

Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Greg Rose
On 06/12/2017 04:36 PM, Lance Richardson wrote: - Original Message - > From: "Greg Rose" > To: "Lance Richardson" > Cc: d...@openvswitch.org > Sent: Monday, 12 June, 2017 6:44:43 PM > Subject: Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with

Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Lance Richardson
- Original Message - > From: "Greg Rose" > To: "Lance Richardson" > Cc: d...@openvswitch.org > Sent: Monday, 12 June, 2017 6:44:43 PM > Subject: Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with > unrepresentable results > > On

Re: [ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Greg Rose
On 06/12/2017 01:13 PM, Lance Richardson wrote: A left shift that would produce a result that is not representable by the type of the expression's result has "undefined behavior" according to the C language standard. Avoid this by casting values that could set the upper bit to unsigned types. Fo

[ovs-dev] [PATCH] byte-order: avoid left shifts with unrepresentable results

2017-06-12 Thread Lance Richardson
A left shift that would produce a result that is not representable by the type of the expression's result has "undefined behavior" according to the C language standard. Avoid this by casting values that could set the upper bit to unsigned types. Found via gcc's undefined behavior sanitizer. Signe