Skip to content
Snippets Groups Projects
  • Tobias Burnus's avatar
    3d72e50c
    OpenMP: 'allocate' directive - fixes for 'alignof' and [[omp::decl]] · 3d72e50c
    Tobias Burnus authored
    Fixed a check to permit [[omp::decl(allocate,...)]] parsing in C.
    
    Additionaly, we discussed that 'allocate align' should not affect
    'alignof' to avoid issues like with:
    
      int a;
      _Alignas(_Alignof(a)) int b;
      #pragma omp allocate(a) align(128)
      _Alignas(_Alignof(a)) int c;
    
    Thus, the alignment is no longer set in the C and Fortran front ends,
    but for static variables now in varpool_node::finalize_decl.
    (For stack variables, the alignment is handled in gimplify_bind_expr.)
    
    NOTE: 'omp allocate' is not yet supported in C++.
    
    gcc/c/ChangeLog:
    
    	* c-parser.cc (c_parser_omp_allocate): Only check scope if
    	not in_omp_decl_attribute. Remove setting the alignment.
    
    gcc/ChangeLog:
    
    	* cgraphunit.cc (varpool_node::finalize_decl): Set alignment
    	based on OpenMP's 'omp allocate' attribute/directive.
    
    gcc/fortran/ChangeLog:
    
    	* trans-decl.cc (gfc_finish_var_decl): Remove setting the alignment.
    
    libgomp/ChangeLog:
    
    	* libgomp.texi (Memory allocation): Mention (non-)effect of 'align'
    	on _Alignof.
    	* testsuite/libgomp.c/allocate-7.c: New test.
    
    gcc/testsuite/ChangeLog:
    
    	* c-c++-common/gomp/allocate-18.c: Check that alignof is unaffected
    	by 'omp allocate'.
    	* c-c++-common/gomp/allocate-19.c: Likewise.
    3d72e50c
    History
    OpenMP: 'allocate' directive - fixes for 'alignof' and [[omp::decl]]
    Tobias Burnus authored
    Fixed a check to permit [[omp::decl(allocate,...)]] parsing in C.
    
    Additionaly, we discussed that 'allocate align' should not affect
    'alignof' to avoid issues like with:
    
      int a;
      _Alignas(_Alignof(a)) int b;
      #pragma omp allocate(a) align(128)
      _Alignas(_Alignof(a)) int c;
    
    Thus, the alignment is no longer set in the C and Fortran front ends,
    but for static variables now in varpool_node::finalize_decl.
    (For stack variables, the alignment is handled in gimplify_bind_expr.)
    
    NOTE: 'omp allocate' is not yet supported in C++.
    
    gcc/c/ChangeLog:
    
    	* c-parser.cc (c_parser_omp_allocate): Only check scope if
    	not in_omp_decl_attribute. Remove setting the alignment.
    
    gcc/ChangeLog:
    
    	* cgraphunit.cc (varpool_node::finalize_decl): Set alignment
    	based on OpenMP's 'omp allocate' attribute/directive.
    
    gcc/fortran/ChangeLog:
    
    	* trans-decl.cc (gfc_finish_var_decl): Remove setting the alignment.
    
    libgomp/ChangeLog:
    
    	* libgomp.texi (Memory allocation): Mention (non-)effect of 'align'
    	on _Alignof.
    	* testsuite/libgomp.c/allocate-7.c: New test.
    
    gcc/testsuite/ChangeLog:
    
    	* c-c++-common/gomp/allocate-18.c: Check that alignof is unaffected
    	by 'omp allocate'.
    	* c-c++-common/gomp/allocate-19.c: Likewise.