Quantcast

access violation in Handle.h (cgal 4.9, apple clang 7.3, C++14)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

access violation in Handle.h (cgal 4.9, apple clang 7.3, C++14)

mistafunk
hi

i am seeing an access violation in Handle.h:56. for some reason, the returned reference by Lazy::zero() does not seem to be valid. the problem is reproducible with cgal 4.9 and apple clang 7.3 (-std=c++14). the stacktrace is attached.

in Lazy::zero(), the macro CGAL_STATIC_THREAD_LOCAL_VARIABLE is used and its definition looks like this (tss.h:34, note that apple clang 7.3 does not yet support thread_local):

# define CGAL_STATIC_THREAD_LOCAL_VARIABLE(TYPE, VAR, ARG1) \
static boost::thread_specific_ptr<TYPE> VAR##_ptr; \
if(VAR##_ptr.get() == NULL) {VAR##_ptr.reset(new TYPE(ARG1));} \
TYPE& VAR = * VAR##_ptr.get()

so i am basically trying to understand how Lazy::zero() can return an invalid reference.

thanks & best,
simon
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: access violation in Handle.h (cgal 4.9, apple clang 7.3, C++14)

Laurent Rineau (CGAL/GeometryFactory)
Le Monday, January 23, 2017 6:34:02 AM CET mistafunk a ?crit :

> hi
>
> i am seeing an access violation in Handle.h:56. for some reason, the
> returned reference by Lazy::zero() does not seem to be valid. the problem
> is reproducible with cgal 4.9 and apple clang 7.3 (-std=c++14). the
> stacktrace
> <http://cgal-discuss.949826.n4.nabble.com/file/n4662484/stacktrace.txt>  
> is attached.
>
> in Lazy::zero(), the macro CGAL_STATIC_THREAD_LOCAL_VARIABLE is used and
> its definition looks like this (tss.h:34, note that apple clang 7.3 does
> not yet support thread_local):
>
> # define CGAL_STATIC_THREAD_LOCAL_VARIABLE(TYPE, VAR, ARG1) \
> static boost::thread_specific_ptr<TYPE> VAR##_ptr; \
> if(VAR##_ptr.get() == NULL) {VAR##_ptr.reset(new TYPE(ARG1));} \
> TYPE& VAR = * VAR##_ptr.get()
>
> so i am basically trying to understand how Lazy::zero() can return an
> invalid reference.
>
> thanks & best,
> simon

How can you tell that it is `Lazy::zero()` that triggers the error? I do not
see that from the backtrace.

Do you have multiple threads?


It could be that a bad JNI call, or a double-free, or a use-after-free, has
corrupted the heap or stack. You should try to reproduce the same issue in a
standalone C++ file, without Java. Doing that, you will probably find out the
issue by yourself. Otherwise, post your code to an online web service, like
gist.github.com and show us the code.

--
Laurent Rineau, PhD
R&D Engineer at GeometryFactory           http://www.geometryfactory.com/
Release Manager of the CGAL Project       http://www.cgal.org/


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss


Loading...