public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules
@ 2024-03-25 23:10 juergen.reuter at desy dot de
  2024-03-25 23:17 ` [Bug fortran/114475] " juergen.reuter at desy dot de
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: juergen.reuter at desy dot de @ 2024-03-25 23:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

            Bug ID: 114475
           Summary: [14.0 Regression] Regression with iso_c_binding and
                    submodules
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juergen.reuter at desy dot de
  Target Milestone: ---

Between ca. March 18 and March 25, a regression has been introduced into the
gfortran 14.0.1 code, which makes the following valid code fail to compile, cf.
below:
gfortran  -c t1.f90
t1.f90:28:13:

   28 | submodule (t1) t1_s
      |             1
Error: Variable ‘n_external’ cannot appear in the expression at (1)

It would be cool if that could be fixed before the release of gcc 14.1 which I
believe is very soon. 



module t1
  use, intrinsic :: iso_c_binding !NODEP!                                       
  implicit none
  private
  public :: t1_t
  integer :: N_EXTERNAL = 0

  type :: t1_t
  contains
    procedure :: set_n_external => t1_set_n_external
  end type t1_t

  abstract interface
     subroutine ol_eval (id, pp, emitter) bind(C)
       import
       real(kind = c_double), intent(in) :: pp(5 * N_EXTERNAL)
     end subroutine ol_eval
  end interface
  interface
    module subroutine t1_set_n_external (object, n)
      class(t1_t), intent(inout) :: object
      integer, intent(in) :: n
    end subroutine t1_set_n_external
  end interface

end module t1

submodule (t1) t1_s
  implicit none
contains
  module subroutine t1_set_n_external (object, n)
    class(t1_t), intent(inout) :: object
    integer, intent(in) :: n
    N_EXTERNAL = n
  end subroutine t1_set_n_external

end submodule t1_s

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/114475] [14.0 Regression] Regression with iso_c_binding and submodules
  2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
@ 2024-03-25 23:17 ` juergen.reuter at desy dot de
  2024-03-26  8:06 ` [Bug fortran/114475] [14 " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: juergen.reuter at desy dot de @ 2024-03-25 23:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

--- Comment #1 from Jürgen Reuter <juergen.reuter at desy dot de> ---
I suspect this commit here,
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=44c0398e65347def316700911a51ca8b4ec0a411
but not totally certain.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules
  2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
  2024-03-25 23:17 ` [Bug fortran/114475] " juergen.reuter at desy dot de
@ 2024-03-26  8:06 ` rguenth at gcc dot gnu.org
  2024-03-26 17:48 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2024-03-26  8:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

Richard Biener <rguenth at gcc dot gnu.org> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules
  2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
  2024-03-25 23:17 ` [Bug fortran/114475] " juergen.reuter at desy dot de
  2024-03-26  8:06 ` [Bug fortran/114475] [14 " rguenth at gcc dot gnu.org
@ 2024-03-26 17:48 ` anlauf at gcc dot gnu.org
  2024-03-26 19:23 ` anlauf at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-26 17:48 UTC (permalink / raw)
  To: 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules
  2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
                   ` (2 preceding siblings ...)
  2024-03-26 17:48 ` anlauf at gcc dot gnu.org
@ 2024-03-26 19:23 ` anlauf at gcc dot gnu.org
  2024-03-26 21:03 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: anlauf at gcc dot gnu.org @ 2024-03-26 19:23 UTC (permalink / raw)
  To: 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?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules
  2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
                   ` (3 preceding siblings ...)
  2024-03-26 19:23 ` anlauf at gcc dot gnu.org
@ 2024-03-26 21:03 ` mikael at gcc dot gnu.org
  2024-03-28 10:40 ` cvs-commit at gcc dot gnu.org
  2024-04-02 13:14 ` mikael at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2024-03-26 21:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

Mikael Morin <mikael at gcc dot gnu.org> 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 <mikael at gcc dot gnu.org> ---
(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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules
  2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
                   ` (4 preceding siblings ...)
  2024-03-26 21:03 ` mikael at gcc dot gnu.org
@ 2024-03-28 10:40 ` cvs-commit at gcc dot gnu.org
  2024-04-02 13:14 ` mikael at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-03-28 10:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Mikael Morin <mikael@gcc.gnu.org>:

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

commit r14-9703-g7f233feafd657250340be3b3500d2697948ae3ed
Author: Mikael Morin <mikael@gcc.gnu.org>
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 <anlauf@gmx.de>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/114475] [14 Regression] Regression with iso_c_binding and submodules
  2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
                   ` (5 preceding siblings ...)
  2024-03-28 10:40 ` cvs-commit at gcc dot gnu.org
@ 2024-04-02 13:14 ` mikael at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu.org @ 2024-04-02 13:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114475

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-02 13:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25 23:10 [Bug fortran/114475] New: [14.0 Regression] Regression with iso_c_binding and submodules juergen.reuter at desy dot de
2024-03-25 23:17 ` [Bug fortran/114475] " juergen.reuter at desy dot de
2024-03-26  8:06 ` [Bug fortran/114475] [14 " rguenth at gcc dot gnu.org
2024-03-26 17:48 ` anlauf at gcc dot gnu.org
2024-03-26 19:23 ` anlauf at gcc dot gnu.org
2024-03-26 21:03 ` mikael at gcc dot gnu.org
2024-03-28 10:40 ` cvs-commit at gcc dot gnu.org
2024-04-02 13:14 ` mikael at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).