This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Hopeful patch for configure breakage



 > Yes, but does it cause trouble in practice?  The alternatives we have
 > are (a) back out the patch (something I would prefer to avoid, but it
 > may be necessary), (b) figure out a way to compile and run a program
 > on the build machine (which can be done, but would be a pain).
 > zw

Why aren't we using the `strings' program?  Is it not ubiquitous?

Here's a gross but possibly portable strategy.  YMMV.

Compile two files, one contains:

struct possibility {
  char prefix[8];
  double candidate;
  char postfix[8];
};

the other contains:

struct possibility {
  char prefix[8];
  char expected[8];
  char postfix[8];
};

Then loop in the shell over each float-number/expected-string pair.
Initialize the struct in file 1 with the float number and the struct
in file 2 with the expected string of chars and compile both files
with -c.

Then do a tail +16c on the two files and pass them to cmp (like we do
in "make compare".)  If the two object files match (minus the first 16
chars) then you've found the floating point format.  (This is assuming
that the float/string wasn't stored in the first 16 characters, not
sure if that torpedoes my suggestion.)

I'd much prefer you used the `strings' program though. :-)

		--Kaveh
--
Kaveh R. Ghazi			Engagement Manager / Project Services
ghazi@caip.rutgers.edu		Qwest Internet Solutions


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]