www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/25/11:25:40

To: "Marty Leisner" <leisner AT sdsp DOT mc DOT xerox DOT com>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: libc and include files?
Date: Thu, 25 Aug 94 16:29:10 +0300
From: eliz AT is DOT elta DOT co DOT il

> Here's one I never saw before:
>  -c   -g -o /libgcc/debug/stdio.o io/stdio.c
> Fatal! no memory to copy arguments (max 1000, wanted -21346)
> make.exe: *** [/libgcc/debug/stdio.o] Error 1

I believe this is due to an error already reported by John Polstra
<jdp AT polstra DOT com> which I include below:

------------Begin forwarded message-----------

I happened to notice (thanks to a compiler warning) that the local
variable "argc" is used before it is set in "go32/control.c" function
"set_command_line".  Depending on what random value the variable
contained at that point, it could cause a spurious fatal error
message:
I happened to notice (thanks to a compiler warning) that the local
variable "argc" is used before it is set in "go32/control.c" function
"set_command_line".  Depending on what random value the variable
contained at that point, it could cause a spurious fatal error
message:

    Fatal! no memory to copy arguments (max 1000, wanted %d)

Also, the number printed in the message would be wrong, because the value
of "argv" (a pointer) was printed instead of "argc".

A patch is appended.

   John Polstra                                       jdp AT polstra DOT com
   John D. Polstra & Co., Inc.                   Phone (206) 932-6482
   Seattle, Washington USA                         Fax (206) 935-1262
   "Self-knowledge is always bad news."                 -- John Barth


*** go32/control.c-	Sat Jul 30 21:20:38 1994
--- go32/control.c	Sun Aug 21 14:47:25 1994
***************
*** 1090,1096 ****
  
    a = (word32 *)transfer_buffer;
    if (argc > 1000)
    {
!     fprintf(stderr, "Fatal! no memory to copy arguments (max 1000, wanted %d)\n", argv);
      exit(1);
    }
--- 1090,1097 ----
  
    a = (word32 *)transfer_buffer;
+   for (argc=0; argv[argc]; argc++);
    if (argc > 1000)
    {
!     fprintf(stderr, "Fatal! no memory to copy arguments (max 1000, wanted %d)\n", argc);
      exit(1);
    }

------------End forwarded message--------------

	Eli Zaretskii

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019