aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-10-30 15:50:38 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1996-10-30 15:50:38 -0500
commitcd76ea335859b480fed527a39f7ba84963c1bb3a (patch)
tree4e6f19e4666006f596da840931e8165473769ef5
parentc6258ee2174574ecb9c782dc1908dd049db46ce1 (diff)
downloadgcc-cd76ea335859b480fed527a39f7ba84963c1bb3a.zip
gcc-cd76ea335859b480fed527a39f7ba84963c1bb3a.tar.gz
gcc-cd76ea335859b480fed527a39f7ba84963c1bb3a.tar.bz2
(expand_asm_operands): Disallow matching constraints on output and
validate the numbers on inputs. From-SVN: r13077
-rw-r--r--gcc/stmt.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 0d4f1db..a8f2abc 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1453,13 +1453,12 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
#endif
break;
- case 'p': case 'g': case 'r':
- /* Whether or not a numeric constraint allows a register is
- decided by the matching constraint, and so there is no need
- to do anything special with them. We must handle them in
- the default case, so that we don't unnecessarily force
- operands to memory. */
case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ error ("matching constraint not valid in output operand");
+ break;
+
+ case 'p': case 'g': case 'r':
default:
allows_reg = 1;
break;
@@ -1564,13 +1563,20 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
#endif
break;
- case 'p': case 'g': case 'r':
/* Whether or not a numeric constraint allows a register is
decided by the matching constraint, and so there is no need
to do anything special with them. We must handle them in
the default case, so that we don't unnecessarily force
operands to memory. */
case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ if (TREE_STRING_POINTER (TREE_PURPOSE (tail))[j]
+ >= '0' + noutputs)
+ error ("matching constraint references invalid operand number");
+
+ /* ... fall through ... */
+
+ case 'p': case 'g': case 'r':
default:
allows_reg = 1;
break;