public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/100988] New: Missed optimization: RESTRICT missing for optional arguments
@ 2021-06-09  8:54 burnus at gcc dot gnu.org
  2021-09-09 21:09 ` [Bug fortran/100988] " anlauf at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-06-09  8:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100988
           Summary: Missed optimization: RESTRICT missing for optional
                    arguments
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

For
  subroutine foo(a, b)
    integer :: a, b
    optional :: b
    ...
  end subroutine

only the TREE_TYPE of 'a' has the restrict qualifier – and not 'b'.

I think that there is no good reason for this – and wonder whether the
following should be applied:

diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c
index 5582e404df9..c4b4387c1e2 100644
--- a/gcc/fortran/trans-types.c
+++ b/gcc/fortran/trans-types.c
@@ -2338,11 +2338,9 @@ gfc_sym_type (gfc_symbol * sym)
          || (sym->ns->proc_name && sym->ns->proc_name->attr.entry_master))
        type = build_pointer_type (type);
       else
-       {
-         type = build_reference_type (type);
-         if (restricted)
-           type = build_qualified_type (type, TYPE_QUAL_RESTRICT);
-       }
+       type = build_reference_type (type);
+      if (restricted)
+       type = build_qualified_type (type, TYPE_QUAL_RESTRICT);
     }

   return (type);

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

end of thread, other threads:[~2024-03-15 21:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-09  8:54 [Bug fortran/100988] New: Missed optimization: RESTRICT missing for optional arguments burnus at gcc dot gnu.org
2021-09-09 21:09 ` [Bug fortran/100988] " anlauf at gcc dot gnu.org
2021-09-09 21:10 ` anlauf at gcc dot gnu.org
2023-12-03 21:59 ` anlauf at gcc dot gnu.org
2023-12-04 21:53 ` anlauf at gcc dot gnu.org
2023-12-05 18:16 ` cvs-commit at gcc dot gnu.org
2023-12-05 20:58 ` anlauf at gcc dot gnu.org
2024-03-15 21:08 ` cvs-commit at gcc dot gnu.org
2024-03-15 21:16 ` 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).