g++ emits unknown 386 instruction guiding
Mark Mitchell
mmitchell@usa.net
Thu Nov 27 12:30:00 GMT 1997
>>>>> "Peter" == Peter Schmid <schmid@ltoi.iap.physik.tu-darmstadt.de> writes:
Peter> When I tryed to remove the guiding declarators in the
Peter> following program I encountered a really strange behaviour
Peter> of the compiler. The assembler says: Error: operands given
Peter> don't match any known 386 instruction. I believe they come
Peter> from invoking call without an argument in line 51 and 75. I
Peter> am using libc-5.4.40 and binutils-2.8.1.0.15. Can someone
Peter> fix this problem. Peter Schmid
I know that the compiler shouldn't emit illegal instructions, but what
you wrote wasn't legal; you're missing the template<> introduction:
template <>
double max<double>(double, double);
is the way to write this, or,
template <>
double max<>(double, double);
and both of these work fine.
Peter> // Prototypes (enable one or the other) double
Peter> max<>(double, double); // int max(int, int);
Peter> int main() { int i = 123; double d = 1234.5678;
Peter> cout.precision(12); cout << max(d, i) << endl; // #1 cout
Peter> << max(i, d) << endl; // #2 return 0; }
Peter> //---------------------------------------------------------------
Peter> // Copyright (c) 1993 by Tom Swan. All rights reserved. //
Peter> Revision 1.00 Date: 02/12/1993 Time: 10:53 am
Peter> g++ -Wall -W -o proto proto.cpp -save-temps proto.cpp:17:
Peter> warning: `max(double, double)' was previously implicitly
Peter> declared to return `int' proto.s: Assembler messages:
Peter> proto.s:51: Error: operands given don't match any known 386
Peter> instruction proto.s:75: Error: operands given don't match
Peter> any known 386 instruction
--
Mark Mitchell mmitchell@usa.net
Stanford University http://www.stanford.edu
More information about the Gcc-bugs
mailing list