This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix as segfaults on invalid SSE5 insns
- From: Jakub Jelinek <jakub at redhat dot com>
- To: "H.J. Lu" <hjl at lucon dot org>, Michael Meissner <michael dot meissner at amd dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Sat, 29 Dec 2007 20:20:25 +0100
- Subject: [PATCH] Fix as segfaults on invalid SSE5 insns
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Gas ATM segfaults on invalid operands like:
permpd %xmm1, %xmm0, src1(%rip), %xmm0
which current GCC trunk generates on sse5-permpX.c.
While GCC should be fixed, gas shouldn't segfault.
process_drex initializes modrm_reg{,mem} to None (== 65535). All valid
operands set those two to something else, but in case of invalid operands
process_drex calls as_bad, but leaves those fields at 65535. Later on
these 2 fields are used as indexes into arrays without checking.
I think it is better to just initialize to 0, i.e. something that won't
crash, we already issued diagnostics and 0 will allow us to get further.
Ok to commit?
2007-12-29 Jakub Jelinek <jakub@redhat.com>
* config/tc-i386.c (process_drex): Initialize modrm_reg and
modrm_regmem to 0 instead of None.
--- gas/config/tc-i386.c.jj 2007-12-27 16:05:37.000000000 +0100
+++ gas/config/tc-i386.c 2007-12-29 20:02:23.000000000 +0100
@@ -3927,8 +3927,8 @@ finalize_imm (void)
static void
process_drex (void)
{
- i.drex.modrm_reg = None;
- i.drex.modrm_regmem = None;
+ i.drex.modrm_reg = 0;
+ i.drex.modrm_regmem = 0;
/* SSE5 4 operand instructions must have the destination the same as
one of the inputs. Figure out the destination register and cache
Jakub