This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/48385] x86-64: Tail call recursion optimization with -mcmodel=large can generate invalid assembly (immediate operand illegal with absolute jump)
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 30 Jun 2011 23:11:36 +0000
- Subject: [Bug target/48385] x86-64: Tail call recursion optimization with -mcmodel=large can generate invalid assembly (immediate operand illegal with absolute jump)
- Auto-submitted: auto-generated
- References: <bug-48385-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48385
--- Comment #5 from H.J. Lu <hjl.tools at gmail dot com> 2011-06-30 23:11:09 UTC ---
[hjl@gnu-33 delta]$ cat testcase.c
typedef unsigned char uint8_t;
typedef unsigned long int uint64_t;
typedef uint64_t size_t;
typedef uint64_t uintptr_t;
typedef uint8_t bool;
typedef struct {
unsigned int unused:
1;
unsigned int addr_12_31 : 30;
unsigned int addr_32_51 : 21;
} __attribute__ ((packed)) pte_t;
typedef struct {
pte_t *page_table;
} as_genarch_t;
typedef struct as {
as_genarch_t genarch;
} as_t;
void pt_mapping_remove(as_t *as, uintptr_t page) {
pte_t *ptl0 = (pte_t *) (((uintptr_t) ((uintptr_t) as->genarch.page_table)) +
0xffff800000000000UL);
pte_t *ptl1 = (pte_t *) (((uintptr_t) (((pte_t *) ((((uint64_t) ((pte_t *)
(ptl0))[((((page) >> 39) & 0x1ffU))].addr_12_31) << 12) | (((uint64_t) ((pte_t
*) (ptl0))[((((page) >> 39) & 0x1ffU))].addr_32_51) << 32))))) +
0xffff800000000000UL);
pte_t *ptl2 = (pte_t *) (((uintptr_t) (((pte_t *) ((((uint64_t) ((pte_t *)
(ptl1))[((((page) >> 30) & 0x1ffU))].addr_12_31) << 12) | (((uint64_t) ((pte_t
*) (ptl1))[((((page) >> 30) & 0x1ffU))].addr_32_51) << 32))))) +
0xffff800000000000UL);
pte_t *ptl3 = (pte_t *) (((uintptr_t) (((pte_t *) ((((uint64_t) ((pte_t *)
(ptl2))[((((page) >> 21) & 0x1ffU))].addr_12_31) << 12) | (((uint64_t) ((pte_t
*) (ptl2))[((((page) >> 21) & 0x1ffU))].addr_32_51) << 32))))) +
0xffff800000000000UL);
memsetb(&ptl3[(((page) >> 12) & 0x1ffU)], sizeof(pte_t), 0);
bool empty = 1;
unsigned int i;
for (i = 0;
i < 512;
i++) {
if ((*((uint64_t *) ((&ptl3[i]))) != 0)) {
empty = 0;
}
}
for (i = 0;
i < 512;
i++) {
if ((*((uint64_t *) ((&ptl2[i]))) != 0)) {
empty = 0;
}
}
if (empty) {
frame_free((((uintptr_t) ((uintptr_t) ptl1)) - 0xffff800000000000UL));
memsetb(&ptl0[(((page) >> 39) & 0x1ffU)], sizeof(pte_t), 0);
}
}
[hjl@gnu-33 delta]$