<div dir="auto">push to obs pls.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 21, 2020, 10:20 Berthold Stoeger <<a href="mailto:bstoeger@mail.tuwien.ac.at">bstoeger@mail.tuwien.ac.at</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok, this one is weird.<br>
<br>
On Dienstag, 21. April 2020 08:44:09 CEST Chirana Gheorghita Eugeniu Theodor <br>
wrote:<br>
<br>
> /usr/include/c++/9/bits/stl_vector.h:1042: std::vector<_Tp,<br>
> _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](std::vector<_Tp,<br>
> _Alloc>::size_type) [with _Tp = int; _Alloc = std::allocator<int>;<br>
> std::vector<_Tp, _Alloc>::reference = int&; std::vector<_Tp,<br>
> _Alloc>::size_type = long unsigned int]: Assertion '__builtin_expect(__n <<br>
> this->size(), true)' failed.<br>
<br>
That appears to be g++, right? To me this looks like it trips on an assertion <br>
of a "vector[n]" access. The one thing I found in the offending function was a <br>
construct of the type<br>
  "&mean[0]"<br>
to pass an array down to C, which *technically* is indeed undefined behavior <br>
if "mean" is empty. However, the whole point of operator[] is that it is <br>
unchecked and as long as the callee doesn't access the array, this should work <br>
just fine. After all it is only taking an address.<br>
<br>
Therefore, I replaced above construct by "mean.data()" and put the call in an <br>
if for good measure:<br>
  <a href="https://github.com/Subsurface-divelog/subsurface/pull/2778" rel="noreferrer noreferrer" target="_blank">https://github.com/Subsurface-divelog/subsurface/pull/2778</a><br>
Please test this.<br>
<br>
If my suspicion is correct, I consider that very unfriendly behavior of the <br>
compiler / library. @Dirk: does that version compile with other than the <br>
default settings?<br>
<br>
Berthold<br>
<br>
<br>
<br>
</blockquote></div>