Bug in DEC C V5.6-075?

From: Arno Hahma <arno_at_nitro.pp.utu.fi>
Date: Wed, 03 Jun 1998 10:07:11 +0300 (EET DST)

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
Received on Wed Jun 03 1998 - 09:11:33 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:37 NZDT