Hide Forgot
Description of problem: On rhel 4 gcc 3.4.x and using the 3.4 compatibility package for rhel5/6 fail on the following: gcc -std=c99 -O3 nothing.c nothing.c: #include <xmmintrin.h> inline void cacheLineInvalidate(const void *start) { _mm_clflush(start); } int main(int argc, char *argv[] ) { return 42; } Output w/gcc3.4: /tmp/ccjdBONN.s: Assembler messages: /tmp/ccjdBONN.s:8: Error: suffix or operands invalid for `clflush' compiles w/gcc4
Let's compare the assembler code generated by gcc and gcc4. $ gcc -S -std=c99 -O3 -o nothing-gcc3.s nothing.c $ gcc nothing-gcc3.s nothing-gcc3.s: Assembler messages: nothing-gcc3.s:8: Error: suffix or operands invalid for `clflush' $ sed -n '8{p;q}' nothing-gcc3.s clflush %rdi That's the instruction it doesn't like. What does gcc4 do differently? $ gcc4 -S -std=c99 -O3 -o nothing-gcc4.s nothing.c $ grep -w clflush nothing-gcc4.s clflush (%rdi) Hmm, it just put the register in parentheses... Let's try manually fixing the nothing-gcc3.s assembly code. $ vim nothing-gcc3.s $ sed -n '8{p;q}' nothing-gcc3.s clflush (%rdi) $ gcc nothing-gcc3.s Hey, it worked! Maybe this is a simple addressing-mode bug.
diff -up gcc/config/i386/i386.md.clflush gcc-3.4.6-20060404/gcc/config/i386/i386.md --- gcc/config/i386/i386.md.clflush 2011-04-04 18:46:34.000000000 -0400 +++ gcc/config/i386/i386.md 2011-04-04 18:50:36.000000000 -0400 @@ -22876,7 +22876,7 @@ [(unspec_volatile [(match_operand 0 "address_operand" "p")] UNSPECV_CLFLUSH)] "TARGET_SSE2" - "clflush %0" + "clflush %a0" [(set_attr "type" "sse") (set_attr "memory" "unknown")]) This patch works for me.
This was fixed upstream with SVN revision 84422: http://gcc.gnu.org/viewcvs?view=revision&revision=84422 Patch: http://gcc.gnu.org/viewcvs/trunk/gcc/config/i386/i386.md?r1=84422&r2=84421&pathrev=84422
The purpose of compat-gcc-* packages is just compatibility with older RHEL releases, people really should just use gcc unless compatibility is needed. It makes no sense to fix bugs that aren't going to be fixed in RHEL4, because it really isn't meant as a general purpose compiler. So, IMHO this is a candidate of changing in RHEL6/RHEL5 only if/after it is released as RHEL4 errata.
Jakub, With RHEL 4.9 released does this even have the remote possibility of being fixed in RHEL4? -Jacob
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.