[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #10 from tobi at gcc dot gnu dot org 2007-09-25 05:39 --- Fixed. -- tobi at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #9 from patchapp at dberlin dot org 2007-09-24 21:48 --- Subject: Bug number PR33269 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01797.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #8 from tobi at gcc dot gnu dot org 2007-09-24 21:15 --- Subject: Bug 33269 Author: tobi Date: Mon Sep 24 21:15:00 2007 New Revision: 128732 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128732 Log: PR fortran/33269 fortran/ * io.c (check_format_string): Move NULL and constant checks into this function. (check_io_constraints): Call gfc_simplify_expr() before calling check_format_string(). Remove NULL and constant checks. testsuite/ * gfortran.dg/fmt_error_2.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/fmt_error_2.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/io.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #7 from tobi at gcc dot gnu dot org 2007-09-22 12:53 --- Created an attachment (id=14244) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14244&action=view) Unfinished patch Here's a patch. I won't have time for the final cosmetics for a few days to come, so I'm posting it hereto give interested parties the chance to find a few tests that I didn't think of. I'm not entirely convinced that such an early call to gfc_simplify_expr() is safe, but I haven't yet looked through the simplification code. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #6 from tobi at gcc dot gnu dot org 2007-09-02 18:48 --- (In reply to comment #5) > (In reply to comment #4) > > > if the first item after the "(" is a default-char-expression > > > (constant or not) and there is no "...=" (e.g. "fmt=") in there, then it > > > is > > > also a "READ format" statement. > > > > This is wrong. In "READ(20) x", 20 is not a format but a unit number. > > I don't think that this is wrong: > I would argue that 20 is not a default-char-expression ;-) Sorry, you're right of course. Unfortunately, the type can't be determined in all cases, so this criterion doesn't work. I tried. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #5 from burnus at gcc dot gnu dot org 2007-09-02 18:42 --- (In reply to comment #4) > > if the first item after the "(" is a default-char-expression > > (constant or not) and there is no "...=" (e.g. "fmt=") in there, then it is > > also a "READ format" statement. > > This is wrong. In "READ(20) x", 20 is not a format but a unit number. I don't think that this is wrong: I would argue that 20 is not a default-char-expression ;-) > Additionally, we allow "READ(20), x" as an extension which makes this even > more annoying to fix. Agreed. > Fortunately, they're not important issues. Fortunately not. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #4 from tobi at gcc dot gnu dot org 2007-09-02 18:27 --- (In reply to comment #3) > No, the syntax is: > READ format[, io-list] > and ('f.3.3') as a constant-string expression for the format; this is similar > to "PRINT ('f3.3'), a". > This should be distinguished from: > READ(io-control-spec-list) > The distinction is simple: If there is no ( and an * or a label, it must be > "READ format"; if the first item after the "(" is a default-char-expression > (constant or not) and there is no "...=" (e.g. "fmt=") in there, then it is > also a "READ format" statement. This is wrong. In "READ(20) x", 20 is not a format but a unit number. Additionally, we allow "READ(20), x" as an extension which makes this even more annoying to fix. I'll be leaving for vacation on Thursday. Given that my first attempts at fixing this failed, I don't think I'll be able to attend these bugs before the end of the month. Fortunately, they're not important issues. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
-- tobi at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |tobi at gcc dot gnu dot org |dot org | Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2007-09-02 16:16:05 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #3 from burnus at gcc dot gnu dot org 2007-08-31 20:02 --- > gfortran does catch these at run time. Well, at compile time is nicer ;-) > Also, the last case, read ('f3.3'), a, does give a legitimate error: > read ('f3.3'), a > 1 > Error: UNIT specification at (1) must be an INTEGER expression or a CHARACTER > variable. No, the syntax is: READ format[, io-list] and ('f.3.3') as a constant-string expression for the format; this is similar to "PRINT ('f3.3'), a". This should be distinguished from: READ(io-control-spec-list) The distinction is simple: If there is no ( and an * or a label, it must be "READ format"; if the first item after the "(" is a default-char-expression (constant or not) and there is no "...=" (e.g. "fmt=") in there, then it is also a "READ format" statement. > See PR28397. I think this is a near duplicate. Yes and no. This PR is about things which are in principle correctly diagnosed, but not if one surrounds it with parenthesis. The other PR is about things which should be diagnosed but are not. They are related, but they need different fixes. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #2 from jvdelisle at gcc dot gnu dot org 2007-08-31 19:47 --- gfortran does catch these at run time. Also, the last case, read ('f3.3'), a, does give a legitimate error: read ('f3.3'), a 1 Error: UNIT specification at (1) must be an INTEGER expression or a CHARACTER variable. See PR28397. I think this is a near duplicate. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269
[Bug fortran/33269] Diagnose missing "(" in "PRINT ('a'),"
--- Comment #1 from burnus at gcc dot gnu dot org 2007-08-31 14:16 --- Actually, all of the following is affected. The last one fails before due to PR 33268. print ('a'), 'Hello' write(*,('a')) 'Hello' read (*,('f3.3')) a read ('f3.3'), a end -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33269