public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/28172]  New: alternate return in contained procedure segfaults
@ 2006-06-26 19:30 tobi at gcc dot gnu dot org
  2006-06-30 12:28 ` [Bug fortran/28172] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: tobi at gcc dot gnu dot org @ 2006-06-26 19:30 UTC (permalink / raw)
  To: gcc-bugs

schluter@pcl247d:~> cat t.f90
program blubb
  call otherini(*998)
  stop
998 stop
contains
 subroutine init
   call otherini(*999)
   return
999 stop
 end subroutine init
end program blubb
schluter@pcl247d:~> ~/src/gcc/build/stage3-gcc/f951 t.f90
 MAIN__ init
t.f90:6: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
schluter@pcl247d:~> ~/src/gcc/build/stage3-gcc/f951 --version
GNU F95 version 4.2.0 20060618 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 4.2.0 20060618 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
schluter@pcl247d:~>

Note that it seems necessary that the subroutine be called both from the
program and the contained procedure.


-- 
           Summary: alternate return in contained procedure segfaults
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tobi at gcc dot gnu dot org


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


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

* [Bug fortran/28172] alternate return in contained procedure segfaults
  2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
@ 2006-06-30 12:28 ` pinskia at gcc dot gnu dot org
  2006-12-31  6:44 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-06-30 12:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-06-30 12:25 -------
Confirmed:
#0  0x000a6560 in gfc_add_modify_expr (pblock=0xbffff300, lhs=0x0,
rhs=0x42c0e1b0) at ../../gcc/fortran/trans.c:156
#1  0x000e91f8 in gfc_trans_call (code=0x42b05c40, dependency_check=0 '\0') at
../../gcc/fortran/trans-stmt.c:351
#2  0x000a7538 in gfc_trans_code (code=0x42b05c40) at
../../gcc/fortran/trans.c:509
#3  0x000c7618 in gfc_generate_function_code (ns=0x43012a00) at
../../gcc/fortran/trans-decl.c:2990
#4  0x000c6bd0 in gfc_generate_contained_functions (parent=0x43006600) at
../../gcc/fortran/trans-decl.c:2749
#5  0x000c7168 in gfc_generate_function_code (ns=0x43006600) at
../../gcc/fortran/trans-decl.c:2891


-- 

pinskia 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         |2006-06-30 12:25:01
               date|                            |


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


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

* [Bug fortran/28172] alternate return in contained procedure segfaults
  2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
  2006-06-30 12:28 ` [Bug fortran/28172] " pinskia at gcc dot gnu dot org
@ 2006-12-31  6:44 ` pault at gcc dot gnu dot org
  2007-01-15  8:17 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-12-31  6:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2006-12-31 06:43 -------
This fixes it, regtests and even produces the correct code:

Index: gcc/fortran/trans-stmt.c
===================================================================
*** gcc/fortran/trans-stmt.c    (revision 120243)
--- gcc/fortran/trans-stmt.c    (working copy)
*************** gfc_trans_call (gfc_code * code, bool de
*** 349,354 ****
--- 349,356 ----
          gcc_assert(select_code->op == EXEC_SELECT);
          sym = select_code->expr->symtree->n.sym;
          se.expr = convert (gfc_typenode_for_spec (&sym->ts), se.expr);
+         if (sym->backend_decl == NULL)
+           sym->backend_decl = gfc_get_symbol_decl (sym);
          gfc_add_modify_expr (&se.pre, sym->backend_decl, se.expr);
        }
        else

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2006-06-30 12:25:01         |2006-12-31 06:43:49
               date|                            |


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


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

* [Bug fortran/28172] alternate return in contained procedure segfaults
  2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
  2006-06-30 12:28 ` [Bug fortran/28172] " pinskia at gcc dot gnu dot org
  2006-12-31  6:44 ` pault at gcc dot gnu dot org
@ 2007-01-15  8:17 ` pault at gcc dot gnu dot org
  2007-01-16  0:58 ` patchapp at dberlin dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-01-15  8:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-01-15 08:16 -------
Subject: Bug 28172

Author: pault
Date: Mon Jan 15 08:16:17 2007
New Revision: 120790

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=120790
Log:
2007-01-15  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28172
        * trans-stmt.c (gfc_trans_call): If it does not have one, get
        a backend_decl for an alternate return.

        PR fortran/29389
        * resolve.c (pure_function): Statement functions are pure. Note
        that this will have to recurse to comply fully with F95.

        PR fortran/29712
        * resolve.c (resolve_function): Only a reference to the final
        dimension of an assumed size array is an error in an inquiry
        function.

        PR fortran/30283
        * resolve.c (resolve_function): Make sure that the function
        expression has a type.

2007-01-15  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28172
        * gfortran.dg/altreturn_4.f90: New test.

        PR fortran/29389
        * gfortran.dg/stfunc_4.f90: New test.

        PR fortran/29712
        * gfortran.dg/bound_2.f90: Reinstate commented out line.
        * gfortran.dg/initialization_1.f90: Change warning.

        PR fortran/30283
        * gfortran.dg/specification_type_resolution_2.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/altreturn_4.f90
    trunk/gcc/testsuite/gfortran.dg/specification_type_resolution_2.f90
    trunk/gcc/testsuite/gfortran.dg/stfunc_4.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/bound_2.f90
    trunk/gcc/testsuite/gfortran.dg/initialization_1.f90


-- 


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


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

* [Bug fortran/28172] alternate return in contained procedure segfaults
  2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-01-15  8:17 ` pault at gcc dot gnu dot org
@ 2007-01-16  0:58 ` patchapp at dberlin dot org
  2007-01-23  5:53 ` [Bug fortran/28172] [4.2 and 4.1 only] " pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: patchapp at dberlin dot org @ 2007-01-16  0:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from patchapp at dberlin dot org  2007-01-16 00:58 -------
Subject: Bug number PR28172

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-01/msg01196.html


-- 


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


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

* [Bug fortran/28172] [4.2 and 4.1 only] alternate return in contained procedure segfaults
  2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-01-16  0:58 ` patchapp at dberlin dot org
@ 2007-01-23  5:53 ` pault at gcc dot gnu dot org
  2007-01-23  5:55 ` pault at gcc dot gnu dot org
  2007-01-23  5:56 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-01-23  5:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2007-01-23 05:53 -------
Subject: Bug 28172

Author: pault
Date: Tue Jan 23 05:53:14 2007
New Revision: 121077

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=121077
Log:
2007-01-23  Paul Thomas  <pault@gcc.gnu.org>

        Backports from trunk

        PR fortran/28172
        * trans-stmt.c (gfc_trans_call): If it does not have one, get
        a backend_decl for an alternate return.

        PR fortran/29389
        * resolve.c (pure_function): Statement functions are pure. Note
        that this will have to recurse to comply fully with F95.

        PR fortran/29712
        * resolve.c (resolve_function): Only a reference to the final
        dimension of an assumed size array is an error in an inquiry
        function.

        PR fortran/30283
        * resolve.c (resolve_function): Make sure that the function
        expression has a type.

2007-01-23  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/28172
        * gfortran.dg/altreturn_4.f90: New test.

        PR fortran/29389
        * gfortran.dg/stfunc_4.f90: New test.

        PR fortran/29712
        * gfortran.dg/bound_2.f90: Reinstate commented out line.
        * gfortran.dg/initialization_1.f90: Change warning.

        PR fortran/30283
        * gfortran.dg/specification_type_resolution_2.f90: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/altreturn_4.f90
   
branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/specification_type_resolution_2.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/stfunc_4.f90
Modified:
    branches/gcc-4_2-branch/gcc/fortran/ChangeLog
    branches/gcc-4_2-branch/gcc/fortran/resolve.c
    branches/gcc-4_2-branch/gcc/fortran/trans-stmt.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/bound_2.f90
    branches/gcc-4_2-branch/gcc/testsuite/gfortran.dg/initialization_1.f90


-- 


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


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

* [Bug fortran/28172] [4.2 and 4.1 only] alternate return in contained procedure segfaults
  2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-01-23  5:53 ` [Bug fortran/28172] [4.2 and 4.1 only] " pault at gcc dot gnu dot org
@ 2007-01-23  5:55 ` pault at gcc dot gnu dot org
  2007-01-23  5:56 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-01-23  5:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2007-01-23 05:55 -------
Fixed on trunk and 4.2

Paul


-- 


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


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

* [Bug fortran/28172] [4.2 and 4.1 only] alternate return in contained procedure segfaults
  2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-01-23  5:55 ` pault at gcc dot gnu dot org
@ 2007-01-23  5:56 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-01-23  5:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2007-01-23 05:55 -------
It helps to mark it fixed...


-- 

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=28172


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

end of thread, other threads:[~2007-01-23  5:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-26 19:30 [Bug fortran/28172] New: alternate return in contained procedure segfaults tobi at gcc dot gnu dot org
2006-06-30 12:28 ` [Bug fortran/28172] " pinskia at gcc dot gnu dot org
2006-12-31  6:44 ` pault at gcc dot gnu dot org
2007-01-15  8:17 ` pault at gcc dot gnu dot org
2007-01-16  0:58 ` patchapp at dberlin dot org
2007-01-23  5:53 ` [Bug fortran/28172] [4.2 and 4.1 only] " pault at gcc dot gnu dot org
2007-01-23  5:55 ` pault at gcc dot gnu dot org
2007-01-23  5:56 ` pault 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).