MODULE test IMPLICIT NONE CHARACTER(len=1), PARAMETER :: backslash = '\\' PUBLIC :: backslash END MODULE > gfortran test.f90 test.f90:4.21: PUBLIC :: backslash 1 Error: PARAMETER attribute conflicts with SAVE attribute in 'backslash' at (1)
Haven't updated yet, but ... symbol.c(check_conflict):493: [...] switch (attr->flavor) case FL_PARAMETER: conf2 (save); [...] with #define conf2(a) if (attr->a) { a2 = a; goto conflict; } should probably be if (attr->flavor == FL_PARAMETER && attr->save == SAVE_EXPLICIT) instead.
Testing patch ...
The patch below fixes the current problem. There are other checks against attrib->save in check_conflict() which might trigger the same problem. I'll have a closer later this evening. Index: symbol.c =================================================================== --- symbol.c (revision 126369) +++ symbol.c (working copy) @@ -630,12 +630,17 @@ conf2 (target); conf2 (dummy); conf2 (in_common); - conf2 (save); conf2 (value); conf2 (volatile_); conf2 (threadprivate); /* TODO: hmm, double check this. */ conf2 (value); + + if (attr->save == SAVE_EXPLICIT) + { + a2 = save; + goto conflict; + } break; default:
(In reply to comment #3) > The patch below fixes the current problem. There are other checks against > attrib->save in check_conflict() which might trigger the same problem. I'll > have a closer later this evening. This patch is OK to commit. Please review all other uses of attr->save (in check_conflict() and possibly in other functions and files) for this type of error. I'm sorry that I wasn't able to spot that possible issue during my review of your patch :(
Subject: Bug number PR32633 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-07/msg00511.html
Subject: Bug 32633 Author: dfranke Date: Fri Jul 6 12:37:22 2007 New Revision: 126413 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126413 Log: gcc/fortran: 2007-05-06 Daniel Franke <franke.daniel@gmail.com> PR fortran/32633 * symbol.c (save_status): New. * gfortran.h (save_status): Added external declaration. (check_conflict): Check for conflicting explicite SAVE statements only. (gen_special_c_interop_ptr): Use SAVE_EXPLICIT constant. * module.c (ab_attribute, attr_bits): Removed enumerator value AB_SAVE for save attribute. (mio_symbol_attribute): Import/export the full SAVE status, removed usage of AB_SAVE. * dump-parse-tree.c (gfc_show_attr): Dump full SAVE status. * decl.c (add_init_expr_to_sym): Set SAVE_IMPLICIT only if not already explicit. gcc/testsuite: 2007-07-06 Daniel Franke <franke.daniel@gmail.com> * gfortran.dg/save_parameter.f90: New test. * gfortran.dg/module_md5_1.f90: Updated MD5 sum. Added: trunk/gcc/testsuite/gfortran.dg/save_parameter.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/decl.c trunk/gcc/fortran/dump-parse-tree.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/module.c trunk/gcc/fortran/symbol.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/module_md5_1.f90
Joost, thanks for reporting! Closing as fixed.