Commit 83df876a authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

patch: Add correct offset for end of chunk

This should fix the build failure on 32bit architectures.

Bug: https://gitlab.dune-project.org/core/dune-common/merge_requests/181
parent 4f872ab1
From 040d2a87525568b69555bef24e232ef65cb94c6f Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <Ansgar.Burchardt@tu-dresden.de>
Date: Tue, 22 Nov 2016 15:58:17 +0100
Subject: [PATCH] Add correct offset for end of chunk
Using `&current->chunk_ + x` will add `x * sizeof(current->chunk_)` to
the pointer, but we only want to add `x`.
Adding a much larger number still "works" on 64bit systems (although it
does not perform the intended check). However on 32bit platforms this
wraps (at least in the way used by sllisttest.cc) and the "end" of the
chunk is suddenly before the beginning.
Closes #57
---
dune/common/poolallocator.hh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dune/common/poolallocator.hh b/dune/common/poolallocator.hh
index e18439d..657d8d6 100644
--- a/dune/common/poolallocator.hh
+++ b/dune/common/poolallocator.hh
@@ -525,8 +525,8 @@ namespace Dune
#ifndef NDEBUG
Chunk* current=chunks_;
while(current) {
- if(static_cast<void*>(&current->chunk_)<=b &&
- static_cast<void*>((&current->chunk_)+chunkSize)>b)
+ if(static_cast<void*>(current->chunk_)<=b &&
+ static_cast<void*>(current->chunk_+chunkSize)>b)
break;
current=current->next_;
}
--
2.10.2
soname.patch
skip-dirs-starting-with-dot.patch
rename-git-whitespace-hook.patch
0001-Add-correct-offset-for-end-of-chunk.patch
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment