public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
@ 2020-07-12 15:56 ` dominiq at lps dot ens.fr
  2020-07-14  9:14 ` dominiq at lps dot ens.fr
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-12 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-07-12

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed.

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
  2020-07-12 15:56 ` [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data dominiq at lps dot ens.fr
@ 2020-07-14  9:14 ` dominiq at lps dot ens.fr
  2020-07-14  9:25 ` thenlich at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-14  9:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
With

--- ../_clean/gcc/fortran/io.c  2020-07-01 18:25:56.000000000 +0200
+++ gcc/fortran/io.c    2020-07-14 11:06:50.000000000 +0200
@@ -894,7 +894,13 @@ data_desc:
                               &format_locus))
            return false;
          u = format_lex ();
-         if (u != FMT_PERIOD)
+         if (u == FMT_PERIOD)
+           {
+             if (!gfc_notify_std (GFC_STD_F2018, "%<G0.d%> in format at %L", 
+                                  &format_locus))
+               return false;
+           }
+         else

I get

g% gfc pr93733.f90 -std=f2008
pr93733.f90:7:12:

    7 |     write(*, "(g0.2)")  -23
      |            1
Error: Fortran 2018: 'G0.d' in format at (1)
pr93733.f90:8:12:

    8 |     write(*, "(g0.2)")  .true.
      |            1
Error: Fortran 2018: 'G0.d' in format at (1)
pr93733.f90:9:12:

    9 |     write(*, "(g0.2)")  'hello'
      |            1
Error: Fortran 2018: 'G0.d' in format at (1)

Does it look good?

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
  2020-07-12 15:56 ` [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data dominiq at lps dot ens.fr
  2020-07-14  9:14 ` dominiq at lps dot ens.fr
@ 2020-07-14  9:25 ` thenlich at gcc dot gnu.org
  2020-07-14 11:39 ` dominiq at lps dot ens.fr
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: thenlich at gcc dot gnu.org @ 2020-07-14  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Thomas Henlich <thenlich at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #2)
> Does it look good?

Agreed, that should fix the bug.

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-07-14  9:25 ` thenlich at gcc dot gnu.org
@ 2020-07-14 11:39 ` dominiq at lps dot ens.fr
  2020-07-14 11:56 ` thenlich at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-14 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Agreed, that should fix the bug.

But reject valid too! AFAIU this cannot captured ay the format level.

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-07-14 11:39 ` dominiq at lps dot ens.fr
@ 2020-07-14 11:56 ` thenlich at gcc dot gnu.org
  2020-07-14 12:06 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: thenlich at gcc dot gnu.org @ 2020-07-14 11:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Thomas Henlich <thenlich at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #4)

> But reject valid too! AFAIU this cannot captured ay the format level.

Please explain, what valid code according to Fortran 2008 does -std=f2008
reject?

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2020-07-14 11:56 ` thenlich at gcc dot gnu.org
@ 2020-07-14 12:06 ` dominiq at lps dot ens.fr
  2020-07-14 12:18 ` thenlich at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-14 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Please explain, what valid code according to Fortran 2008 does -std=f2008 reject?

FAIL: gfortran.dg/fmt_g0_4.f08   -O  (test for excess errors)

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2020-07-14 12:06 ` dominiq at lps dot ens.fr
@ 2020-07-14 12:18 ` thenlich at gcc dot gnu.org
  2020-07-22 12:38 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: thenlich at gcc dot gnu.org @ 2020-07-14 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Thomas Henlich <thenlich at gcc dot gnu.org> ---
(In reply to Dominique d'Humieres from comment #6)
> > Please explain, what valid code according to Fortran 2008 does -std=f2008 reject?
> 
> FAIL: gfortran.dg/fmt_g0_4.f08   -O  (test for excess errors)

I think there is another bug, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36725#c8

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2020-07-14 12:18 ` thenlich at gcc dot gnu.org
@ 2020-07-22 12:38 ` dominiq at lps dot ens.fr
  2020-07-24 10:44 ` thenlich at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-22 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
The problem is deeper than expected. Consider

! { dg-options "-std=f2008" }
program g0d_ilc
character(4) :: fmt="(g0)"
character(6) :: fmt2="(g0.2)"
!F2008:
    write(*, fmt)  23
    write(*, fmt)  .true.
    write(*, fmt)  'hello'
!F2018:
    write(*, fmt2)  -23     ! { dg-error "Fortran 2018: .G0.d. in format" }
    write(*, fmt2)  .true.  ! { dg-error "Fortran 2018: .G0.d. in format" }
    write(*, fmt2)  'hello' ! { dg-error "Fortran 2018: .G0.d. in format" }
end

The test compiled with -std=f95 should give a run time error, but does not.

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2020-07-22 12:38 ` dominiq at lps dot ens.fr
@ 2020-07-24 10:44 ` thenlich at gcc dot gnu.org
  2020-07-24 15:03 ` jvdelisle at charter dot net
  2020-07-24 17:11 ` dominiq at lps dot ens.fr
  10 siblings, 0 replies; 11+ messages in thread
From: thenlich at gcc dot gnu.org @ 2020-07-24 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Thomas Henlich <thenlich at gcc dot gnu.org> ---
I think this standard conformity check is only performed at compile-time, and
can only work if the format is defined in a constant.

So, changing the definition to:
character(4), parameter :: fmt="(g0)"
character(6), parameter :: fmt2="(g0.2)"

when compiled with -std=f95 gives 6 times:

Error: Fortran 2008: 'G0' in format at (1)

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2020-07-24 10:44 ` thenlich at gcc dot gnu.org
@ 2020-07-24 15:03 ` jvdelisle at charter dot net
  2020-07-24 17:11 ` dominiq at lps dot ens.fr
  10 siblings, 0 replies; 11+ messages in thread
From: jvdelisle at charter dot net @ 2020-07-24 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

jvdelisle at charter dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at charter dot net

--- Comment #10 from jvdelisle at charter dot net ---
There are two levels of checking, compile time and run time.  Compile time, if
the string is known/constant in gcc/fortran/format.c (IIRC). Runtime is
libgfortran parse_format_string or similar.  The -std=xxx routines are always a
little different betwen implementation in compile time and run-time. Honestly,
every time I do these checks I have to try combination to find the right one. 
Hope this helps a little.  If you get stuck, let me know and I will try to take
a closer look.

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

* [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data
       [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2020-07-24 15:03 ` jvdelisle at charter dot net
@ 2020-07-24 17:11 ` dominiq at lps dot ens.fr
  10 siblings, 0 replies; 11+ messages in thread
From: dominiq at lps dot ens.fr @ 2020-07-24 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
There are two issues:

(1) The standard is not diagnosed at run time.
(2) The standard is not diagnosed at compile time when possible. This is
pr28397.

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

end of thread, other threads:[~2020-07-24 17:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93733-4@http.gcc.gnu.org/bugzilla/>
2020-07-12 15:56 ` [Bug fortran/93733] F2008: G0.d output editing for integer/logical/character data dominiq at lps dot ens.fr
2020-07-14  9:14 ` dominiq at lps dot ens.fr
2020-07-14  9:25 ` thenlich at gcc dot gnu.org
2020-07-14 11:39 ` dominiq at lps dot ens.fr
2020-07-14 11:56 ` thenlich at gcc dot gnu.org
2020-07-14 12:06 ` dominiq at lps dot ens.fr
2020-07-14 12:18 ` thenlich at gcc dot gnu.org
2020-07-22 12:38 ` dominiq at lps dot ens.fr
2020-07-24 10:44 ` thenlich at gcc dot gnu.org
2020-07-24 15:03 ` jvdelisle at charter dot net
2020-07-24 17:11 ` dominiq at lps dot ens.fr

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).