public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50404] New: SIGSEGV in gfc_resolve_close
@ 2011-09-15  8:28 zeccav at gmail dot com
  2011-09-15 13:52 ` [Bug fortran/50404] " Joost.VandeVondele at pci dot uzh.ch
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zeccav at gmail dot com @ 2011-09-15  8:28 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50404
           Summary: SIGSEGV in gfc_resolve_close
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zeccav@gmail.com


Created attachment 25280
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25280
just compile it

SIGSEGV in gfc_resolve_close


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

* [Bug fortran/50404] SIGSEGV in gfc_resolve_close
  2011-09-15  8:28 [Bug fortran/50404] New: SIGSEGV in gfc_resolve_close zeccav at gmail dot com
@ 2011-09-15 13:52 ` Joost.VandeVondele at pci dot uzh.ch
  2011-09-15 16:49 ` kargl at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Joost.VandeVondele at pci dot uzh.ch @ 2011-09-15 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

Joost VandeVondele <Joost.VandeVondele at pci dot uzh.ch> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-09-15
     Ever Confirmed|0                           |1


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

* [Bug fortran/50404] SIGSEGV in gfc_resolve_close
  2011-09-15  8:28 [Bug fortran/50404] New: SIGSEGV in gfc_resolve_close zeccav at gmail dot com
  2011-09-15 13:52 ` [Bug fortran/50404] " Joost.VandeVondele at pci dot uzh.ch
@ 2011-09-15 16:49 ` kargl at gcc dot gnu.org
  2011-11-08 23:57 ` fxcoudert at gcc dot gnu.org
  2011-11-09  0:00 ` fxcoudert at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kargl at gcc dot gnu.org @ 2011-09-15 16:49 UTC (permalink / raw)
  To: gcc-bugs

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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kargl at gcc dot gnu.org

--- Comment #1 from kargl at gcc dot gnu.org 2011-09-15 15:47:33 UTC ---
Program received signal SIGSEGV, Segmentation fault.
0x00000000004d17e9 in gfc_resolve_close (close=0x202007220)
    at ../../gcc4x/gcc/fortran/io.c:2298
2298      if (close->unit->expr_type == EXPR_CONSTANT
(gdb) bt
#0  0x00000000004d17e9 in gfc_resolve_close (close=0x202007220)
    at ../../gcc4x/gcc/fortran/io.c:2298
#1  0x0000000000501bbf in resolve_code (code=0x2020a6300, ns=0x2021bb200)
    at ../../gcc4x/gcc/fortran/resolve.c:9382
#2  0x00000000005028f9 in resolve_codes (ns=0x2021bb200)
    at ../../gcc4x/gcc/fortran/resolve.c:13665
#3  0x0000000000502a24 in gfc_resolve (ns=0x2021bb200)
    at ../../gcc4x/gcc/fortran/resolve.c:13692
#4  0x00000000004f5d04 in resolve_all_program_units ()
    at ../../gcc4x/gcc/fortran/parse.c:4336
#5  gfc_parse_file () at ../../gcc4x/gcc/fortran/parse.c:4602
#6  0x000000000052cdce in gfc_be_parse_file ()
    at ../../gcc4x/gcc/fortran/f95-lang.c:250
#7  0x00000000008c806b in compile_file () at ../../gcc4x/gcc/toplev.c:548
#8  do_compile () at ../../gcc4x/gcc/toplev.c:1886
#9  0x00000000008c8c95 in toplev_main (argc=2, argv=0x7fffffffd508)
    at ../../gcc4x/gcc/toplev.c:1962
#10 0x00000000004900dc in _start ()

(gdb) print close
$1 = (gfc_close *) 0x202007220
(gdb) print *close
$2 = {unit = 0x0, status = 0x0, iostat = 0x2020a6180, iomsg = 0x0, err = 0x0}

>From f2003

C907 (R909) A file-unit-number shall be specified; if the optional
  characters UNIT= are omitted, the file-unit-number shall be the
  first item in the close-spec-list.

troutmask:sgk[256] gfc4x -c a.f
a.f:5.72:

      close(iostat=i)                                                   
                                                                        1
Error: CLOSE statement at (1) requires a UNIT number


Index: io.c
===================================================================
--- io.c        (revision 178782)
+++ io.c        (working copy)
@@ -2295,6 +2295,12 @@ gfc_resolve_close (gfc_close *close)
   if (gfc_reference_st_label (close->err, ST_LABEL_TARGET) == FAILURE)
     return FAILURE;

+  if (close->unit == NULL)
+    {
+      gfc_error ("CLOSE statement at %C requires a UNIT number");
+      return FAILURE;
+    }
+
   if (close->unit->expr_type == EXPR_CONSTANT
       && close->unit->ts.type == BT_INTEGER
       && mpz_sgn (close->unit->value.integer) < 0)


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

* [Bug fortran/50404] SIGSEGV in gfc_resolve_close
  2011-09-15  8:28 [Bug fortran/50404] New: SIGSEGV in gfc_resolve_close zeccav at gmail dot com
  2011-09-15 13:52 ` [Bug fortran/50404] " Joost.VandeVondele at pci dot uzh.ch
  2011-09-15 16:49 ` kargl at gcc dot gnu.org
@ 2011-11-08 23:57 ` fxcoudert at gcc dot gnu.org
  2011-11-09  0:00 ` fxcoudert at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-11-08 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-11-08 23:54:48 UTC ---
Author: fxcoudert
Date: Tue Nov  8 23:54:43 2011
New Revision: 181183

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=181183
Log:
    PR fortran/50404
    * io.c (gfc_resolve_close): CLOSE requires a UNIT.
    * gfortran.dg/io_constraints_3.f90: Improve testcase.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/io.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/io_constraints_3.f90


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

* [Bug fortran/50404] SIGSEGV in gfc_resolve_close
  2011-09-15  8:28 [Bug fortran/50404] New: SIGSEGV in gfc_resolve_close zeccav at gmail dot com
                   ` (2 preceding siblings ...)
  2011-11-08 23:57 ` fxcoudert at gcc dot gnu.org
@ 2011-11-09  0:00 ` fxcoudert at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2011-11-09  0:00 UTC (permalink / raw)
  To: gcc-bugs

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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|NEW                         |RESOLVED
                 CC|                            |fxcoudert at gcc dot
                   |                            |gnu.org
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> 2011-11-08 23:57:21 UTC ---
Fixed on trunk.


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

end of thread, other threads:[~2011-11-08 23:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-15  8:28 [Bug fortran/50404] New: SIGSEGV in gfc_resolve_close zeccav at gmail dot com
2011-09-15 13:52 ` [Bug fortran/50404] " Joost.VandeVondele at pci dot uzh.ch
2011-09-15 16:49 ` kargl at gcc dot gnu.org
2011-11-08 23:57 ` fxcoudert at gcc dot gnu.org
2011-11-09  0:00 ` fxcoudert at gcc dot gnu.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).