Re: [PATCH 1/3] staging: comedi: comedi_bond: fix 'b_mask' calc in bonding_dio_insn_bits()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 21/04/15 21:09, Dan Carpenter wrote:
I knew the original was undefined because Ian showed me the relevant
section from the standard.  I'm actually surprised that it doesn't work
in GCC.  Using -fno-strict-overflow doesn't help either.  I think at the
optimizations that the kernel uses -O2 and -Os the original "works".

It's mostly down to the limitations of the CPU machine code instructions for shifting. In the case of the x86 32-bit wide shift instructions, the "shift amount operand" is reduced modulo 32 (similarly for shift instructions of other widths). If the compiler were to allow arbitrary, non-constant shift amounts to work properly, it would have to insert extra code to work around the limitations of the underlying instruction.

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux