Bug 33918 - GCC failed to produce assembler output with -masm=intel option
Summary: GCC failed to produce assembler output with -masm=intel option
Status: RESOLVED DUPLICATE of bug 18353
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-27 00:29 UTC by rayer
Modified: 2007-10-27 13:40 UTC (History)
2 users (show)

See Also:
Host: i386-pc-dos-djgpp, win32-mingw
Target: i386-pc-dos-djgpp, win32-mingw
Build: i386-pc-dos-djgpp, win32-mingw
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rayer 2007-10-27 00:29:08 UTC
This happened to me when I wanted to look at assembler output source using gcc -S and for better readability choose -masm=intel option. -S only works fine. I tried to cut my source and include short example which can be quickly verified. I also checked this problem happen on mingw32 gcc ver 3.4.5

Try to compile this: gcc -S x.c -masm=intel

x.c:
=================================
#include <stdlib.h>
#include <stdio.h>

typedef struct {
unsigned long offset; // 32-bit offset
unsigned short selector; // 16-bit selector
} __attribute__((packed)) PM_FAR_POINTER;

int exec_ring0_code(unsigned long code_address, unsigned long ecx, unsigned long *eax, unsigned long *edx)
{
PM_FAR_POINTER callgate_ptr;
asm __volatile__ (
"lcall *%5\n"
: "=a"(*eax), "=d"(*edx)
: "a"(*eax), "c"(ecx), "d"(*edx), "m" (callgate_ptr)
: "memory"
);
return(0);
}
=================================

result is:

x.c: In function 'exec_ring0_code':
x.c:19: internal compiler error: in print_operand, at config/i386/i386.c:7961
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Assembler output x.S stops at line
"lcall *"

when I compile it with gcc -S x.c only it compile all without error
and mentioned line looks this:
"lcall *-6(%ebp)"
Comment 1 Danny Smith 2007-10-27 00:52:56 UTC
Same error message as 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18353

This works with revision 129548
Comment 2 rayer 2007-10-27 01:04:29 UTC
(In reply to comment #1)
> Same error message as 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18353
> 
> This works with revision 129548

Oh, sorry for that, I was searching for -masm and nothing found.
Anyway well I'll wait for new DJGPP and MinGW 4.3.0 ports...

Comment 3 Rask Ingemann Lambertsen 2007-10-27 13:40:13 UTC
This is not a regression (as far as I know), so it won't be fixed in anything earlier than 4.3.0.
GCC dies trying to figure out which of BYTE PTR, WORD PTR, etc. it should print for a structure. You may be able to work around it by passing (&callgate_ptr->offset) instead of (callgate_ptr).

*** This bug has been marked as a duplicate of 18353 ***