public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/102190] New: Syntax error reported in associate construct
@ 2021-09-03 14:52 everythingfunctional at protonmail dot com
  2023-06-01  8:15 ` [Bug fortran/102190] " pault at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: everythingfunctional at protonmail dot com @ 2021-09-03 14:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102190
           Summary: Syntax error reported in associate construct
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: everythingfunctional at protonmail dot com
  Target Milestone: ---

I think this is related to 102109 and 102112, because minor changes can illicit
the errors reported in those. Given:

module sub_m
    type :: sub_t
        private
        integer :: val
    end type

    interface sub_t
        module procedure constructor
    end interface
contains
    function constructor(val) result(sub)
        integer, intent(in) :: val
        type(sub_t) :: sub

        sub%val = val
    end function
end module
module obj_m
    use sub_m, only: sub_t
    type :: obj_t
        private
        type(sub_t) :: sub_obj_
    contains
        procedure :: sub_obj
    end type

    interface obj_t
        module procedure constructor
    end interface
contains
    function constructor(sub_obj) result(obj)
        type(sub_t), intent(in) :: sub_obj
        type(obj_t) :: obj

        obj%sub_obj_ = sub_obj
    end function

    function sub_obj(self)
        class(obj_t), intent(in) :: self
        type(sub_t) :: sub_obj

        sub_obj = self%sub_obj_
    end function
end module
program main
    use sub_m, only: sub_t
    use obj_m, only: obj_t

    associate(initial_sub => sub_t(42))
        associate(obj => obj_t(initial_sub))
            associate(sub_obj => obj%sub_obj())
            end associate
        end associate
    end associate
end program

I get the error:

combined.f90:51:38:

   51 |             associate(sub_obj => obj%sub_obj())
      |                                      1
Error: Expected ‘)’ or ‘,’ at (1)

But if you add implicit none to the program, you get the error reported in
102112, and if you make the components of the types public and/or define the
types in the main program, you get the error reported in 102109.

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

* [Bug fortran/102190] Syntax error reported in associate construct
  2021-09-03 14:52 [Bug fortran/102190] New: Syntax error reported in associate construct everythingfunctional at protonmail dot com
@ 2023-06-01  8:15 ` pault at gcc dot gnu.org
  2023-06-02  7:42 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu.org @ 2023-06-01  8:15 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Assignee|unassigned at gcc dot gnu.org      |pault at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-06-01

--- Comment #1 from Paul Thomas <pault at gcc dot gnu.org> ---
I have a fix but, at present, it breaks several other associate tests.

Paul

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

* [Bug fortran/102190] Syntax error reported in associate construct
  2021-09-03 14:52 [Bug fortran/102190] New: Syntax error reported in associate construct everythingfunctional at protonmail dot com
  2023-06-01  8:15 ` [Bug fortran/102190] " pault at gcc dot gnu.org
@ 2023-06-02  7:42 ` cvs-commit at gcc dot gnu.org
  2023-06-02  8:42 ` pault at gcc dot gnu.org
  2023-08-27  8:51 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-02  7:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:3c2eba4b7a2355ed5099e35332388206c484744d

commit r14-1487-g3c2eba4b7a2355ed5099e35332388206c484744d
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Fri Jun 2 08:41:45 2023 +0100

    Fortran: Fix some problems blocking associate meta-bug [PR87477]

    2023-06-02  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/87477
            * parse.cc (parse_associate): Replace the existing evaluation
            of the target rank with calls to gfc_resolve_ref and
            gfc_expression_rank. Identify untyped target function results
            with structure constructors by finding the appropriate derived
            type.
            * resolve.cc (resolve_symbol): Allow associate variables to be
            assumed shape.

    gcc/testsuite/
            PR fortran/87477
            * gfortran.dg/associate_54.f90 : Cope with extra error.

            PR fortran/102109
            * gfortran.dg/pr102109.f90 : New test.

            PR fortran/102112
            * gfortran.dg/pr102112.f90 : New test.

            PR fortran/102190
            * gfortran.dg/pr102190.f90 : New test.

            PR fortran/102532
            * gfortran.dg/pr102532.f90 : New test.

            PR fortran/109948
            * gfortran.dg/pr109948.f90 : New test.

            PR fortran/99326
            * gfortran.dg/pr99326.f90 : New test.

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

* [Bug fortran/102190] Syntax error reported in associate construct
  2021-09-03 14:52 [Bug fortran/102190] New: Syntax error reported in associate construct everythingfunctional at protonmail dot com
  2023-06-01  8:15 ` [Bug fortran/102190] " pault at gcc dot gnu.org
  2023-06-02  7:42 ` cvs-commit at gcc dot gnu.org
@ 2023-06-02  8:42 ` pault at gcc dot gnu.org
  2023-08-27  8:51 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pault at gcc dot gnu.org @ 2023-06-02  8:42 UTC (permalink / raw)
  To: gcc-bugs

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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #3 from Paul Thomas <pault at gcc dot gnu.org> ---
Hi Brad,

This is fixed on trunk (14-branch). I am going to close the PR for housekeeping
purposes but will be sure to include the patch in a cumulative backport.

Thanks for the report.

Paul

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

* [Bug fortran/102190] Syntax error reported in associate construct
  2021-09-03 14:52 [Bug fortran/102190] New: Syntax error reported in associate construct everythingfunctional at protonmail dot com
                   ` (2 preceding siblings ...)
  2023-06-02  8:42 ` pault at gcc dot gnu.org
@ 2023-08-27  8:51 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-27  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:d6997a5aab7aaa325946a6283bfee8ac2bd9f540

commit r13-7761-gd6997a5aab7aaa325946a6283bfee8ac2bd9f540
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Sun Aug 27 09:51:32 2023 +0100

    Fortran: Fix some problems blocking associate meta-bug [PR87477]

    2023-08-27  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/87477
            * parse.cc (parse_associate): Replace the existing evaluation
            of the target rank with calls to gfc_resolve_ref and
            gfc_expression_rank. Identify untyped target function results
            with structure constructors by finding the appropriate derived
            type.
            * resolve.cc (resolve_symbol): Allow associate variables to be
            assumed shape.

    gcc/testsuite/
            PR fortran/87477
            * gfortran.dg/associate_54.f90 : Cope with extra error.

            PR fortran/102109
            * gfortran.dg/pr102109.f90 : New test.

            PR fortran/102112
            * gfortran.dg/pr102112.f90 : New test.

            PR fortran/102190
            * gfortran.dg/pr102190.f90 : New test.

            PR fortran/102532
            * gfortran.dg/pr102532.f90 : New test.

            PR fortran/109948
            * gfortran.dg/pr109948.f90 : New test.

            PR fortran/99326
            * gfortran.dg/pr99326.f90 : New test.

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

end of thread, other threads:[~2023-08-27  8:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03 14:52 [Bug fortran/102190] New: Syntax error reported in associate construct everythingfunctional at protonmail dot com
2023-06-01  8:15 ` [Bug fortran/102190] " pault at gcc dot gnu.org
2023-06-02  7:42 ` cvs-commit at gcc dot gnu.org
2023-06-02  8:42 ` pault at gcc dot gnu.org
2023-08-27  8:51 ` cvs-commit 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).