bug with asm statment in egcs-1.0.2
Peter Barada
pbarada@wavemark.com
Tue Apr 21 19:10:00 GMT 1998
I found a bug in reg-stack.c:constrain_asm_operands when compiling the
following asm statment for i386:
asm volatile (".data;\t.align 4;.LP" "DLbuildtrap"
";\t.long 0;.text;\tmovel $.LP" "DLbuildtrap" ",%%edx;\tcall mcount"
: /* No outputs */
: /* No inputs */
: "eax", "edx", "ecx", "st",
"st(1)","st(2)","st(3)","st(4)","st(5)","st(6)","st(7)" );
with the flags '-O -fstrength-reduce -fsigned-char'
reg-stack.c:constrain_asm_operands() contains the following:
for (j = 0; j < n_operands; j++)
constraints[j] = operand_constraints[j];
/* Compute the number of alternatives in the operands. reload has
already guaranteed that all operands have the same number of
alternatives. */
n_alternatives = 1;
for (q = constraints[0]; *q; q++)
n_alternatives += (*q == ',');
But when n_operands is zero, then constraints[0] is bogus and it
SIGSEGVs.
If you add a test for n-operands before the for (q = contraints[0]; *q; q++)
then everything is fine...
n_alternatives = 1;
if (n_operands)
for (q = constraints[0]; *q; q++)
n_alternatives += (*q == ',');
--
Peter Barada pbarada@wavemark.com
Wizard 781-270-7098 x226
WaveMark Technologies, Inc. 781-270-0193 (fax)
"Real men know that you should never attempt to accomplish with words
what you can do with a flame thrower" --Bruce Ferstein
More information about the Gcc
mailing list