Commit graph

29 commits

Author SHA1 Message Date
daace8527a investigation: Segfault in GDB (IV) (related to #946)
now isolated the problem.
It is triggered by a std::function bound to a lambda
where some argument type is picked up from the
template parameter of the enclosing function.
2015-08-16 01:17:35 +02:00
f041e974c6 investigation: Segfault in GDB (III)
narrow down involved parts...
2015-08-16 01:16:20 +02:00
28d117820a investigation: Segfault in GDB (II)
narrow down involved parts
2015-08-16 01:16:20 +02:00
a203cfaf20 investigation: Segfault in GDB (I)
after upgrading my system to Debian/Jessie,
I get a segfault in gdb, on attempt to launch the test-suite.

By reducing the modules linked into the test-suite, I could
narrow down the problematic code. It should be noted though,
that this code is not the only problematic object, rather it
is one of several ways to make gdb crash. I picked this example,
as it is rather recent code and lookes fairly straight forward.

Next step was to extract the first segment of the unit test
and plant it into a simple executable with a main function
and without any fancy loading of dynamic libraries.
So it turns out that shared object loading is *not* involved.

But some "interesting" new C++11 constructs are involved,
like passing a local function-ref into a lambda, which later
on will be wrapped into a Lumiera Iterator and then evaluated
through a range-for-loop. Sounds interesting
2015-08-16 01:16:20 +02:00
088e4422fb Test helper to show demangled C++ names
Heureka! found out that the C++ standard library exposes a
cross vendor C++ ABI, which amongst others allows to show
object code names and type-IDs in the language-level, human
readable unmangeld form.

Of course, actual application code should not rely on such a
internal representation, yet it is of tremendous help when
writing and debugging unit tests.

Signed-off-by: Ichthyostega <prg@ichthyostega.de>
2014-11-22 03:31:59 +01:00
4145452397 factor out a diagnostics helper for variadic templates
a nice offspring of this investigation
2014-09-22 03:37:07 +02:00
6fa8b41e1d Research: gotcha!
the alledged compiler error turned out to be
just plain flat lack of attention on my side.

I forgot to revert an previous experimental change:
The "wrapper" in the factory takes the argument by-value
(I forgot to add he && back in, which I removed while
fighting with other compilation problems)
2014-09-22 01:16:46 +02:00
e676eb6da8 Research: extend to variadic template calls
also improve the diagnostics to show pass-by LRef or RRef

but unfortunately not able to reproduce the problematic case yet
2014-09-21 19:26:35 +02:00
264b7e8e0f Research: corner cases of "perfect forwarding" 2014-09-21 02:54:54 +02:00
f00450a06c ..and use this trait to build an automatic bridge from boost::hash to std::hash
this completes the exploration; we should now be able to use
any type with boost hash support in the std unordered containers
without much ado.

I wasn't able to come up with a completely modular solution, since
the std::hash template has only one template parameter, which
defeats using enable_if. But since we're controling the default
implementation after the Hijacking anyway, we can as well go
ahead directly to forward to an existing boost::hash function
2014-08-17 03:23:35 +02:00
60b40de3d8 construct a trait to detect boost hash compatibility
this turns out to be quite tough, since boost::hash
just requires a free function 'hash_value' to be
"somehow" present, which might be just through ADL.

My solution is to inject an fallback declaration of such a function,
but only in the namespace where the trait template is defined.
Hopefully this never interferes with real hash functions defined
for use by boost::hash
2014-08-16 04:54:31 +02:00
7391d02c35 investigate the hijacking trick proposed by "enobayram"
...push away the definition from the standard library
and plant our own definition instead -- with a marker
typedef for metaprogramming
2014-08-16 02:04:29 +02:00
e205e1e1a0 investigation of hash function extension points (#722)
start a systematic research about the coexistence of
std::hash and boost::hash. The goal is to build an
automatic bridge function -- but this is hampered by
the unfortunate standard implementation of std::hash

Since meanwhile even the GCC people seem to have realized
this wasn't a good idea, I am geared towards using a hack
to work around this problem, which can be expected to go
away with GCC 4.8.x

A possible idea how to construct such a workaround is
http://stackoverflow.com/questions/12753997/check-if-type-is-hashable


I start this investigation by defining two custom types,
each with his own extension point for hashing. The goal
would then be to use both in a standard hashtable container.
2014-08-13 04:18:38 +02:00
faf62cf8af DOC: start a page with C++11 notes (here: about type conversion)
note down some results found out during the C++11 transition.
There is now a clear distinction between automatic type conversion
and the ability to construct a new instance
2014-08-13 03:08:00 +02:00
a205653cad C++ uses a more precise meaning of 'convertiblity' now
Conversion means automatic conversion. In our case,
what we need ist the ability to *construct* a bool from
our (function) object -- while functors aren't automatically
convertible to bool. Thus we use one of the new predicates
from <type_traits>
2014-05-09 00:56:31 +02:00
7be1b7d35d Switch from TR1 preveiw to the new standard headers
- functional
- memory
- unordered collections
2014-04-03 22:42:48 +02:00
cdb3d3045a BUG: Clang shows a problem when accessing templated static variable through separate compilation units
this is really creepy: the same(!) instance of the singleton factory
sees different addresses of the class static variable, depending on
the compilation unit.

Please note that the type of the concrete factory function is *erased*
when exiting the constructor function of ConfigurableHolder
2013-10-06 23:17:18 +02:00
4bd9eeb8ee bughunt: re-create the whole 2nd layer with a configurable product type --> HIT
Now we've reprduced the problematic situation in isolation
2013-10-06 23:17:18 +02:00
675b2070ce bughunt: attempt to rebuild the problematic structure stand-alone... --> MISS
this is only a stripped-down version of the basic singleton, without
the indirection. Unsurprisingly, this doesn't exhibit the problem yet
2013-10-06 23:17:18 +02:00
0e8a1f1e08 bughunt: use a single SingletonSub instance in two compilation units --> HIT
basically this reproduces the problem in a simplified setup.
Especially note that we're going through a single instance of the factory,
yet still this single instance 'sees' two different locations of the
class static variable
2013-10-06 23:17:18 +02:00
72bd94e141 bughunt: replace the ConfigResolver with a direct instantiation of Singleton -> MISS
thus not lib::Singleton is the culprit, it must be lib::SingletonSubclass
2013-10-06 23:17:18 +02:00
10a511d29c bughunt: build testcase statically linked
...but still dynamically linking against the core lib
But the actual template instantiations happen now within the two
compilation units, which are linked statically.

When looking into the symbol table, we can see that the static
field is emitted two times

readelf -W target/clang-static-init -s | c++filt |less
2013-10-06 23:17:18 +02:00
cec78fdc58 bughunt: extract a call sequence leading to a strange init error with Clang
Observations:
 - the initial observation was that we get two instances of the config rules service
 - obviously this it is *not* the initialisation of a static variable accessed from
    multiple compilation units. But the access from two compilation units is crucial
 - we can exclude the effect of all other initialisation. It *is* in SingletonSubclass
 - we can exclude the effect of dynamic linking. Even two translation units
    linked statically exhibit the same problem

rebuild this test case in the research area, to be able to verify with various compilers
2013-10-06 23:17:18 +02:00
d2f83523ca join recent player subsystem work, SCons overhaul and documentation 2012-01-11 07:54:43 +01:00
f84da63e11 use import/export instead of passing an artefacts map 2012-01-11 07:05:00 +01:00
9bba366763 investigate partial application of member functions 2012-01-07 03:28:12 +01:00
c134026502 for experimenting with -O3 2012-01-07 02:53:07 +01:00
e054c272b6 research: detecting the possibility of a string conversion
find out about the corner cases of this
simplistic implementation
2011-12-31 06:46:50 +01:00
07002ab3af SCons: new build target for experimental code 2011-12-03 06:10:12 +01:00