Hi Peter,
I wanted to know how exactly gcc translates such expressions like
n * 0x1001. People are talking about multiplication being not slower
than any other arithmetic operation on modern processors, but in fact I
got the code (n << 12) + n, no matter which form I used in the C
source. OK, it was with -O0, but it would be quite illogical to
translate multiplication to shift on -O0, and to multiplication on -O3.
Not frequently, but similar question occur from time to time.
Have you tried using gcc's -fverbose-asm option (in conjunction with -S) ?
This should give you the same information, but without having to deal with
the assembler's listing problems.
The default assembly listing page width is too narrow,
Darn - that scuppers my current patch of limiting the listing's maximum
width to the built in default of 100 columns...
I don't like
reading folded source lines, truncated lines are even worse (or
better?). Even 132 characters are not enough, but rhs-width wouldn't
work with whatever sensible width.
Another potential workaround is to skip the assembler's listing output
and instead disassemble the object file with source code annotation enabled,
ie "objdump -d -S".
I am attaching the asm source. I applied the same command line, except
-c replaced by -S.
And weirdly I now cannot reproduce the problem. Either with the .s file
you supplied or the version I created yesterday. Very strange.
I think that the short answer is that this bug is not going to be fixed
quickly, so if you can make use of a workaround please do so. If not,
please file a bug report with a test case and we will see if someone
out there decides to investigate. (If no-one does then it will be up to
me, but I am rather swamped at the moment).
Cheers
Nick