[hjl@gnu-6 lrb]$ cat b.s .intel_syntax noprefix mov eax, 0xEE000F0 mov eax, dword ptr 0xEE000F0 mov eax, [0xEE000F0] mov eax, dword ptr [0xEE000F0] mov eax, ds:0xEE000F0 mov eax, dword ptr ds:0xEE000F0 [hjl@gnu-6 lrb]$ gcc -c b.s [hjl@gnu-6 lrb]$ objdump -dw b.o b.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 <.text>: 0: b8 f0 00 e0 0e mov $0xee000f0,%eax 5: b8 f0 00 e0 0e mov $0xee000f0,%eax a: b8 f0 00 e0 0e mov $0xee000f0,%eax f: b8 f0 00 e0 0e mov $0xee000f0,%eax 14: 8b 04 25 f0 00 e0 0e mov 0xee000f0,%eax 1b: 8b 04 25 f0 00 e0 0e mov 0xee000f0,%eax [hjl@gnu-6 lrb]$ It treats [0xEE000F0] as the same as 0xEE000F0.
A patch is posted at https://mail.google.com/mail/?shva=1#all/123ba7dce13b902f
This is a regression. The older assembler does: [hjl@gnu-33 memory-6]$ cat y.s .text .intel_syntax noprefix mov ebx, [0xEE000F0] mov dword ptr [0xEE000F0], ebx [hjl@gnu-33 memory-6]$ /usr/bin/as -o y.o y.s --32 y.s: Assembler messages: y.s:3: Warning: Treating `[0xEE000F0]' as memory reference y.s:4: Warning: Treating `dword ptr [0xEE000F0]' as memory reference [hjl@gnu-33 memory-6]$ /usr/bin/as --version GNU assembler version 2.18.50.0.9-8.fc10 20080822
Subject: Bug 10637 CVSROOT: /cvs/src Module name: src Changes by: hjl@sourceware.org 2009-09-14 22:02:27 Modified files: gas : ChangeLog gas/config : tc-i386-intel.c gas/testsuite : ChangeLog gas/testsuite/gas/i386: disp.d disp.s i386.exp intelok.d x86-64-disp.d x86-64-disp.s Added files: gas/testsuite/gas/i386: disp-intel.d x86-64-disp-intel.d Log message: gas/ 2009-09-14 H.J. Lu <hongjiu.lu@intel.com> PR gas/10637 * config/tc-i386-intel.c (intel_state): Add has_offset. (i386_intel_simplify): Set intel_state.has_offset to 1 for O_offset. (i386_intel_operand): Turn on intel_state.is_mem if intel_state.has_offset is 0 and the last char is ']'. gas/testsuite/ 2009-09-14 H.J. Lu <hongjiu.lu@intel.com> PR gas/10637 * gas/i386/disp.s: Add tests for Intel syntax. * gas/i386/x86-64-disp.s: Likewise. * gas/i386/disp.d: Updated. * gas/i386/intelok.d: Likewise. * gas/i386/x86-64-disp.d: Likewise. * gas/i386/disp-intel.d: New. * gas/i386/x86-64-disp-intel.d: Likewise. * gas/i386/i386.exp: Run disp-intel and x86-64-disp-intel. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/ChangeLog.diff?cvsroot=src&r1=1.3953&r2=1.3954 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/config/tc-i386-intel.c.diff?cvsroot=src&r1=1.5&r2=1.6 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1547&r2=1.1548 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/disp-intel.d.diff?cvsroot=src&r1=NONE&r2=1.1 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/x86-64-disp-intel.d.diff?cvsroot=src&r1=NONE&r2=1.1 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/disp.d.diff?cvsroot=src&r1=1.1&r2=1.2 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/disp.s.diff?cvsroot=src&r1=1.1&r2=1.2 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/i386.exp.diff?cvsroot=src&r1=1.119&r2=1.120 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/intelok.d.diff?cvsroot=src&r1=1.15&r2=1.16 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/x86-64-disp.d.diff?cvsroot=src&r1=1.1&r2=1.2 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gas/testsuite/gas/i386/x86-64-disp.s.diff?cvsroot=src&r1=1.1&r2=1.2
Binutils 2.15 gives no warnings at all and treats [] as memory. We shouldn't change the meaning of [] unless there is a very strong reason to do so.
Fixed.