public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/107444] New: ICE on character, value, optional dummy argument
@ 2022-10-27 21:06 anlauf at gcc dot gnu.org
  2022-11-01 20:34 ` [Bug fortran/107444] " anlauf at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-10-27 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107444
           Summary: ICE on character, value, optional dummy argument
           Product: gcc
           Version: 13.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 ICE was found while working on PR107441:

subroutine test (w)
  character, value, optional :: w
  print *, present (w)
end


pr107441-yy.f90:3:22:

    3 |   print *, present (w)
      |                      1
internal compiler error: in fold_convert_loc, at fold-const.cc:2592
0xf10c3d fold_convert_loc(unsigned int, tree_node*, tree_node*)
        ../../gcc-trunk/gcc/fold-const.cc:2592
0xc2be3a gfc_conv_expr_present(gfc_symbol*, bool)
        ../../gcc-trunk/gcc/fortran/trans-expr.cc:2023
0xc5d01f gfc_conv_intrinsic_present
        ../../gcc-trunk/gcc/fortran/trans-intrinsic.cc:3669
0xc73567 gfc_conv_intrinsic_function(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-intrinsic.cc:10882
0xc4264b gfc_conv_function_expr
        ../../gcc-trunk/gcc/fortran/trans-expr.cc:8312
0xc4651f gfc_conv_expr(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-expr.cc:9452
0xc46a14 gfc_conv_expr_reference(gfc_se*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/trans-expr.cc:9588
0xc81f47 gfc_trans_transfer(gfc_code*)
        ../../gcc-trunk/gcc/fortran/trans-io.cc:2607
0xbd9a31 trans_code
        ../../gcc-trunk/gcc/fortran/trans.cc:2170
0xbd9ba3 gfc_trans_code_cond(gfc_code*, tree_node*)
        ../../gcc-trunk/gcc/fortran/trans.cc:2295
0xc80889 build_dt
        ../../gcc-trunk/gcc/fortran/trans-io.cc:2051
0xc80961 gfc_trans_write(gfc_code*)
        ../../gcc-trunk/gcc/fortran/trans-io.cc:2090
0xbd99a7 trans_code
        ../../gcc-trunk/gcc/fortran/trans.cc:2142
0xbd9bc2 gfc_trans_code(gfc_code*)
        ../../gcc-trunk/gcc/fortran/trans.cc:2303
0xc224d1 gfc_generate_function_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans-decl.cc:7666
0xbd9c06 gfc_generate_code(gfc_namespace*)
        ../../gcc-trunk/gcc/fortran/trans.cc:2320
0xb600b4 translate_all_program_units
        ../../gcc-trunk/gcc/fortran/parse.cc:6696
0xb609b6 gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.cc:7002
0xbc0e87 gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.cc:229

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
@ 2022-11-01 20:34 ` anlauf at gcc dot gnu.org
  2022-11-01 20:54 ` anlauf at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-01 20:34 UTC (permalink / raw)
  To: 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);

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
  2022-11-01 20:34 ` [Bug fortran/107444] " anlauf at gcc dot gnu.org
@ 2022-11-01 20:54 ` anlauf at gcc dot gnu.org
  2022-11-01 21:15 ` anlauf at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-01 20:54 UTC (permalink / raw)
  To: 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... ;-)

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
  2022-11-01 20:34 ` [Bug fortran/107444] " anlauf at gcc dot gnu.org
  2022-11-01 20:54 ` anlauf at gcc dot gnu.org
@ 2022-11-01 21:15 ` anlauf at gcc dot gnu.org
  2022-11-09 21:07 ` anlauf at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-01 21:15 UTC (permalink / raw)
  To: 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

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-11-01 21:15 ` anlauf at gcc dot gnu.org
@ 2022-11-09 21:07 ` anlauf at gcc dot gnu.org
  2022-11-10 21:57 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-09 21:07 UTC (permalink / raw)
  To: 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.

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-11-09 21:07 ` anlauf at gcc dot gnu.org
@ 2022-11-10 21:57 ` anlauf at gcc dot gnu.org
  2022-11-12 20:18 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-10 21:57 UTC (permalink / raw)
  To: 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

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-11-10 21:57 ` anlauf at gcc dot gnu.org
@ 2022-11-12 20:18 ` cvs-commit at gcc dot gnu.org
  2022-11-14 11:08 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-12 20:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS 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:59a63247992eb13153b82c4902aadf111460eac2

commit r13-3931-g59a63247992eb13153b82c4902aadf111460eac2
Author: Harald Anlauf <anlauf@gmx.de>
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.

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2022-11-12 20:18 ` cvs-commit at gcc dot gnu.org
@ 2022-11-14 11:08 ` cvs-commit at gcc dot gnu.org
  2022-11-16 20:54 ` anlauf at gcc dot gnu.org
  2022-11-28 22:23 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-11-14 11:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS 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:04e2fd20d3d5fce2c99c856361d5f3d3ce955906

commit r13-4003-g04e2fd20d3d5fce2c99c856361d5f3d3ce955906
Author: Harald Anlauf <anlauf@gmx.de>
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 '.'.

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2022-11-14 11:08 ` cvs-commit at gcc dot gnu.org
@ 2022-11-16 20:54 ` anlauf at gcc dot gnu.org
  2022-11-28 22:23 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: anlauf at gcc dot gnu.org @ 2022-11-16 20:54 UTC (permalink / raw)
  To: 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.

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

* [Bug fortran/107444] ICE on character, value, optional dummy argument
  2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2022-11-16 20:54 ` anlauf at gcc dot gnu.org
@ 2022-11-28 22:23 ` pinskia at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-28 22:23 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

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

end of thread, other threads:[~2022-11-28 22:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27 21:06 [Bug fortran/107444] New: ICE on character, value, optional dummy argument anlauf at gcc dot gnu.org
2022-11-01 20:34 ` [Bug fortran/107444] " anlauf at gcc dot gnu.org
2022-11-01 20:54 ` anlauf at gcc dot gnu.org
2022-11-01 21:15 ` anlauf at gcc dot gnu.org
2022-11-09 21:07 ` anlauf at gcc dot gnu.org
2022-11-10 21:57 ` anlauf at gcc dot gnu.org
2022-11-12 20:18 ` cvs-commit at gcc dot gnu.org
2022-11-14 11:08 ` cvs-commit at gcc dot gnu.org
2022-11-16 20:54 ` anlauf at gcc dot gnu.org
2022-11-28 22:23 ` pinskia 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).