aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2019-06-20 21:39:43 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2019-06-20 21:39:43 +0000
commit966e7f731ef7ea019e681b7b53421c6857315c4a (patch)
tree6485f0b28abef1033edc631d2a0a55b4b2f1c00e /gcc
parent145f748f0ca4c9716e242ec03f134b7140f0e2c3 (diff)
downloadgcc-966e7f731ef7ea019e681b7b53421c6857315c4a.zip
gcc-966e7f731ef7ea019e681b7b53421c6857315c4a.tar.gz
gcc-966e7f731ef7ea019e681b7b53421c6857315c4a.tar.bz2
re PR fortran/86587 (Derived-type with attributes BIND(C) and PRIVATE raises an error but standard accepts it)
2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/86587 * symbol.c (verify_bind_c_derived_type): Remove erroneous error checking for BIND(C) and PRIVATE attributes. 2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/86587 * gfortran.dg/pr86587.f90: New test. From-SVN: r272524
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/symbol.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr86587.f9018
4 files changed, 29 insertions, 10 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 30bf112..7b71ee4 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86587
+ * symbol.c (verify_bind_c_derived_type): Remove erroneous error
+ checking for BIND(C) and PRIVATE attributes.
+
2019-06-20 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/90937
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index ec75322..f427363 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -4529,16 +4529,6 @@ verify_bind_c_derived_type (gfc_symbol *derived_sym)
curr_comp = curr_comp->next;
} while (curr_comp != NULL);
-
- /* Make sure we don't have conflicts with the attributes. */
- if (derived_sym->attr.access == ACCESS_PRIVATE)
- {
- gfc_error ("Derived type %qs at %L cannot be declared with both "
- "PRIVATE and BIND(C) attributes", derived_sym->name,
- &(derived_sym->declared_at));
- retval = false;
- }
-
if (derived_sym->attr.sequence != 0)
{
gfc_error ("Derived type %qs at %L cannot have the SEQUENCE "
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a3c2205..c6130e5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/86587
+ * gfortran.dg/pr86587.f90: New test.
+
2019-06-20 Iain Sandoe <iain@sandoe.co.uk>
* obj-c++.dg/stubify-1.mm: Adjust options and scan-asm checks.
diff --git a/gcc/testsuite/gfortran.dg/pr86587.f90 b/gcc/testsuite/gfortran.dg/pr86587.f90
new file mode 100644
index 0000000..fb21335
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr86587.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+! PR fortran/86587
+! Code contirubted by Valentin Clement <valentin.clement at env dot ethz dot ch>
+!
+module mod1
+ use iso_c_binding
+ type, bind(c), private :: mytype
+ integer(c_int) :: i1, i2
+ end type
+end module mod1
+
+module mod2
+ use iso_c_binding
+ private
+ type, bind(c) :: mytype
+ integer(c_int) :: i1, i2
+ end type
+end module mod2