>>>>> "l" == Linus Åkerlund <[EMAIL PROTECTED]> writes:
[....]
  l> loading a text file into it, storing it in a linked list. The problem
  l> is that when I compile it with -O or -O2, it coredumps, and when I
  l> compile it without optimization, it works fine. I'm sure I've done
  l> something wrong, probably something with malloc(), 
[....]

Debug this by using Bruce Perens' ElectricFence library.  It comes on
the Red Hat 5.0 CD.  Find out about how to use it either by reading
the manual page for "libefence" or by reading the recently published
-- and excellent -- Addison-Wesley book "Linux Application
Programming" by our own Johnson and Troan.

  l>                                                   but how come it
  l> works when I compile it without optimization? There really shouldn't
  l> be a difference in whether the program works or not, right?

Basically, if you do stuff the language standard states isn't
guaranteed to work, the compiler can change the behaviour of the
program when you use the optimiser.


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.

Reply via email to