delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/02/01/07:28:43

Date: Tue, 1 Feb 94 21:00:28 JST
From: Stephen Turnbull <turnbull AT shako DOT sk DOT tsukuba DOT ac DOT jp>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Segmentation violations in the string library

I have been trying to port Imake (the X Windows portable makefile
builder) to DJGPP and DESQview/X.  Nothing in Imake should be specific
to the DESQview/X environment (ie, it compiles and links if I remove
all references to DVX include and library directories from the
environment), and of course Imake is known to function under all sorts
of environments.  I have got it to compile, but when I try to run it I
get

c:\usr\djgpp\contrib\dvx\imake\config.mit 19:34:02>go32 imake
go32 version 1.11.maint2 Copyright (C) 1993 DJ Delorie
imake: Segmentation violation in pointer 0x8ec08ed8 at d8:37d8
eax=8ec08ed8 ebx=00000000 ecx=000072fc edx=8ec08ed8 esi=8ec08ed8
edi=7fffd800
ebp=7fffc5f8 esp=7fffc5f8 cs=d8 ds=48 es=48 fs=48 gs=38 ss=48
cr2=00008ed8
Call frame traceback EIPs:
  0x000037d8   _strlen+8
  0x00004f76   __doprnt+1802
  0x00002a9c   _fprintf+56
  0x00001955   _LogFatal+79, line 453 of imake.c
  0x00001aab   _cppit+43, line 483 of imake.c
  0x00001333   _main+259, line 253 of imake.c

c:\usr\djgpp\contrib\dvx\imake\config.mit 19:34:21>symify imake

I cannot find any error in the program logic.  I'm not very handy with
debug32 or assembly language, but at that point in strlen() all that
seems to have happened is that strlen() has accessed the first
character in its argument.  Since I don't have a debug library, I
don't know how to isolate the problem in the library source for
fprintf() or _doprnt().
    The call that LogFatal should be making to fprintf() at that point
is
        fprintf(stderr, "Cannot make a pipe.", "")

(That Imake would choke here isn't surprising, since pipe() is a stub
which just makes an error return in DJGPP.  But that shouldn't
interfere with printing out an error message with fprintf().)  Note
that there is no argument in the pattern to correspond to the second
(null) string.  However, similar calls (with no place for a variable
string in the pattern and a null third argument to fprintf()) are
successfully executed elsewhere in Imake.  (They can be induced by
providing incorrect switches on the command line, for example.)
    I haven't been able to construct a small example which does the
same thing.  I've tried taking out the "-O" parameter in the makefile,
but this seems to produce identical code.
    I don't have access to any other recent version of GCC.  So I
can't tell if this is a DJGPP-specific problem, or more generally with
the GNU code generator for the 80x86.
    Any suggestions for how to proceed (especially if they are easy,
ie, I overlooked something really silly!) gratefully accepted.  I
would like to learn how to figure these things out, since I've run
into similar bombs in Ghostscript, for example.

    --Steve

+-----------------------------------------------------------------------+
|                           Stephen Turnbull                            |
|     University of Tsukuba, Institute of Socio-Economic Planning       |
|          Tennodai 1-chome 1--1, Tsukuba, Ibaraki 305 JAPAN            |
|        Phone:  +81 (298) 53-5091     Fax:  +81 (298) 55-3849          |
|               Email:  turnbull AT shako DOT sk DOT tsukuba DOT ac DOT jp                 |
+-----------------------------------------------------------------------+

- Raw text -


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