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

Re: An Obscure Bug



On Tue, 4 Dec 2001, Behdad Esfahbod wrote:

> Didn't segfault on RH7.1, gcc-2.96-85, glibc-2.2.4-19, would you
> please explain the change in your program that solves the segfault?
>
>

Here's the patch:

--- scans.c.old	Tue Dec  4 18:30:49 2001
+++ scans.c	Tue Dec  4 18:31:24 2001
@@ -89,6 +89,12 @@

     /* Mark this state as visited, so it won't be recursed into again. */
     ptr_state_with_locations->visited |= FCS_VISITED_VISITED;
+
+    {
+        static int counter=0;
+        printf("Hello!%i!\n", counter++);
+        fflush(stdout);
+    }

     /* Count the free-cells */
     num_freecells = 0;

As you can see, I just defined a counter and I print and increment it. I
also tried it with a single printf("Hello!\n") and it also solved it.

Regards,

	Shlomi Fish



> On Tue, 4 Dec 2001, Shlomi Fish wrote:
>
> >
> > I discovered an obscure bug which I am able to reproduce only under very
> > rare circumctances. Here are the instructions for re-producing it:
> >
> > Download
> > http://vipe.technion.ac.il/~shlomif/obscure-bug.tar.gz
> >
> > Unpack and type make. Then type "source test.sh" at the command line and
> > press enter. Voila - a segfault.
> >
> > Now, "./test.sh" doesn't cause it. The program in question was written by
> > me (it's version 1.11.24 of Freecell Solver), and is compiled with the
> > "-O3" flag by gcc. If it's compiled with "-O2" it doesn't segfault.
> > Nor does it when compiled with kgcc. Moreover, after I made a very small
> > change in the program, it did not segfault either. Finally, running it
> > under gdb cause it not to crash either.
> >
> > I'm using Mandrake 8.1 with KDE 2.2.1 and all of the up-to-current
> > updates. My kernel is 2.4.13-12mdk from cooker.
> >
> > I'll appreciate if anyone can shed some light on the subject.
> >
> > Regards,
> >
> > 	Shlomi Fish
> >
> > ----------------------------------------------------------------------
> > Shlomi Fish        shlomif@t2.technion.ac.il
> > Home Page:         http://t2.technion.ac.il/~shlomif/
> > Home E-mail:       shlomif@techie.com
> >
> > If:
> > 1. A is A
> > 2. A is not not-A
> > does it imply that
> > 1. B is B
> > 2. B is not not-B
> >
> >
> > =================================================================
> > To unsubscribe, send mail to linux-il-request@linux.org.il with
> > the word "unsubscribe" in the message body, e.g., run the command
> > echo unsubscribe | mail linux-il-request@linux.org.il
> >
>
> --
> Behdad
> 13 Azar 1380, 2001 Dec 4
>
> [Finger for Geek Code]
>



----------------------------------------------------------------------
Shlomi Fish        shlomif@t2.technion.ac.il
Home Page:         http://t2.technion.ac.il/~shlomif/
Home E-mail:       shlomif@techie.com

If:
1. A is A
2. A is not not-A
does it imply that
1. B is B
2. B is not not-B


=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il