tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* Bug in DEC C V5.6-075?
@ 1998-06-03  7:07 Arno Hahma
  0 siblings, 0 replies; only message in thread
From: Arno Hahma @ 1998-06-03  7:07 UTC (permalink / raw)
  To: tru64-unix-managers

Has anyone encountered problems with the system() call in DU 4.0D,
patch level 1?

I found a following problem:

When a C-program calls an external program with system() and the
called program generates a trap of some kind, the calling C-program
also dies. 

For instance, the C-program calls: sprintf(comm,"fpe");
system(comm). The command "fpe" causes a floating point exception.
As a result, the C-program also dies of floating point exception or
segmentation fault (!?).

As far as I have known, system() does not pass traps, signals etc. 
i.e.  whatever happens to the command called by system(), does
not affect the calling C-program. Has this changed recently or is it a
bug?

The problem arised with upgrading the C-compiler to level V5.6-75. The
previous one did not behave like that.

Interestingly enough, if you compile the program with the -g switch,
i.e. debug code included, the problem does not arise at all! Thus, it
is impossible to use ladebug to see, whether the problem is really at
system() or only later. If you compile with -O (optimize), the
C-program generates a segmentation fault, if there are any problems
with system().

Currently, I am using the -g as a workaround for all programs, that
use the system() call. Otherwise, they crash mysteriously, whenever a 
routine called by the system() does something wrong, such as the
floating exception.

ArNO
    2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-06-03  7:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-06-03  7:07 Bug in DEC C V5.6-075? Arno Hahma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox