lilypond-devel
[Top][All Lists]
Advanced

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

Re: Assertion failed


From: anders . vinjar
Subject: Re: Assertion failed
Date: Fri, 04 Dec 2015 12:58:33 +0100
User-agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/24.5 (gnu/linux)

    a> a4cc910a Issue 2787: Sanitize usage of -DDEBUG, -DNDEBUG and assert

With the change from -NDEBUG to -DEBUG in commit <a4cc910a>, quite a few
scores makes lilypond crash.  The same happens with releases since then
(19.21++).  The behavior is the same whether DEBUG is on or off when
compiling.

The crashes i've seen are located to some 'assert's not passing,
suggesting bugs or faulty execution in other places in lilypond.  These
asserts are not inside "#ifdef DEBUG" (or "#ifndef NDEBUG" previously).
Unfortunately i'm totally helpless about anything gcc/g++, thus no idea
why this change of flags makes the asserts kick in.

If anyone's interested i've hacked (attached) two asserts breaking one
score.  There are many similar asserts in the sources, making this
something which should be done with a real fix, ie. leaving the asserts
in and fixing the causes for not passing, or get some compilation flags
right.

Cheers,

-anders

diff --git a/flower/include/drul-array.hh b/flower/include/drul-array.hh
index 6ef5fe1..3222c2d 100644
--- a/flower/include/drul-array.hh
+++ b/flower/include/drul-array.hh
@@ -32,7 +32,9 @@ struct Drul_array
   T array_[2];
   T &at (Direction d)
   {
+#ifdef DEBUG
     assert (d == 1 || d == -1);
+#endif
     return array_[ (d + 1) / 2];
   }
   T const &at (Direction d) const
diff --git a/flower/include/interval.hh b/flower/include/interval.hh
index 88cd01f..d6c786d 100644
--- a/flower/include/interval.hh
+++ b/flower/include/interval.hh
@@ -224,7 +224,9 @@ template<class T>
 inline T
 Interval_t<T>::center () const
 {
+#ifdef DEBUG
   assert (!is_empty ());
+#endif
   return (at (LEFT) + at (RIGHT)) / T (2);
 }
 

reply via email to

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