From: Roy S. <roy...@ic...> - 2017-03-13 17:43:11
|
On Mon, 13 Mar 2017, John Peterson wrote: > On Mon, Mar 13, 2017 at 11:06 AM, Barna Becsek <bar...@gm...> wrote: > > I was able to overcome the problem with a little help from a > friend. > Basically what I did is replace “this->qrule->get_weights()” > with “const_cast<const QBase *>(this->qrule)->get_weights()” > and everything worked fine! > I, however, still don’t understand why this would be > necessary. In theory qrule already is a QBase pointer. > > > const_cast compiles down to literally no machine instructions IIRC. This can't really have fixed the problem. Technically this ought to cause the const get_weights() to get called instead of the non-const, which would cause a const vector reference to be returned instead of non-const... but then the vector reference would have been cast to const regardless by the call to compute_map(), so you're right in this case; no machine instructions in the end. > Maybe there was not problem in the first place, or maybe you have a > Heisenbug... the latter can sometimes be "fixed" with an innocuous > change like adding a print statement... This looks a *lot* like the one-line-of-magic-garbage I had in one of my applications when first starting out with libMesh. I never found a bug associated with it, but when I stopped using the Red Hat "gcc 2.96" fork the problem went away for good. --- Roy |