public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/26741]  New: Elemental functions not permitted in initialization expressions
@ 2006-03-18  5:06 pault at gcc dot gnu dot org
  2006-03-18  6:36 ` [Bug fortran/26741] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-03-18  5:06 UTC (permalink / raw)
  To: gcc-bugs

In testing gfortran's capacity to deal with iso_varying_string, it was found
that the error "Specification function 'len_' at (1) must be PURE" was produced
- see testcase below.  This is obviously incorrect because elemental functions
are pure.

The patch and the testcase appear below.

Paul Thomas

! { dg-do compile }
! Tests the fix for elemental functions not being allowed in
! specification expressions in pure procedures.
!
! Testcase from iso_varying_string by Rich Townsend <rhdt@star.ucl.ac.uk>
! The allocatable component has been changed to a pointer for this testcase.
!
module iso_varying_string

  type varying_string
     private
     character(LEN=1), dimension(:), pointer :: chars
  end type varying_string

  interface len
     module procedure len_
  end interface len

contains

  pure function char_auto (string) result (char_string)
    type(varying_string), intent(in) :: string
    character(LEN=len(string))       :: char_string ! Error was here
  end function char_auto

  elemental function len_ (string) result (length)
    type(varying_string), intent(in) :: string
    integer                          :: length
  end function len_

end module iso_varying_string

Index: gcc/fortran/expr.c
===================================================================
*** gcc/fortran/expr.c  (revision 112139)
--- gcc/fortran/expr.c  (working copy)
*************** external_spec_function (gfc_expr * e)
*** 1636,1642 ****
        return FAILURE;
      }

!   if (!f->attr.pure)
      {
        gfc_error ("Specification function '%s' at %L must be PURE", f->name,
                 &e->where);
--- 1636,1642 ----
        return FAILURE;
      }

!   if (!f->attr.pure && !f->attr.elemental)
      {
        gfc_error ("Specification function '%s' at %L must be PURE", f->name,
                 &e->where);


-- 
           Summary: Elemental functions not permitted in initialization
                    expressions
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: pault at gcc dot gnu dot org
        ReportedBy: pault at gcc dot gnu dot org


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


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

* [Bug fortran/26741] Elemental functions not permitted in initialization expressions
  2006-03-18  5:06 [Bug fortran/26741] New: Elemental functions not permitted in initialization expressions pault at gcc dot gnu dot org
@ 2006-03-18  6:36 ` pinskia at gcc dot gnu dot org
  2006-03-19 12:48 ` pault at gcc dot gnu dot org
  2006-03-20  7:54 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-18  6:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-18 06:36 -------
Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-18 06:36:54
               date|                            |


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


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

* [Bug fortran/26741] Elemental functions not permitted in initialization expressions
  2006-03-18  5:06 [Bug fortran/26741] New: Elemental functions not permitted in initialization expressions pault at gcc dot gnu dot org
  2006-03-18  6:36 ` [Bug fortran/26741] " pinskia at gcc dot gnu dot org
@ 2006-03-19 12:48 ` pault at gcc dot gnu dot org
  2006-03-20  7:54 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-03-19 12:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2006-03-19 12:48 -------
Fixed on trunk and 4.1

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug fortran/26741] Elemental functions not permitted in initialization expressions
  2006-03-18  5:06 [Bug fortran/26741] New: Elemental functions not permitted in initialization expressions pault at gcc dot gnu dot org
  2006-03-18  6:36 ` [Bug fortran/26741] " pinskia at gcc dot gnu dot org
  2006-03-19 12:48 ` pault at gcc dot gnu dot org
@ 2006-03-20  7:54 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-20  7:54 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.1


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


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

end of thread, other threads:[~2006-03-20  7:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-18  5:06 [Bug fortran/26741] New: Elemental functions not permitted in initialization expressions pault at gcc dot gnu dot org
2006-03-18  6:36 ` [Bug fortran/26741] " pinskia at gcc dot gnu dot org
2006-03-19 12:48 ` pault at gcc dot gnu dot org
2006-03-20  7:54 ` pinskia at gcc dot gnu dot 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).