Bug 50401 - SIGSEGV in resolve_transfer
Summary: SIGSEGV in resolve_transfer
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: janus
URL:
Keywords: ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2011-09-15 08:18 UTC by Vittorio Zecca
Modified: 2011-09-15 17:50 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-09-15 00:00:00


Attachments
just compile it (114 bytes, text/plain)
2011-09-15 08:18 UTC, Vittorio Zecca
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vittorio Zecca 2011-09-15 08:18:14 UTC
Created attachment 25277 [details]
just compile it

SIGSEGV in resolve_transfer
Comment 1 janus 2011-09-15 11:17:16 UTC
The obvious fix:

Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c       (revision 178876)
+++ gcc/fortran/resolve.c       (working copy)
@@ -8222,7 +8222,7 @@
        }
     }
 
-  if (sym->as != NULL && sym->as->type == AS_ASSUMED_SIZE
+  if (sym->as != NULL && sym->as->type == AS_ASSUMED_SIZE && exp->ref
       && exp->ref->type == REF_ARRAY && exp->ref->u.ar.type == AR_FULL)
     {
       gfc_error ("Data transfer element at %L cannot be a full reference to "
Comment 2 janus 2011-09-15 17:48:36 UTC
Author: janus
Date: Thu Sep 15 17:48:27 2011
New Revision: 178889

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178889
Log:
2011-09-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50401
	* resolve.c (resolve_transfer): Check if component 'ref' is defined.

	PR fortran/50403
	* symbol.c (gfc_use_derived): Check if argument 'sym' is defined.


2011-09-15  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50401
	PR fortran/50403
	* gfortran.dg/function_types_3.f90: New.

Added:
    trunk/gcc/testsuite/gfortran.dg/function_types_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/symbol.c
    trunk/gcc/testsuite/ChangeLog
Comment 3 janus 2011-09-15 17:50:04 UTC
Fixed on trunk with r178889. Closing.