Re: Ask for help

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

 



Dear Mr. Haley:

Thank you for your suggestions. 

I will read the materials at
http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html and
try to find the bugs in my program. 

Thank you for very much your time and help. 

Wanxia


Quoting Andrew Haley <aph@xxxxxxxxxx>:

> Wei, Wanxia wrote:
> 
> > My C program is a local search algorithm for solving SAT (Satisfiability problem).
> The
> > following is a brief description of this program. 
> > 
> > This program uses random integers to generate an initial assignment to a SAT
> instance.
> > Then, it chooses a variable by using a heuristic and then flips this variable
> (flip
> > means to change the value of a variable from 0 to 1 or from 1 to 0) in each search
> > step. After many search steps, if the assignment satisfies the instance, this
> program
> > stops. If the assignment still does not satisfy the instance after many search
> steps,
> > this program stops after a predefined number of search steps. The number of search
> > steps is what I call performance in my previous e-mail. In addition, this program
> uses
> > both static and dynamic allocations. 
> > 
> > When I ran the two executables with different options on some SAT instances, they
> have
> > different flip numbers (the parameters for these two executables are the same. For
> > example, I use the same seed for them to generate initial assignments).  I ran the
> > executable generated by using â??gcc -m32 â??O3 â??lmâ?? on a wide range of
> instance on
> > different servers for more than 1 year but I never got any errors (such as core
> dump).
> 
> Well, this is hard.  If your program behaves differently when
> -fno-strict-aliasing is used then it's very likely that, yes, your
> program has a bug.  But for me to explain what -fno-strict-aliasing
> does requires you to have a fairly good understanding of the C
> language. There's a fairly good explanation at
> http://www.cellperformance.com/mike_acton/2006/06/understanding_strict_aliasing.html
> 
> In summary,
> 
> "Dereferencing a cast of a variable from one type of pointer to a different type is
> _usually_ in violation of the strict aliasing rule."
> 
> Andrew.
> 




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux