Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Submit feedback
    • Contribute to GitLab
  • Sign in
D
dune-common
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 42
    • Issues 42
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 24
    • Merge Requests 24
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Core Modules
  • dune-common
  • Issues
  • #111

Closed
Open
Opened Jan 15, 2018 by Simon Praetorius@simon.praetorius
  • Report abuse
  • New issue
Report abuse New issue

aligned_alloc not supported by all standard libraries

In file alignedallocator.hh the C11 function aligned_alloc is called that is part of the c++ standard from C++17. Some compilers may provide this functionality in its standard library already, but others not. I've tested on different systems: on our cluster, the standard library does not know aligned_alloc neither in the C library stdlib.h nor using std=c++1z with g++-7. I think, the test #if __APPLE__ is too specific, to find all not working standard libraries.

Better: include a C++ feature test in CheckCXXFeatures.cmake for this function, e.g.

check_cxx_source_compiles("
  #include <cstdlib>
  int main()
  {
    int* p = static_cast<int*>(aligned_alloc(1024, 1024*sizeof *p));
    std::free(p);
  }
" DUNE_SUPPORTS_C_ALIGNED_ALLOC)

maybe in the future, add also a test for c++ standard library implementation of this function, i.e.

check_cxx_source_compiles("
  #include <cstdlib>
  int main()
  {
    int* p = static_cast<int*>(std::aligned_alloc(1024, 1024*sizeof *p));
    std::free(p);
  }
" DUNE_SUPPORTS_CXX_ALIGNED_ALLOC)
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
No due date
0
Labels
None
Assign labels
  • View project labels
Reference: core/dune-common#111