public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/95037] New: gfortran fails to compile a simple subroutine, issues an opaque message
@ 2020-05-10 15:35 longb at cray dot com
  2020-05-10 17:29 ` [Bug fortran/95037] " kargl at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: longb at cray dot com @ 2020-05-10 15:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95037
           Summary: gfortran fails to compile a simple subroutine, issues
                    an opaque message
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: longb at cray dot com
  Target Milestone: ---

> cat  test.f90
subroutine my_random_seed_v (size, put, get)
integer, optional :: size
integer, optional :: put(1)
integer, optional :: get(1)
call random_seed (size, put, get)
end subroutine my_random_seed_v

Works with Cray compiler:

> ftn -c test.f90
> module swap PrgEnv-cray PrgEnv-gnu

Fails with gfortran:

> gfortran -c test.f90

(null):0: confused by earlier errors, bailing out
> gfortran --version
GNU Fortran (GCC) 9.3.0 20200312 (Cray Inc.)
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Original user was "confused" by the message, especially since there were no
"earlier errors" output.

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

* [Bug fortran/95037] gfortran fails to compile a simple subroutine, issues an opaque message
  2020-05-10 15:35 [Bug fortran/95037] New: gfortran fails to compile a simple subroutine, issues an opaque message longb at cray dot com
@ 2020-05-10 17:29 ` kargl at gcc dot gnu.org
  2020-06-14 12:36 ` tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: kargl at gcc dot gnu.org @ 2020-05-10 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
   Last reconfirmed|                            |2020-05-10
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

--- Comment #1 from kargl at gcc dot gnu.org ---
Do not dereference a NULL pointer.  Patch against svn r280157.

Index: gcc/fortran/check.c
===================================================================
--- gcc/fortran/check.c (revision 280157)
+++ gcc/fortran/check.c (working copy)
@@ -6600,10 +6600,10 @@ gfc_check_random_seed (gfc_expr *size, gfc_expr *put, 

       if (gfc_array_size (put, &put_size)
          && mpz_get_ui (put_size) < seed_size)
-       gfc_error ("Size of %qs argument of %qs intrinsic at %L "
+       gfc_error ("Size of %qs argument of %qs intrinsic at %C "
                   "too small (%i/%i)",
                   gfc_current_intrinsic_arg[1]->name, gfc_current_intrinsic,
-                  where, (int) mpz_get_ui (put_size), seed_size);
+                  (int) mpz_get_ui (put_size), seed_size);
     }

   if (get != NULL)
@@ -6632,10 +6632,10 @@ gfc_check_random_seed (gfc_expr *size, gfc_expr *put, 

        if (gfc_array_size (get, &get_size)
           && mpz_get_ui (get_size) < seed_size)
-       gfc_error ("Size of %qs argument of %qs intrinsic at %L "
+       gfc_error ("Size of %qs argument of %qs intrinsic at %C "
                   "too small (%i/%i)",
                   gfc_current_intrinsic_arg[2]->name, gfc_current_intrinsic,
-                  where, (int) mpz_get_ui (get_size), seed_size);
+                  (int) mpz_get_ui (get_size), seed_size);
     }

   /* RANDOM_SEED may not have more than one non-optional argument.  */

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

* [Bug fortran/95037] gfortran fails to compile a simple subroutine, issues an opaque message
  2020-05-10 15:35 [Bug fortran/95037] New: gfortran fails to compile a simple subroutine, issues an opaque message longb at cray dot com
  2020-05-10 17:29 ` [Bug fortran/95037] " kargl at gcc dot gnu.org
@ 2020-06-14 12:36 ` tkoenig at gcc dot gnu.org
  2020-06-14 12:45 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-06-14 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |tkoenig at gcc dot gnu.org

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to kargl from comment #1)
> Do not dereference a NULL pointer.  Patch against svn r280157.

This patch leads to the error message being in the wrong place:

a.f90:1:28:

    1 | subroutine my_random_seed_v (size, put, get)
      |                            1
Fehler: Size of »put« argument of »random_seed« intrinsic at (1) too small
(1/8)
a.f90:1:28:

    1 | subroutine my_random_seed_v (size, put, get)
      |                            1
Fehler: Size of »get« argument of »random_seed« intrinsic at (1) too small
(1/8)

However, this is the right place, and the fix is obvious
and simple.

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

* [Bug fortran/95037] gfortran fails to compile a simple subroutine, issues an opaque message
  2020-05-10 15:35 [Bug fortran/95037] New: gfortran fails to compile a simple subroutine, issues an opaque message longb at cray dot com
  2020-05-10 17:29 ` [Bug fortran/95037] " kargl at gcc dot gnu.org
  2020-06-14 12:36 ` tkoenig at gcc dot gnu.org
@ 2020-06-14 12:45 ` tkoenig at gcc dot gnu.org
  2020-10-18 20:27 ` longb at cray dot com
  2020-10-19  5:38 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-06-14 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Fixed on master with

https://gcc.gnu.org/g:4644e8f15f835a9934a8d289ee08ba4cb46cbfac

commit r11-1297-g4644e8f15f835a9934a8d289ee08ba4cb46cbfac
Author: Thomas Koenig <tkoenig@gcc.gnu.org>
Date:   Sun Jun 14 14:39:03 2020 +0200

    Always use locations from get and put arguments for error messages.

    A simple and obvios patch - the error location was taken
    from a variable that was not initialized for optional
    variables.

    gcc/fortran/ChangeLog:

            * check.c (gfc_check_random_seed): Always use locations
            from get and put arguments for error messages.

    gcc/testsuite/ChangeLog:

            * gfortran.dg/random_seed_4.f90: New test.

Closing. Thanks for the bug report!

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

* [Bug fortran/95037] gfortran fails to compile a simple subroutine, issues an opaque message
  2020-05-10 15:35 [Bug fortran/95037] New: gfortran fails to compile a simple subroutine, issues an opaque message longb at cray dot com
                   ` (2 preceding siblings ...)
  2020-06-14 12:45 ` tkoenig at gcc dot gnu.org
@ 2020-10-18 20:27 ` longb at cray dot com
  2020-10-19  5:38 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: longb at cray dot com @ 2020-10-18 20:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Bill Long <longb at cray dot com> ---
Original submitter is interested in knowing what GCC version will have this
fix.

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

* [Bug fortran/95037] gfortran fails to compile a simple subroutine, issues an opaque message
  2020-05-10 15:35 [Bug fortran/95037] New: gfortran fails to compile a simple subroutine, issues an opaque message longb at cray dot com
                   ` (3 preceding siblings ...)
  2020-10-18 20:27 ` longb at cray dot com
@ 2020-10-19  5:38 ` tkoenig at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-10-19  5:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Fixed in 10.2, 9.4 and 11.1 will have it.

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

end of thread, other threads:[~2020-10-19  5:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 15:35 [Bug fortran/95037] New: gfortran fails to compile a simple subroutine, issues an opaque message longb at cray dot com
2020-05-10 17:29 ` [Bug fortran/95037] " kargl at gcc dot gnu.org
2020-06-14 12:36 ` tkoenig at gcc dot gnu.org
2020-06-14 12:45 ` tkoenig at gcc dot gnu.org
2020-10-18 20:27 ` longb at cray dot com
2020-10-19  5:38 ` tkoenig 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).