public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53597] New: [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable
@ 2012-06-06 20:43 burnus at gcc dot gnu.org
  2012-06-13 11:56 ` [Bug fortran/53597] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-06 20:43 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53597

             Bug #: 53597
           Summary: [4.6/4.7/4.8 Regression] F95/F2003 constraint no
                    longer triggers: un-SAVED default-initialized module
                    variable
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


Based on the discussion at
https://groups.google.com/forum/?fromgroups#!topic/comp.lang.fortran/7QfDs7wtKVY

The following check in resolve.c does not trigger as attr.save ==
SAVE_IMPLICIT:

  if (!(sym->value || no_init_flag) && sym->ns->proc_name
      && sym->ns->proc_name->attr.flavor == FL_MODULE
      && !sym->ns->save_all && !sym->attr.save
      && !sym->attr.pointer && !sym->attr.allocatable
      && gfc_has_default_initializer (sym->ts.u.derived)
      && gfc_notify_std (GFC_STD_F2008, "Fortran 2008: Implied SAVE for "
                         "module variable '%s' at %L, needed due to "
                         "the default initialization", sym->name,

when compiling the following program with -std=f95 or -std=f2003:

MODULE somemodule
  IMPLICIT NONE
  TYPE sometype
    INTEGER :: i
    DOUBLE PRECISION, POINTER, DIMENSION(:,:) :: coef => NULL()
  END TYPE sometype
  TYPE(sometype) :: somevariable
END MODULE somemodule 



Possible patches:
a) Check for (sym->attr.save == SAVE_EXPLICIT || sym->value)
b) Use the patch below:

--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -3810,8 +3810,9 @@ match_attr_spec (void)
        }
     }

-  /* Module variables implicitly have the SAVE attribute.  */
-  if (gfc_current_state () == COMP_MODULE && !current_attr.save)
+  /* Since Fortran 2008 module variables implicitly have the SAVE attribute. 
*/
+  if (gfc_current_state () == COMP_MODULE && !current_attr.save
+      && (gfc_option.allow_std & GFC_STD_F2008) != 0)
     current_attr.save = SAVE_IMPLICIT;

   colon_seen = 1;


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

* [Bug fortran/53597] [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable
  2012-06-06 20:43 [Bug fortran/53597] New: [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable burnus at gcc dot gnu.org
@ 2012-06-13 11:56 ` burnus at gcc dot gnu.org
  2012-06-14 13:01 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-13 11:56 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53597

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-13 11:56:18 UTC ---
Author: burnus
Date: Wed Jun 13 11:56:08 2012
New Revision: 188506

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188506
Log:
2012-06-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * decl.c (match_attr_spec): Only mark module variables
        as SAVE_IMPLICIT for Fortran 2008 and later.

2012-06-13  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * gfortran.dg/save_4.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/save_4.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/decl.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/53597] [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable
  2012-06-06 20:43 [Bug fortran/53597] New: [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable burnus at gcc dot gnu.org
  2012-06-13 11:56 ` [Bug fortran/53597] " burnus at gcc dot gnu.org
@ 2012-06-14 13:01 ` burnus at gcc dot gnu.org
  2012-06-14 13:11 ` burnus at gcc dot gnu.org
  2012-06-14 13:13 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-14 13:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53597

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-14 13:00:55 UTC ---
Author: burnus
Date: Thu Jun 14 13:00:50 2012
New Revision: 188614

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188614
Log:
2012-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * decl.c (match_attr_spec): Only mark module variables
        as SAVE_IMPLICIT for Fortran 2008 and later.

2012-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * gfortran.dg/save_4.f90: New.


Added:
    branches/gcc-4_7-branch/gcc/testsuite/gfortran.dg/save_4.f90
Modified:
    branches/gcc-4_7-branch/gcc/fortran/ChangeLog
    branches/gcc-4_7-branch/gcc/fortran/decl.c
    branches/gcc-4_7-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/53597] [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable
  2012-06-06 20:43 [Bug fortran/53597] New: [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable burnus at gcc dot gnu.org
  2012-06-13 11:56 ` [Bug fortran/53597] " burnus at gcc dot gnu.org
  2012-06-14 13:01 ` burnus at gcc dot gnu.org
@ 2012-06-14 13:11 ` burnus at gcc dot gnu.org
  2012-06-14 13:13 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-14 13:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53597

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-14 13:11:32 UTC ---
Author: burnus
Date: Thu Jun 14 13:11:27 2012
New Revision: 188618

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188618
Log:
2012-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * decl.c (match_attr_spec): Only mark module variables
        as SAVE_IMPLICIT for Fortran 2008 and later.

2012-06-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/53597
        * gfortran.dg/save_4.f90: New.


Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/save_4.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/decl.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/53597] [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable
  2012-06-06 20:43 [Bug fortran/53597] New: [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-06-14 13:11 ` burnus at gcc dot gnu.org
@ 2012-06-14 13:13 ` burnus at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-14 13:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53597

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |burnus at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-06-14 13:13:11 UTC ---
FIXED on the (4.8) trunk and on the 4.6 and 4.7 branches. (The commit came too
late for 4.7.1.)


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

end of thread, other threads:[~2012-06-14 13:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06 20:43 [Bug fortran/53597] New: [4.6/4.7/4.8 Regression] F95/F2003 constraint no longer triggers: un-SAVED default-initialized module variable burnus at gcc dot gnu.org
2012-06-13 11:56 ` [Bug fortran/53597] " burnus at gcc dot gnu.org
2012-06-14 13:01 ` burnus at gcc dot gnu.org
2012-06-14 13:11 ` burnus at gcc dot gnu.org
2012-06-14 13:13 ` burnus 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).