public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/111503] New: Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments
@ 2023-09-20 20:11 anlauf at gcc dot gnu.org
  2023-12-07 22:28 ` [Bug fortran/111503] " anlauf at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-09-20 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111503
           Summary: Issues with POINTER, OPTIONAL, CONTIGUOUS dummy
                    arguments
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anlauf at gcc dot gnu.org
  Target Milestone: ---

The following code shows an issue that popped up while looking at pr55978:

program test
  implicit none
  integer, pointer, contiguous :: p(:) => null()
  print *, is_contiguous (p)
  call one (p)       ! accepted
  call one ()        ! accepted (but see pr55978 comment#19)
  call one (null())  ! rejected, but accepted by NAG, Intel
  call one (null(p)) ! rejected by NAG, accepted by Intel
contains
  subroutine one (x)
    integer, pointer, optional, contiguous, intent(in) :: x(:)
!   integer,          optional, contiguous, intent(in) :: x(:) ! accepted
  end subroutine one
end

Intel accepts the code as-is.  NAG complains that NULL(p) is not contiguous:

Error: pr11xxxx.f90, line 8: Argument X (no. 1) of ONE is a CONTIGUOUS pointer,
but the actual argument NULL(P) is not simply contiguous

I guess that NAG is correct here, and Intel does not properly diagnose.

gfortran is maybe overly "cautious" and gives:

pr11xxxx.f90:7:12:

    7 |   call one (null())  ! rejected, but accepted by NAG, Intel
      |            1
Error: Actual argument to contiguous pointer dummy 'x' at (1) must be simply
contiguous
pr11xxxx.f90:8:12:

    8 |   call one (null(p)) ! rejected by NAG, accepted by Intel
      |            1
Error: Actual argument to contiguous pointer dummy 'x' at (1) must be simply
contiguous

As - in the current context - null() is equivalent to an absent actual
argument, I wonder whether we should relax our checks and follow NAG and Intel.

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

* [Bug fortran/111503] Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments
  2023-09-20 20:11 [Bug fortran/111503] New: Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments anlauf at gcc dot gnu.org
@ 2023-12-07 22:28 ` anlauf at gcc dot gnu.org
  2023-12-08 10:29 ` anlauf at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-07 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from anlauf at gcc dot gnu.org ---
Created attachment 56832
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56832&action=edit
Draft patch

The attached patch adds handling for NULL([MOLD]) and fixes comment#0.

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

* [Bug fortran/111503] Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments
  2023-09-20 20:11 [Bug fortran/111503] New: Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments anlauf at gcc dot gnu.org
  2023-12-07 22:28 ` [Bug fortran/111503] " anlauf at gcc dot gnu.org
@ 2023-12-08 10:29 ` anlauf at gcc dot gnu.org
  2023-12-10 19:34 ` cvs-commit at gcc dot gnu.org
  2023-12-10 21:38 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-08 10:29 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org
   Last reconfirmed|                            |2023-12-08
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #2 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2023-December/060003.html

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

* [Bug fortran/111503] Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments
  2023-09-20 20:11 [Bug fortran/111503] New: Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments anlauf at gcc dot gnu.org
  2023-12-07 22:28 ` [Bug fortran/111503] " anlauf at gcc dot gnu.org
  2023-12-08 10:29 ` anlauf at gcc dot gnu.org
@ 2023-12-10 19:34 ` cvs-commit at gcc dot gnu.org
  2023-12-10 21:38 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-12-10 19:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:99c5fa3ba6b5f54a7d632bd9da0e07dd85a4b669

commit r14-6382-g99c5fa3ba6b5f54a7d632bd9da0e07dd85a4b669
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Fri Dec 8 13:57:31 2023 +0100

    Fortran: allow NULL() for POINTER, OPTIONAL, CONTIGUOUS dummy [PR111503]

    gcc/fortran/ChangeLog:

            PR fortran/111503
            * expr.cc (gfc_is_simply_contiguous): Determine characteristics of
            NULL() from optional MOLD argument, otherwise treat as contiguous.
            * primary.cc (gfc_variable_attr): Derive attributes of NULL(MOLD)
            from MOLD.

    gcc/testsuite/ChangeLog:

            PR fortran/111503
            * gfortran.dg/contiguous_14.f90: New test.

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

* [Bug fortran/111503] Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments
  2023-09-20 20:11 [Bug fortran/111503] New: Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments anlauf at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-12-10 19:34 ` cvs-commit at gcc dot gnu.org
@ 2023-12-10 21:38 ` anlauf at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: anlauf at gcc dot gnu.org @ 2023-12-10 21:38 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from anlauf at gcc dot gnu.org ---
Fixed on mainline for gcc-14.

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

end of thread, other threads:[~2023-12-10 21:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 20:11 [Bug fortran/111503] New: Issues with POINTER, OPTIONAL, CONTIGUOUS dummy arguments anlauf at gcc dot gnu.org
2023-12-07 22:28 ` [Bug fortran/111503] " anlauf at gcc dot gnu.org
2023-12-08 10:29 ` anlauf at gcc dot gnu.org
2023-12-10 19:34 ` cvs-commit at gcc dot gnu.org
2023-12-10 21:38 ` anlauf 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).