[Bug fortran/20874] elemental function ought to be scalar
--- Comment #5 from pault at gcc dot gnu dot org 2006-06-25 15:11 --- Subject: Bug 20874 Author: pault Date: Sun Jun 25 15:11:02 2006 New Revision: 114987 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=114987 Log: 2006-06-25 Paul Thomas [EMAIL PROTECTED] PR fortran/25056 * interface.c (compare_actual_formal): Signal an error if the formal argument is a pure procedure and the actual is not pure. PR fortran/27554 * resolve.c (resolve_actual_arglist): If the type of procedure passed as an actual argument is not already declared, see if it is an intrinsic. PR fortran/25073 * resolve.c (resolve_select): Use bits 1 and 2 of a new int to keep track of the appearance of constant logical case expressions. Signal an error is either value appears more than once. PR fortran/20874 * resolve.c (resolve_fl_procedure): Signal an error if an elemental function is not scalar valued. PR fortran/20867 * match.c (recursive_stmt_fcn): Perform implicit typing of variables. PR fortran/22038 * match.c (match_forall_iterator): Mark new variables as FL_UNKNOWN if the match fails. PR fortran/28119 * match.c (gfc_match_forall): Remove extraneous call to gfc_match_eos. PR fortran/25072 * resolve.c (resolve_code, resolve_function): Rework forall_flag scheme so that it is set and has a value of 2, when the code-expr (ie. the forall mask) is resolved. This is used to change block to mask in the non-PURE error message. 2006-06-25 Paul Thomas [EMAIL PROTECTED] PR fortran/20867 * gfortran.dg/stfunc_3.f90: New test. PR fortran/25056 * gfortran.dg/impure_actual_1.f90: New test. PR fortran/20874 * gfortran.dg/elemental_result_1.f90: New test. PR fortran/25073 * gfortran.dg/select_7.f90: New test. PR fortran/27554 * intrinsic_actual_1.f: New test. PR fortran/22038 PR fortran/28119 * gfortran.dg/forall_4.f90: New test. PR fortran/25072 * gfortran.dg/forall_5.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/elemental_result_1.f90 trunk/gcc/testsuite/gfortran.dg/forall_4.f90 trunk/gcc/testsuite/gfortran.dg/forall_5.f90 trunk/gcc/testsuite/gfortran.dg/impure_actual_1.f90 trunk/gcc/testsuite/gfortran.dg/intrinsic_actual_1.f trunk/gcc/testsuite/gfortran.dg/select_7.f90 trunk/gcc/testsuite/gfortran.dg/stfunc_3.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/interface.c trunk/gcc/fortran/match.c trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874
[Bug fortran/20874] elemental function ought to be scalar
--- Comment #6 from pault at gcc dot gnu dot org 2006-06-25 18:08 --- Subject: Bug 20874 Author: pault Date: Sun Jun 25 18:08:13 2006 New Revision: 114994 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=114994 Log: 2006-06-25 Paul Thomas [EMAIL PROTECTED] PR fortran/25056 * interface.c (compare_actual_formal): Signal an error if the formal argument is a pure procedure and the actual is not pure. PR fortran/27554 * resolve.c (resolve_actual_arglist): If the type of procedure passed as an actual argument is not already declared, see if it is an intrinsic. PR fortran/25073 * resolve.c (resolve_select): Use bits 1 and 2 of a new int to keep track of the appearance of constant logical case expressions. Signal an error is either value appears more than once. PR fortran/20874 * resolve.c (resolve_fl_procedure): Signal an error if an elemental function is not scalar valued. PR fortran/20867 * match.c (recursive_stmt_fcn): Perform implicit typing of variables. PR fortran/22038 * match.c (match_forall_iterator): Mark new variables as FL_UNKNOWN if the match fails. PR fortran/28119 * match.c (gfc_match_forall): Remove extraneous call to gfc_match_eos. PR fortran/25072 * resolve.c (resolve_code, resolve_function): Rework forall_flag scheme so that it is set and has a value of 2, when the code-expr (ie. the forall mask) is resolved. This is used to change block to mask in the non-PURE error message. 2006-06-25 Paul Thomas [EMAIL PROTECTED] PR fortran/20867 * gfortran.dg/stfunc_3.f90: New test. PR fortran/25056 * gfortran.dg/impure_actual_1.f90: New test. PR fortran/20874 * gfortran.dg/elemental_result_1.f90: New test. PR fortran/25073 * gfortran.dg/select_7.f90: New test. PR fortran/27554 * intrinsic_actual_1.f: New test. PR fortran/22038 PR fortran/28119 * gfortran.dg/forall_4.f90: New test. PR fortran/25072 * gfortran.dg/forall_5.f90: New test. Added: branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/elemental_result_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/forall_4.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/forall_5.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/impure_actual_1.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/intrinsic_actual_1.f branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/select_7.f90 branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/stfunc_3.f90 Modified: branches/gcc-4_1-branch/gcc/fortran/ChangeLog branches/gcc-4_1-branch/gcc/fortran/interface.c branches/gcc-4_1-branch/gcc/fortran/match.c branches/gcc-4_1-branch/gcc/fortran/resolve.c branches/gcc-4_1-branch/gcc/testsuite/ChangeLog -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874
[Bug fortran/20874] elemental function ought to be scalar
--- Comment #7 from pault at gcc dot gnu dot org 2006-06-25 18:11 --- Fixed on trunk and 4.1 Paul -- pault at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874
[Bug fortran/20874] elemental function ought to be scalar
--- Comment #4 from pault at gcc dot gnu dot org 2006-06-22 18:26 --- we should check that an elemental function doesn't return a pointer. a pointer already yields: INTEGER, pointer :: MM ! should be scalar 1 Error: POINTER attribute conflicts with ELEMENTAL attribute at (1) In file pr20874.f90:3 I have duly removed the check on rank and, of course, all works fine. Thanks - I will submit tomorrow am. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874
[Bug fortran/20874] elemental function ought to be scalar
--- Comment #3 from pault at gcc dot gnu dot org 2006-06-20 23:33 --- FX, which makes me think that simply having as != NULL is enough to know that it's not a scalar. That's my opinion too. I know that it works because I have tried it! I was persuaded otherwise after a discussion on the list about another patch. I will submit it as you suggest. One more thing: reading the lines after the code I pasted above reminds me that we should check that an elemental function doesn't return a pointer. Could it be along these lines?: + if (sym-attr.elemental sym-attr.function +sym-result-attr.pointer) +... I am separated from my notes tonight; I know I looked at this but I do not recall the outcome. Thanks Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874
[Bug fortran/20874] elemental function ought to be scalar
--- Comment #1 from paul dot richard dot thomas at cea dot fr 2006-06-19 09:25 --- Created an attachment (id=11695) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11695action=view) Patch to fix PR I will submit this tonight. Paul -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874
[Bug fortran/20874] elemental function ought to be scalar
--- Comment #2 from fxcoudert at gcc dot gnu dot org 2006-06-19 22:11 --- Regarding your patch: + /* An elemental function is required to return a scalar 12.7.1 */ + if (sym-attr.elemental sym-attr.function +sym-as sym-as-rank) I'm not sure why the condition sym-as-rank is needed (and if you decide to include it, I'd prefer the explicit (sym-as-rank 0)); elsewhere in resolve.c, I read: if (gfc_elemental (proc)) { if (sym-as != NULL) { gfc_error (Argument '%s' of elemental procedure at %L must be scalar, sym-name, sym-declared_at); continue; } which makes me think that simply having as != NULL is enough to know that it's not a scalar. One more thing: reading the lines after the code I pasted above reminds me that we should check that an elemental function doesn't return a pointer. Could it be along these lines?: + if (sym-attr.elemental sym-attr.function +sym-result-attr.pointer) +... -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added CC||fxcoudert at gcc dot gnu dot ||org Known to fail||4.2.0 4.1.2 Last reconfirmed|2005-12-31 20:03:28 |2006-06-19 22:11:19 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874
[Bug fortran/20874] elemental function ought to be scalar
-- What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed||1 Keywords||accepts-invalid Last reconfirmed|-00-00 00:00:00 |2005-04-22 14:53:04 date|| Summary|error needed|elemental function ought to ||be scalar http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20874