public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/46459] New: ICE (segfault): Invalid read in compare_actual_formal [error recovery]
@ 2010-11-12 23:56 burnus at gcc dot gnu.org
  2011-02-18 21:17 ` [Bug fortran/46459] " mikael at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-11-12 23:56 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: ICE (segfault): Invalid read in compare_actual_formal
                    [error recovery]
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following program segfaults after printing the diagnostic:

call sub(1)
        1
Error: Dummy argument 'j' of procedure 'sub' at (1) has an attribute that
requires an explicit interface for this procedure


subroutine sub(j)
  integer, volatile :: j
end subroutine sub

call sub(1)
end


Valgrind shows:

 Invalid read of size 8
    at 0x4E180F: compare_actual_formal (interface.c:2270)
    by 0x4E332D: gfc_procedure_use (interface.c:2678)
    by 0x522834: resolve_global_procedure (resolve.c:2195)
    by 0x52A634: resolve_call (resolve.c:3550)


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

* [Bug fortran/46459] ICE (segfault): Invalid read in compare_actual_formal [error recovery]
  2010-11-12 23:56 [Bug fortran/46459] New: ICE (segfault): Invalid read in compare_actual_formal [error recovery] burnus at gcc dot gnu.org
@ 2011-02-18 21:17 ` mikael at gcc dot gnu.org
  2011-02-18 21:18 ` mikael at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2011-02-18 21:17 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2011-02-18 21:13:11 UTC ---
low hanging fruit:

diff --git a/interface.c b/interface.c
index 1e5df61..32c8b6e 100644
--- a/interface.c
+++ b/interface.c
@@ -2292,6 +2292,7 @@ compare_actual_formal (gfc_actual_arglist **ap,
gfc_formal
         shape array, if the dummy argument has the VOLATILE attribute.  */

       if (f->sym->attr.volatile_
+         && a->expr->expr_type == EXPR_VARIABLE
          && a->expr->symtree->n.sym->as
          && a->expr->symtree->n.sym->as->type == AS_ASSUMED_SHAPE
          && !(f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE))
@@ -2321,6 +2322,7 @@ compare_actual_formal (gfc_actual_arglist **ap,
gfc_formal
         dummy argument has the VOLATILE attribute.  */

       if (f->sym->attr.volatile_
+         && a->expr->expr_type == EXPR_VARIABLE
          && a->expr->symtree->n.sym->attr.pointer
          && a->expr->symtree->n.sym->as
          && !(f->sym->as


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

* [Bug fortran/46459] ICE (segfault): Invalid read in compare_actual_formal [error recovery]
  2010-11-12 23:56 [Bug fortran/46459] New: ICE (segfault): Invalid read in compare_actual_formal [error recovery] burnus at gcc dot gnu.org
  2011-02-18 21:17 ` [Bug fortran/46459] " mikael at gcc dot gnu.org
@ 2011-02-18 21:18 ` mikael at gcc dot gnu.org
  2011-03-01 15:53 ` dominiq at lps dot ens.fr
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2011-02-18 21:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Mikael Morin <mikael at gcc dot gnu.org> 2011-02-18 21:16:03 UTC ---
By the way the conditions should not test against
 a->expr->symtree->n.sym->as->type
as it does not support derived type components.


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

* [Bug fortran/46459] ICE (segfault): Invalid read in compare_actual_formal [error recovery]
  2010-11-12 23:56 [Bug fortran/46459] New: ICE (segfault): Invalid read in compare_actual_formal [error recovery] burnus at gcc dot gnu.org
  2011-02-18 21:17 ` [Bug fortran/46459] " mikael at gcc dot gnu.org
  2011-02-18 21:18 ` mikael at gcc dot gnu.org
@ 2011-03-01 15:53 ` dominiq at lps dot ens.fr
  2011-03-04 23:37 ` mikael at gcc dot gnu.org
  2013-06-14 20:36 ` mikael at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dominiq at lps dot ens.fr @ 2011-03-01 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.03.01 15:53:23
     Ever Confirmed|0                           |1

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2011-03-01 15:53:23 UTC ---
The patch in comment #1 fixes the ICE, but I am not sure to understand comment
#2.


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

* [Bug fortran/46459] ICE (segfault): Invalid read in compare_actual_formal [error recovery]
  2010-11-12 23:56 [Bug fortran/46459] New: ICE (segfault): Invalid read in compare_actual_formal [error recovery] burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2011-03-01 15:53 ` dominiq at lps dot ens.fr
@ 2011-03-04 23:37 ` mikael at gcc dot gnu.org
  2013-06-14 20:36 ` mikael at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2011-03-04 23:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> 2011-03-04 23:37:00 UTC ---
(In reply to comment #3)
> I am not sure to understand comment #2.
You're right, assumed shapes are only for procedure arguments. For derived
types components the syntax is the same, but the word is deferred shape.
Then the conditions are fine and comment #2 is irrelevant.


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

* [Bug fortran/46459] ICE (segfault): Invalid read in compare_actual_formal [error recovery]
  2010-11-12 23:56 [Bug fortran/46459] New: ICE (segfault): Invalid read in compare_actual_formal [error recovery] burnus at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2011-03-04 23:37 ` mikael at gcc dot gnu.org
@ 2013-06-14 20:36 ` mikael at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-06-14 20:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> ---
The initial test doesn't lead to a segfault any more.

It is now rejected with:
comment_0.f90:7.8:

call sub(1)
        1
Error: Explicit interface required for 'sub' at (1): volatile argument


However, the following variant is also rejected with the same error:

 call sub(1)
contains
  subroutine sub(j)
   integer, volatile :: j
  end subroutine sub
end


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

end of thread, other threads:[~2013-06-14 20:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-12 23:56 [Bug fortran/46459] New: ICE (segfault): Invalid read in compare_actual_formal [error recovery] burnus at gcc dot gnu.org
2011-02-18 21:17 ` [Bug fortran/46459] " mikael at gcc dot gnu.org
2011-02-18 21:18 ` mikael at gcc dot gnu.org
2011-03-01 15:53 ` dominiq at lps dot ens.fr
2011-03-04 23:37 ` mikael at gcc dot gnu.org
2013-06-14 20:36 ` mikael 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).