public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/49623] New: Segfault of "gfortran -L" if no argument follows the "-L"
@ 2011-07-04  6:30 burnus at gcc dot gnu.org
  2011-07-04  7:23 ` [Bug fortran/49623] " jakub at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-07-04  6:30 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: Segfault of "gfortran -L" if no argument follows the
                    "-L"
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


While it works for the C driver:

$ gcc foo.c -L
gcc: error: missing argument to ‘-L’

the Fortran driver segfaults when there is no argument following the "-L"
argument:

$ gfortran foo.f90 -L
Segmentation fault


Valgrind shows:

==18481== Invalid read of size 1
==18481==    at 0x4A06D82: strlen (mc_replace_strmem.c:275)
==18481==    by 0x40E8BE: lang_specific_driver (gfortranspec.c:95)
==18481==    by 0x405EBF: process_command (gcc.c:3637)
==18481==    by 0x40B455: main (gcc.c:6263)
==18481==  Address 0x0 is not stack'd, malloc'd or (recently) free'd


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

* [Bug fortran/49623] Segfault of "gfortran -L" if no argument follows the "-L"
  2011-07-04  6:30 [Bug fortran/49623] New: Segfault of "gfortran -L" if no argument follows the "-L" burnus at gcc dot gnu.org
@ 2011-07-04  7:23 ` jakub at gcc dot gnu.org
  2011-07-04 11:05 ` joseph at codesourcery dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-04  7:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011.07.04 07:22:23
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 07:22:23 UTC ---
Created attachment 24666
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24666
gcc47-pr49623.patch

Untested fix.  Unfortunately it is hard to create a dejagnu testcase for this,
as lots of options are appended after dg-options.


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

* [Bug fortran/49623] Segfault of "gfortran -L" if no argument follows the "-L"
  2011-07-04  6:30 [Bug fortran/49623] New: Segfault of "gfortran -L" if no argument follows the "-L" burnus at gcc dot gnu.org
  2011-07-04  7:23 ` [Bug fortran/49623] " jakub at gcc dot gnu.org
@ 2011-07-04 11:05 ` joseph at codesourcery dot com
  2011-07-04 21:13 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: joseph at codesourcery dot com @ 2011-07-04 11:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-07-04 11:04:36 UTC ---
On Mon, 4 Jul 2011, jakub at gcc dot gnu.org wrote:

> Created attachment 24666
>   --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24666
> gcc47-pr49623.patch
> 
> Untested fix.  Unfortunately it is hard to create a dejagnu testcase for this,
> as lots of options are appended after dg-options.

I think it would be better to repeat the logic in the next loop (that 
avoids looking in detail at options with CL_ERR_MISSING_ARG set) before 
the switch statement in this loop, so that if any more options are added 
to this loop that involve looking at the arguments it isn't necessary for 
each to check individually for the case of a missing argument.


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

* [Bug fortran/49623] Segfault of "gfortran -L" if no argument follows the "-L"
  2011-07-04  6:30 [Bug fortran/49623] New: Segfault of "gfortran -L" if no argument follows the "-L" burnus at gcc dot gnu.org
  2011-07-04  7:23 ` [Bug fortran/49623] " jakub at gcc dot gnu.org
  2011-07-04 11:05 ` joseph at codesourcery dot com
@ 2011-07-04 21:13 ` jakub at gcc dot gnu.org
  2011-07-04 21:14 ` jakub at gcc dot gnu.org
  2011-07-04 21:15 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-04 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 21:12:59 UTC ---
Author: jakub
Date: Mon Jul  4 21:12:57 2011
New Revision: 175830

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175830
Log:
    PR fortran/49623
    * gfortranspec.c (lang_specific_driver): Ignore options with
    CL_ERR_MISSING_ARG errors.

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


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

* [Bug fortran/49623] Segfault of "gfortran -L" if no argument follows the "-L"
  2011-07-04  6:30 [Bug fortran/49623] New: Segfault of "gfortran -L" if no argument follows the "-L" burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-07-04 21:13 ` jakub at gcc dot gnu.org
@ 2011-07-04 21:14 ` jakub at gcc dot gnu.org
  2011-07-04 21:15 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-04 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 21:13:36 UTC ---
Author: jakub
Date: Mon Jul  4 21:13:34 2011
New Revision: 175831

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175831
Log:
    PR fortran/49623
    * gfortranspec.c (lang_specific_driver): Ignore options with
    CL_ERR_MISSING_ARG errors.

Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/gfortranspec.c


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

* [Bug fortran/49623] Segfault of "gfortran -L" if no argument follows the "-L"
  2011-07-04  6:30 [Bug fortran/49623] New: Segfault of "gfortran -L" if no argument follows the "-L" burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-07-04 21:14 ` jakub at gcc dot gnu.org
@ 2011-07-04 21:15 ` jakub at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-07-04 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-04 21:15:31 UTC ---
Fixed for 4.6+.


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

end of thread, other threads:[~2011-07-04 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-04  6:30 [Bug fortran/49623] New: Segfault of "gfortran -L" if no argument follows the "-L" burnus at gcc dot gnu.org
2011-07-04  7:23 ` [Bug fortran/49623] " jakub at gcc dot gnu.org
2011-07-04 11:05 ` joseph at codesourcery dot com
2011-07-04 21:13 ` jakub at gcc dot gnu.org
2011-07-04 21:14 ` jakub at gcc dot gnu.org
2011-07-04 21:15 ` jakub 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).