Bug 715377 - gcc 3.4.x for rhel6 fails to inline
Summary: gcc 3.4.x for rhel6 fails to inline
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: compat-gcc-34
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jakub Jelinek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks: 715379
TreeView+ depends on / blocked
 
Reported: 2011-06-22 17:37 UTC by Jacob Hunt
Modified: 2018-11-26 19:13 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 715379 (view as bug list)
Environment:
Last Closed: 2011-09-01 14:55:00 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Jacob Hunt 2011-06-22 17:37:20 UTC
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

Comment 1 Jacob Hunt 2011-06-22 17:39:09 UTC
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.

Comment 2 Jacob Hunt 2011-06-22 17:39:20 UTC
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.

Comment 5 Jakub Jelinek 2011-06-22 19:47:59 UTC
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.

Comment 6 Jacob Hunt 2011-06-22 20:22:51 UTC
Jakub,

With RHEL 4.9 released does this even have the remote possibility of being fixed in RHEL4?

-Jacob

Comment 12 RHEL Program Management 2011-09-01 14:55:00 UTC
Development Management has reviewed and declined this request.  You may appeal
this decision by reopening this request.


Note You need to log in before you can comment on or make changes to this bug.