From cd76ea335859b480fed527a39f7ba84963c1bb3a Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Wed, 30 Oct 1996 15:50:38 -0500 Subject: [PATCH] (expand_asm_operands): Disallow matching constraints on output and validate the numbers on inputs. From-SVN: r13077 --- gcc/stmt.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/gcc/stmt.c b/gcc/stmt.c index 0d4f1db2d24..a8f2abcee9e 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; -- 2.30.2