Skip to content

Commit

Permalink
[flang] Add bind(C) to buitlin C_PTR
Browse files Browse the repository at this point in the history
D131585 Adds couple of semantics check for the components of BIND(C)
derived-type. This would raise an error when a component is of C_PTR
type. Add `bind(c)` to the `__builtin_c_ptr` type so the wrong error
is not triggered.

Reviewed By: peixin, jeanPerier

Differential Revision: https://reviews.llvm.org/D132350
  • Loading branch information
clementval committed Aug 22, 2022
1 parent e5d5146 commit a6e155f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion flang/module/__fortran_builtins.f90
Expand Up @@ -19,7 +19,7 @@
private :: selected_int_kind
integer, parameter, private :: int64 = selected_int_kind(18)

type :: __builtin_c_ptr
type, bind(c) :: __builtin_c_ptr
integer(kind=int64) :: __address
end type

Expand Down
11 changes: 11 additions & 0 deletions flang/test/Semantics/bind-c07.f90
@@ -0,0 +1,11 @@
! RUN: bbc -emit-fir -o - %s | FileCheck %s

module bind_c_type
use, intrinsic :: iso_c_binding

type, bind(C) :: t
type(c_ptr) :: tcptr = C_NULL_PTR
end type
end module

! CHECK-LABEL: _QMbind_c_typeE.di.t.tcptr

0 comments on commit a6e155f

Please sign in to comment.