[MLton-devel] RedHat 7.1/7.3 problems

Matthew Fluet Matthew Fluet <fluet@CS.Cornell.EDU>
Wed, 11 Sep 2002 16:31:26 -0400 (EDT)


> Maybe we can take MLton out of the mix, since the generated C and
> assembly should be the same on all machines.  Have you tried tests
> with compiling simple C files on a 7.3 machine and linking/runing them
> a 7.1?

That revealed something interesting:

[fluet@cfs38 ~/Temp 16]% cat z.c
#include <string.h>
#include <stdio.h>

int MLton_init(int argc, char** argv) {
  int i;
  printf("MLton_init:\n");
  printf("argc = %i\n", argc);

  i = 1;
  if (argc > 1 && (0 == strcmp (argv [1], "@MLton"))) {
    int done;

    /* process @MLton args */
    i = 2;
    done = 0;
    while (!done) {
      if (i == argc) {
        printf("i == argc\n");
        return i;
      } else {
        char* arg;

        arg = argv[i];
        printf("argv[%i] = %s\n", i, argv[i]);
        if (0 == strcmp (arg, "gc-summary")) {
          ++i;
        } else if (0 == strcmp (arg, "--")) {
          ++i;
          done = 1;
        } else if (i > 1) {
          printf ("i > 1\n");
          return i;
        } else done = 1;
      }
    }
  }
  return i;
}
[fluet@cfs38 ~/Temp 17]% gcc -O1 -c -o z.o z.c
[fluet@cfs05 ~/Temp 43]% cat y.c

#include "z.h"
#include <stdio.h>

int main(int argc, char** argv) {
  int i, start;
  start = MLton_init(argc, argv);
  printf("Main:\n");
  for (i = start; i < argc; i++)
    printf("argv[%i] = %s\n", i, argv[i]);
  return 1;
}
[fluet@cfs05 ~/Temp 44]% gcc -O1 -o y y.c z.o
[fluet@cfs05 ~/Temp 45]% ./y @MLton gc-summary -- foo bar
MLton_init:
argc = 6
gc-summaryMain:
argv[2] = gc-summary
argv[3] = --
argv[4] = foo
argv[5] = bar

That's clearly wrong.

[fluet@cfs38 ~/Temp 18]% gcc -c -o z.o z.c
[fluet@cfs05 ~/Temp 47]% ./y @MLton gc-summary -- foo bar
MLton_init:
argc = 6
argv[2] = gc-summary
argv[3] = --
Main:
argv[4] = foo
argv[5] = bar

That's o.k

[fluet@cfs38 ~/Temp 19]% gcc -O1 -c -o z.o z.c
[fluet@cfs05 ~/Temp 48]% gcc -o y y.c z.o
[fluet@cfs05 ~/Temp 49]% ./y @MLton gc-summary -- foo bar
MLton_init:
argc = 6
argv[2] = gc-summary
argv[3] = --
Main:
argv[4] = foo
argv[5] = bar

As is that.

[fluet@cfs38 ~/Temp 20]% gcc -c -o z.o z.c
[fluet@cfs05 ~/Temp 50]% gcc -o y y.c z.o
[fluet@cfs05 ~/Temp 51]% ./y @MLton gc-summary -- foo bar
MLton_init:
argc = 6
argv[2] = gc-summary
argv[3] = --
Main:
argv[4] = foo
argv[5] = bar

And this too.


What's truly peculiar is the fact that gcc is the same on all the
machines.  The assembler and linker aren't passed -On flags.  But, at
least that confirms that it is not a MLton bug in particular; it is in
fact some form of binary compatibility problem between the systems.



-------------------------------------------------------
In remembrance
www.osdn.com/911/
_______________________________________________
MLton-devel mailing list
MLton-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlton-devel