Andrew nailed it, and several others implied as much. On Tue, 2008-04-15 at 18:10 +0100, Andrew Haley wrote: > Bob Plantz wrote: > > For the multiply, gcc produces (with -O0): > > movl -4(%rbp), %edx > > movl -8(%rbp), %eax > > imull %edx, %eax > > mov %eax, %eax > > movq %rax, -16(%rbp) > > First, it uses signed multiply (imull). Second, it only keeps the > > low-order 32 bits of the result. > > Am I missing something here? > > Knowledge of C, I think. I finally did my homework -- looked it up in ISO/IEC 9899:TC3. Section 6.2.5 Types, #9 states: "A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type." In other words, ignoring the possible high-order 32 bits in the 32-bit multiplication above meets the standard. It is the responsibility of the programmer to ensure that this never occurs. I appreciate the comments and apologize for not doing my homework more thoroughly before posting my question. -- Bob