[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug gas/30418] New: use of labels that happen to match register names o
From: |
lh_mouse at 126 dot com |
Subject: |
[Bug gas/30418] New: use of labels that happen to match register names or keywords |
Date: |
Thu, 04 May 2023 04:04:36 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=30418
Bug ID: 30418
Summary: use of labels that happen to match register names or
keywords
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gas
Assignee: unassigned at sourceware dot org
Reporter: lh_mouse at 126 dot com
Target Milestone: ---
Possible dup of https://sourceware.org/bugzilla/show_bug.cgi?id=12240
This is how MSVC handles such names:
(https://gcc.godbolt.org/z/TonjYaxqj)
```
static int* volatile rip;
static unsigned int volatile eax;
int
get_value(void)
{
return rip[eax];
}
```
MSVC outputs:
```
get_value PROC ; COMDAT
mov ecx, DWORD PTR eax
mov rax, QWORD PTR rip
mov eax, DWORD PTR [rax+rcx*4]
ret 0
get_value ENDP
```
GCC outputs:
```
get_value:
mov rdx, QWORD PTR rip[rip]
mov eax, DWORD PTR eax[rip]
mov eax, DWORD PTR [rdx+rax*4]
ret
```
In the case of MSVC, `DWORD PTR eax` is unambiguously parsed as the label `eax`
and `DWORD PTR [eax]` is unambiguously parsed as the register `eax`. The
address of all labels are always relative to RIP, but it is implied, and
brackets are not written explicitly.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug gas/30418] New: use of labels that happen to match register names or keywords,
lh_mouse at 126 dot com <=
- [Bug gas/30418] use of labels that happen to match register names or keywords, lh_mouse at 126 dot com, 2023/05/04
- [Bug gas/30418] use of labels that happen to match register names or keywords, lh_mouse at 126 dot com, 2023/05/04
- [Bug gas/30418] use of labels that happen to match register names or keywords, lh_mouse at 126 dot com, 2023/05/04
- [Bug gas/30418] use of labels that happen to match register names or keywords, lh_mouse at 126 dot com, 2023/05/04
- [Bug gas/30418] use of labels that happen to match register names or keywords, pinskia at gcc dot gnu.org, 2023/05/04