[Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules

2024-04-02 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

Mikael Morin  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Mikael Morin  ---
Fixed.

[Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules

2024-03-28 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

--- Comment #4 from GCC Commits  ---
The master branch has been updated by Mikael Morin :

https://gcc.gnu.org/g:7f233feafd657250340be3b3500d2697948ae3ed

commit r14-9703-g7f233feafd657250340be3b3500d2697948ae3ed
Author: Mikael Morin 
Date:   Wed Mar 27 16:30:42 2024 +0100

fortran: Fix specification expression check in submodules [PR114475]

The patch fixing PR111781 made the check of specification expressions more
restrictive, disallowing local variables in specification expressions of
dummy arguments.  PR114475 showed an example where that change regressed,
disallowing in submodules expressions that had been allowed in the parent
module.  In submodules indeed, the hierarchy of namespaces inherited from
the parent module is not reproduced so the host-association of symbols
can't be recognized by checking the nesting of namespaces.

This change fixes the problem by allowing in specification expressions
all the symbols in a submodule that are inherited from the parent module.

PR fortran/111781
PR fortran/114475

gcc/fortran/ChangeLog:

* expr.cc (check_restricted): In submodules, allow variables host-
associated from the parent module.

gcc/testsuite/ChangeLog:

* gfortran.dg/spec_expr_10.f90: New test.

Co-authored-by: Harald Anlauf 

[Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules

2024-03-26 Thread mikael at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

Mikael Morin  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mikael at gcc dot 
gnu.org

--- Comment #3 from Mikael Morin  ---
(In reply to anlauf from comment #2)
> (In reply to Jürgen Reuter from comment #1)
> > I suspect this commit here,
> > https://gcc.gnu.org/git/?p=gcc.git;a=commit;
> > h=44c0398e65347def316700911a51ca8b4ec0a411
> > but not totally certain.
> 
> The following patch fixes the apparent regression:
> 
> diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
> index 9a042cd7040..68d16a9a378 100644
> --- a/gcc/fortran/expr.cc
> +++ b/gcc/fortran/expr.cc
> @@ -3517,6 +3563,7 @@ check_restricted (gfc_expr *e)
>if (e->error
>   || sym->attr.in_common
>   || sym->attr.use_assoc
> + || sym->attr.used_in_submodule
>   || sym->attr.dummy
>   || sym->attr.implied_index
>   || sym->attr.flavor == FL_PARAMETER
> 
Yes, I was coming to the same fix.
I'm not too sure about it though.

> 
> Looks like the commit actually uncovered a latent issue.
> 
> Mikael, do you want to follow up?

Yes, this is mine in any case.

[Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules

2024-03-26 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

--- Comment #2 from anlauf at gcc dot gnu.org ---
(In reply to Jürgen Reuter from comment #1)
> I suspect this commit here,
> https://gcc.gnu.org/git/?p=gcc.git;a=commit;
> h=44c0398e65347def316700911a51ca8b4ec0a411
> but not totally certain.

The following patch fixes the apparent regression:

diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc
index 9a042cd7040..68d16a9a378 100644
--- a/gcc/fortran/expr.cc
+++ b/gcc/fortran/expr.cc
@@ -3517,6 +3563,7 @@ check_restricted (gfc_expr *e)
   if (e->error
|| sym->attr.in_common
|| sym->attr.use_assoc
+   || sym->attr.used_in_submodule
|| sym->attr.dummy
|| sym->attr.implied_index
|| sym->attr.flavor == FL_PARAMETER


Looks like the commit actually uncovered a latent issue.

Mikael, do you want to follow up?

[Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules

2024-03-26 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

 Ever confirmed|0   |1
 Status|UNCONFIRMED |NEW
 CC|anlauf at gmx dot de   |anlauf at gcc dot 
gnu.org
   Last reconfirmed||2024-03-26

[Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules

2024-03-26 Thread rguenth at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P4
Summary|[14.0 Regression]   |[14 Regression] Regression
   |Regression with |with iso_c_binding and
   |iso_c_binding and   |submodules
   |submodules  |
   Target Milestone|--- |14.0