bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nested "." commands brings Segmentation Fault (core dumped)


From: Benoit Rochefort
Subject: Re: nested "." commands brings Segmentation Fault (core dumped)
Date: Thu, 21 Feb 2002 11:57:37 -0500 (EST)

Paul Jarc writes:
] Chet Ramey <address@hidden> wrote:
] >> nested "." commands brings Segmentation Fault (core dumped).
] >> Probably due to infinite recursion that (in my sense) should be
] >> trapped otherwise.
] >
] > If you're going to insist on shooting yourself in the foot, bash will
] > happily supply the ammunition, and, in some cases, even load the gun
] > for you.
] 
] But it shouldn't shoot itself in the head.  Memory allocation errors
] should be noticed and reported at allocation time; SIGSEGV seems to
] indicate that an allocation is failing but bash doesn't notice until
] later when it tries to use the missing memory.

It can also happen as a lack of memory in the stack (which can be very
difficult to trap). Try this:

###############################################################################
void foo (void);
int a = 0;
void foo (void) { foo(); a++; }
int main (void) { foo(); return 0; }
###############################################################################

a++ is there so the compiler won't optimise a tail-recursion call, but
checkout for the assmbler code before executing.


] 
] 
] paul

-- 
           *º¤., ¸¸,.¤º*¨¨¨*¤  Benoit Rochefort  *º¤., ¸¸,.¤º*¨¨¨*¤



reply via email to

[Prev in Thread] Current Thread [Next in Thread]