Description of problem: gcc 4.1.2 on RHEL 5.3 does not produce correct Intel assembly code when given the "-masm=intel" flag. Specifically, percent signs are appearing in the register variable names. Version-Release number of selected component (if applicable): 4.1.2-42.el5 How reproducible: 100% Steps to Reproduce: 1. Create simple C program (e.g., attached foo.c) 2. Compile with gcc -S -masm=intel foo.c 3. There is no step 3! ;-) Actual results: foo.s (attached) has RHEL5 gcc's results. Expected results: foo1.s (also attached) has the correct results as taken from a Caos system (gcc 4.3.3). Additional info: Here's a diff to show where the two provided examples differ specifically: --- foo1.s 2009-05-19 16:56:44.000000000 -0700 +++ foo.s 2009-05-20 12:06:11.000000000 -0700 @@ -1,17 +1,17 @@ .file "foo.c" - .intel_syntax noprefix + .intel_syntax .text .globl main .type main, @function main: .LFB2: - push rbp + push %rbp .LCFI0: - mov rbp, rsp + mov %rbp, %rsp .LCFI1: - mov DWORD PTR [rbp-4], edi - mov QWORD PTR [rbp-16], rsi - mov eax, 0 + mov DWORD PTR [%rbp-4], %edi + mov QWORD PTR [%rbp-16], %rsi + mov %eax, 0 leave ret .LFE2: @@ -54,5 +54,5 @@ .uleb128 0x6 .align 8 .LEFDE1: - .ident "GCC: (GNU) 4.3.3" + .ident "GCC: (GNU) 4.1.2 20071124 (Red Hat 4.1.2-42)" .section .note.GNU-stack,"",@progbits Note the "noprefix" which is missing in gcc 4.1.2's output. Lack of the % prefix is necessary for true Intel ASM syntax.
Created attachment 344867 [details] Simple C file for reproducer
Created attachment 344868 [details] Correct ASM output
Created attachment 344869 [details] Actual ASM output
It produces valid assembly that gas accepts, I don't consider this a bug.
The parameter -masm=intel is supposed to produce Intel ASM output. It failed to do so. That's a bug. Just because GAS accepts it doesn't mean it's correct Intel ASM. What determines that is whether or not the Intel assembler accepts it, but that's not the case. That definitely sounds like a bug to me. If Red Hat's position is to not support their customers in High Performance Computing who make use of the Intel Compiler Suite, then that should be explicitly stated. I'm sure my colleagues here at LBL would be very interested in knowing that. :-)
It produces Intel syntax in prefix mode. If you want the noprefix syntax, you can use gcc44 -masm=intel. The changes for -masm=intel post gcc 4.1.x are large and too risky to be backported.
(In reply to comment #6) > The changes for -masm=intel post gcc 4.1.x are large and too risky to be > backported. If that's the rationale, I can understand and appreciate that. I don't necessarily agree with "NOTABUG" (as opposed to "WONTFIX"), but I'll try not to quibble over details. ;-) Thanks for the explanation! I'll pass this along to my customer.