summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2006-09-05 14:24:01 +0000
committerJulian Brown <julian@codesourcery.com>2006-09-05 14:24:01 +0000
commita447ca9868608942edf8f965059bbb9f397d40d4 (patch)
treeb594a227201f106fcc6e007133c01f375955680b
parent27a08722b57fb85016a712041a80086a0f98f99f (diff)
downloadbinutils-gdb-a447ca9868608942edf8f965059bbb9f397d40d4.tar.gz
gas/
* config/tc-arm.c (parse_qfloat_immediate): Disallow integer syntax for floating-point immediates.
-rw-r--r--ChangeLog.csl6
-rw-r--r--gas/config/tc-arm.c23
2 files changed, 29 insertions, 0 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index e36028c538a..7d820e1dbc7 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,9 @@
+2006-09-05 Julian Brown <julian@codesourcery.com>
+
+ gas/
+ * config/tc-arm.c (parse_qfloat_immediate): Disallow integer syntax for
+ floating-point immediates.
+
2006-09-04 Paul Brook <paul@codesourcery.com>
gas/
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 6b5871af762..bebbbab61ca 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -4121,10 +4121,33 @@ static unsigned
parse_qfloat_immediate (char **ccp, int *immed)
{
char *str = *ccp;
+ char *fpnum = str;
LITTLENUM_TYPE words[MAX_LITTLENUMS];
+ int found_fpchar = 0;
skip_past_char (&str, '#');
+ /* We must not accidentally parse an integer as a floating-point number. Make
+ sure that the value we parse is not an integer by checking for special
+ characters '.' or 'e'.
+ FIXME: This is a horrible hack, but doing better is tricky because type
+ information isn't in a very usable state at parse time. A better solution
+ should be implemented as part of the fix for allowing the full range of
+ pseudo-instructions to be used in VMOV, etc. */
+ skip_whitespace (fpnum);
+ if (strncmp (fpnum, "0x", 2) != 0)
+ {
+ for (; *fpnum != '\0' && *fpnum != ' ' && *fpnum != '\n'; fpnum++)
+ if (*fpnum == '.' || *fpnum == 'e' || *fpnum == 'E')
+ {
+ found_fpchar = 1;
+ break;
+ }
+
+ if (!found_fpchar)
+ return FAIL;
+ }
+
if ((str = atof_ieee (str, 's', words)) != NULL)
{
unsigned fpword = 0;