[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-28 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |13.0

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-16 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
Fixed for gcc-13.

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-14 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

--- Comment #7 from CVS Commits  ---
The master branch has been updated by Harald Anlauf :

https://gcc.gnu.org/g:04e2fd20d3d5fce2c99c856361d5f3d3ce955906

commit r13-4003-g04e2fd20d3d5fce2c99c856361d5f3d3ce955906
Author: Harald Anlauf 
Date:   Sun Nov 13 21:53:58 2022 +0100

Fortran: fix treatment of character, value, optional dummy arguments
[PR107444]

gcc/fortran/ChangeLog:

PR fortran/107444
* trans-openmp.cc (gfc_omp_check_optional_argument): Adjust to
change
of prefix of internal symbol for presence status to '.'.

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-12 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Harald Anlauf :

https://gcc.gnu.org/g:59a63247992eb13153b82c4902aadf111460eac2

commit r13-3931-g59a63247992eb13153b82c4902aadf111460eac2
Author: Harald Anlauf 
Date:   Thu Nov 10 22:30:27 2022 +0100

Fortran: fix treatment of character, value, optional dummy arguments
[PR107444]

Fix handling of character dummy arguments that have the optional+value
attribute.  Change name of internal symbols that carry the hidden presence
status of optional arguments to distinguish them from the internal hidden
character length.  Update documentation to clarify the gfortran ABI.

gcc/fortran/ChangeLog:

PR fortran/107444
* trans-decl.cc (create_function_arglist): Extend presence status
to all intrinsic types, and change prefix of internal symbol to
'.'.
* trans-expr.cc (gfc_conv_expr_present): Align to changes in
create_function_arglist.
(gfc_conv_procedure_call): Fix generation of procedure arguments
for
the case of character dummy arguments with optional+value
attribute.
* trans-types.cc (gfc_get_function_type): Synchronize with changes
to create_function_arglist.
* doc/gfortran/naming-and-argument-passing-conventions.rst: Clarify
the gfortran argument passing conventions with regard to OPTIONAL
dummy arguments of intrinsic type.

gcc/testsuite/ChangeLog:

PR fortran/107444
* gfortran.dg/optional_absent_7.f90: Adjust regex.
* gfortran.dg/optional_absent_8.f90: New test.

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-10 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

--- Comment #5 from anlauf at gcc dot gnu.org ---
Submitted: https://gcc.gnu.org/pipermail/fortran/2022-November/058476.html

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-09 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

   Last reconfirmed||2022-11-09
   Assignee|unassigned at gcc dot gnu.org  |anlauf at gcc dot 
gnu.org
 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1

--- Comment #4 from anlauf at gcc dot gnu.org ---
Working on a patch.

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-01 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

--- Comment #3 from anlauf at gcc dot gnu.org ---
Regarding ABI questions, I've inquired on the ML:

https://gcc.gnu.org/pipermail/fortran/2022-November/058410.html

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-01 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

anlauf at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||wrong-code

--- Comment #2 from anlauf at gcc dot gnu.org ---
OK, here's a better example of the weird situation:

program p
  call s()
  call s(i=7)
  call s(c='a')
  call s(r=3.0)
contains
  subroutine s (i,c,r)
integer  , value, optional :: i
character, value, optional :: c
real , value, optional :: r
print *, "present (i), present (r) =", present (i), present (r)
  end subroutine s
end

With 12-branch this prints:

 present (i), present (r) = F F
 present (i), present (r) = T F
 present (i), present (r) = F F  ! right but for the wrong reason...
 present (i), present (r) = F F  ! should be F T

With 13-mainline + patch under review for pr107441(v2) I get:

 present (i), present (r) = F F
 present (i), present (r) = T F
 present (i), present (r) = F T  ! should be F F
 present (i), present (r) = F T  ! right but for the wrong reason...

So not a regression... ;-)

[Bug fortran/107444] ICE on character, value, optional dummy argument

2022-11-01 Thread anlauf at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107444

--- Comment #1 from anlauf at gcc dot gnu.org ---
It appears that there is also confusion about the procedure decl.
This is demonstrated by:

program p
  call s()
  call s('')   ! Actual argument is too short, reject?
  call s('a')
  call s('ab')
contains
  subroutine s (c)
character, value, optional :: c
  end subroutine s
end

The dump tree shows:

void s (character(kind=1)[1:1] c, integer(kind=8) _c)

[...]

void p ()
{
  static void s (character(kind=1)[1:1], integer(kind=8));

  s (0B, 0);
  s ("", 1, 0);
  s ("a", 1, 1);
  s ("ab", 1, 2);