[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-17 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

--- Comment #8 from janus at gcc dot gnu.org 2011-09-17 10:54:53 UTC ---
Author: janus
Date: Sat Sep 17 10:54:50 2011
New Revision: 178928

URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=178928
Log:
2011-09-17  Janus Weil  ja...@gcc.gnu.org

PR fortran/50403
* symbol.c (gfc_use_derived): Fix coding style.

Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/symbol.c


[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-16 Thread zeccav at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

--- Comment #6 from Vittorio Zecca zeccav at gmail dot com 2011-09-16 
07:12:52 UTC ---
You asked where do I get such an enormous amount of invalid fortran code.
Probably I was too terse in my answer.
I created invalid codes to check corner or extreme cases.
I do believe that to prevent is better than to cure.


[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-16 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

--- Comment #7 from janus at gcc dot gnu.org 2011-09-16 07:30:25 UTC ---
(In reply to comment #6)
 You asked where do I get such an enormous amount of invalid fortran code.
 Probably I was too terse in my answer.

Ok, I get it.


 I created invalid codes to check corner or extreme cases.
 I do believe that to prevent is better than to cure.

Agreed. Your test cases certainly help to make gfortran more bullet-proof.
Thanks a lot!


[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-15 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Keywords||ice-on-invalid-code
   Last reconfirmed||2011-09-15
 CC||janus at gcc dot gnu.org
 AssignedTo|unassigned at gcc dot   |janus at gcc dot gnu.org
   |gnu.org |
 Ever Confirmed|0   |1

--- Comment #1 from janus at gcc dot gnu.org 2011-09-15 11:41:06 UTC ---
This one is also obvious:

Index: gcc/fortran/symbol.c
===
--- gcc/fortran/symbol.c(revision 178876)
+++ gcc/fortran/symbol.c(working copy)
@@ -1945,6 +1945,8 @@
   gfc_symtree *st;
   int i;

+  if (!sym) return NULL;
+
   if (sym-components != NULL || sym-attr.zero_comp)
 return sym;   /* Already defined.  */



Btw: Where do you get this enormous amount of invalid Fortran code?


[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-15 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

--- Comment #2 from janus at gcc dot gnu.org 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=gccview=revrev=178889
Log:
2011-09-15  Janus Weil  ja...@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  ja...@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


[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-15 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

janus at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution||FIXED

--- Comment #3 from janus at gcc dot gnu.org 2011-09-15 17:50:25 UTC ---
Fixed on trunk with r178889. Closing.


[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-15 Thread zeccav at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

--- Comment #4 from Vittorio Zecca zeccav at gmail dot com 2011-09-15 
20:26:18 UTC ---
I created it.


[Bug fortran/50403] SIGSEGV in gfc_use_derived

2011-09-15 Thread janus at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50403

--- Comment #5 from janus at gcc dot gnu.org 2011-09-15 20:48:18 UTC ---
(In reply to comment #4)
 I created it.

Sorry, I don't understand what you're trying to say. Could you please
elaborate?