From 2ccf4d6d153e57d2c416ad2e3a4e5a594696f1b2 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 11 Apr 2022 23:27:50 -0500 Subject: [PATCH] Debug CI crash 14/n [skip ci] --- src/engine/function.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/engine/function.cpp b/src/engine/function.cpp index 43b5653b2..26115f1b1 100644 --- a/src/engine/function.cpp +++ b/src/engine/function.cpp @@ -311,14 +311,14 @@ struct _stack // Get reference to the top i-th T item, optionally as a U. I.e. it skips // the i-th T items returning it as U&. template - remove_cref_t & top(int i = 0) const + remove_cref_t & top(int i = 0) { return *reinterpret_cast( nth( i ) ); } // Get a pointer to the last A-th item skipping over any A pre i-th items. template - remove_cref_t< select_last_t > * get() const + remove_cref_t< select_last_t > * get() { using U = remove_cref_t< select_last_t >; return static_cast( advance(data) ); @@ -357,7 +357,7 @@ struct _stack void * start = nullptr; void * end = nullptr; - mutable void * data = nullptr; + void * data = nullptr; using cleanup_f = void(*)( _stack*, int32_t ); struct cleanup_info { @@ -383,7 +383,7 @@ struct _stack } template - remove_cref_t * nth( int32_t n ) const + remove_cref_t * nth( int32_t n ) { using U = remove_cref_t; assert( ((ptrdiff_t)data) > (1<<4) ); @@ -418,9 +418,12 @@ struct _stack template static void * advance(void * p) { - return (char*)p + assert( ((ptrdiff_t)p) > (1<<4) ); + p = static_cast(p) + sum_advance_size::value - advance_size< select_last_t >::value; + assert( ((ptrdiff_t)p) > (1<<4) ); + return p; } template