public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/42650]  New: F90: DT function with in-line DT definition and RESULT is rejected
@ 2010-01-07 16:49 burnus at gcc dot gnu dot org
  2010-01-08  5:48 ` [Bug fortran/42650] " pault at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-01-07 16:49 UTC (permalink / raw)
  To: gcc-bugs

The one of following valid Fortran 90 functions is rejected: While the first
function "func" works and has function name = result name, the second
("func2"), which uses RESULT(), is rejected with the error message:

Error: The type for function 'func2' at (1) is not accessible


type(t) function func()
  type t
    sequence
    integer :: i = 5
  end type t
end function func

type(t) function func2() result(res)
  type t
    sequence
    integer :: i = 5
  end type t
end function func2


-- 
           Summary: F90: DT function with in-line DT definition and RESULT
                    is rejected
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32834
             nThis:


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


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

* [Bug fortran/42650] F90: DT function with in-line DT definition and RESULT is rejected
  2010-01-07 16:49 [Bug fortran/42650] New: F90: DT function with in-line DT definition and RESULT is rejected burnus at gcc dot gnu dot org
@ 2010-01-08  5:48 ` pault at gcc dot gnu dot org
  2010-02-01 22:17 ` burnus at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-08  5:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pault at gcc dot gnu dot org  2010-01-08 05:47 -------
type(t) function func2() result(res)
  type t
    sequence
    integer :: i = 5
  end type t
  res%i = 2
end function func2

causes a segmentation fault!

Confirmed

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-01-08 05:47:58
               date|                            |


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


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

* [Bug fortran/42650] F90: DT function with in-line DT definition and RESULT is rejected
  2010-01-07 16:49 [Bug fortran/42650] New: F90: DT function with in-line DT definition and RESULT is rejected burnus at gcc dot gnu dot org
  2010-01-08  5:48 ` [Bug fortran/42650] " pault at gcc dot gnu dot org
@ 2010-02-01 22:17 ` burnus at gcc dot gnu dot org
  2010-02-01 22:46 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-01 22:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2010-02-01 22:16 -------
The problem is somehow that for the second parsing using decl.c's
gfc_match_decl_type_spec one has in:

  else if (ts->kind == -1)
    {
      int iface = gfc_state_stack->previous->state != COMP_INTERFACE
                    || gfc_current_ns->has_import_set;
      if (gfc_find_symbol (name, NULL, iface, &sym))
        {
          gfc_error ("Type name '%s' at %C is ambiguous", name);
          return MATCH_ERROR;
        }

the result  sym == NULL with RESULT() but not without RESULT(); while
"iface==1" and name == "t" for both cases.


-- 


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


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

* [Bug fortran/42650] F90: DT function with in-line DT definition and RESULT is rejected
  2010-01-07 16:49 [Bug fortran/42650] New: F90: DT function with in-line DT definition and RESULT is rejected burnus at gcc dot gnu dot org
  2010-01-08  5:48 ` [Bug fortran/42650] " pault at gcc dot gnu dot org
  2010-02-01 22:17 ` burnus at gcc dot gnu dot org
@ 2010-02-01 22:46 ` burnus at gcc dot gnu dot org
  2010-02-02 13:06 ` burnus at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-01 22:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from burnus at gcc dot gnu dot org  2010-02-01 22:46 -------
Patch:

Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c   (Revision 156433)
+++ gcc/fortran/parse.c
@@ -111,7 +111,7 @@ decode_specification_statement (void)
   match ("import", gfc_match_import, ST_IMPORT);
   match ("use", gfc_match_use, ST_USE);

-  if (gfc_current_block ()->ts.type != BT_DERIVED)
+  if (gfc_current_block ()->result->ts.type != BT_DERIVED)
     goto end_of_block;

   match (NULL, gfc_match_st_function, ST_STATEMENT_FUNCTION);


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |burnus at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2010-01-08 05:47:58         |2010-02-01 22:46:13
               date|                            |


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


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

* [Bug fortran/42650] F90: DT function with in-line DT definition and RESULT is rejected
  2010-01-07 16:49 [Bug fortran/42650] New: F90: DT function with in-line DT definition and RESULT is rejected burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2010-02-01 22:46 ` burnus at gcc dot gnu dot org
@ 2010-02-02 13:06 ` burnus at gcc dot gnu dot org
  2010-02-02 14:27 ` burnus at gcc dot gnu dot org
  2010-02-02 14:28 ` burnus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-02 13:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2010-02-02 13:06 -------
Subject: Bug 42650

Author: burnus
Date: Tue Feb  2 13:05:50 2010
New Revision: 156449

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156449
Log:
2010-02-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42650
        * parse.c (decode_specification_statement): Use sym->result not
        * sym.

2010-02-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42650
        * gfortran.dg/func_result_5.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/func_result_5.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/parse.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/42650] F90: DT function with in-line DT definition and RESULT is rejected
  2010-01-07 16:49 [Bug fortran/42650] New: F90: DT function with in-line DT definition and RESULT is rejected burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-02-02 13:06 ` burnus at gcc dot gnu dot org
@ 2010-02-02 14:27 ` burnus at gcc dot gnu dot org
  2010-02-02 14:28 ` burnus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-02 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from burnus at gcc dot gnu dot org  2010-02-02 14:27 -------
Subject: Bug 42650

Author: burnus
Date: Tue Feb  2 14:27:24 2010
New Revision: 156450

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156450
Log:
2010-02-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42650
        * parse.c (decode_specification_statement): Use sym->result not
        * sym.

2010-02-02  Tobias Burnus  <burnus@net-b.de>

        PR fortran/42650
        * gfortran.dg/func_result_5.f90: New test.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/func_result_5.f90
Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/parse.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/42650] F90: DT function with in-line DT definition and RESULT is rejected
  2010-01-07 16:49 [Bug fortran/42650] New: F90: DT function with in-line DT definition and RESULT is rejected burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-02-02 14:27 ` burnus at gcc dot gnu dot org
@ 2010-02-02 14:28 ` burnus at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-02-02 14:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from burnus at gcc dot gnu dot org  2010-02-02 14:27 -------
FIXED on the trunk (4.5) and 4.4 branch.


-- 

burnus at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2010-02-02 14:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-07 16:49 [Bug fortran/42650] New: F90: DT function with in-line DT definition and RESULT is rejected burnus at gcc dot gnu dot org
2010-01-08  5:48 ` [Bug fortran/42650] " pault at gcc dot gnu dot org
2010-02-01 22:17 ` burnus at gcc dot gnu dot org
2010-02-01 22:46 ` burnus at gcc dot gnu dot org
2010-02-02 13:06 ` burnus at gcc dot gnu dot org
2010-02-02 14:27 ` burnus at gcc dot gnu dot org
2010-02-02 14:28 ` burnus 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).