public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/56477] New: ICE on invalid with pointer assignment to function result
@ 2013-02-27 21:55 abensonca at gmail dot com
  2013-02-27 22:15 ` [Bug fortran/56477] [4.8 Regression] " tkoenig at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: abensonca at gmail dot com @ 2013-02-27 21:55 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56477
           Summary: ICE on invalid with pointer assignment to function
                    result
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: abensonca@gmail.com


The following causes an ICE with gfortran 4.8.0 r196316:

module s
contains
  function so()
    implicit none
    integer, target  :: so
    integer, pointer :: sp
    sp => so
    return
  end function So
end module s

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/home/abenson/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/abenson
--enable-languages=c,c++,fortran --disable-multilib --with-gmp=/home/abenson
Thread model: posix
gcc version 4.8.0 20130227 (experimental) (GCC) 

$ gfortran -c -o ICEtest.o ICEtest.F90 -Wall
f951: internal compiler error: Segmentation fault
0x92f79f crash_signal
        ../../gcc-trunk/gcc/toplev.c:332
0x4fdbf2 gfc_check_pointer_assign(gfc_expr*, gfc_expr*)
        ../../gcc-trunk/gcc/fortran/expr.c:3734
0x5555d6 resolve_code
        ../../gcc-trunk/gcc/fortran/resolve.c:10261
0x557c5e resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:14972
0x557b67 resolve_codes
        ../../gcc-trunk/gcc/fortran/resolve.c:14958
0x548aa2 gfc_resolve
        ../../gcc-trunk/gcc/fortran/resolve.c:15000
0x53d186 gfc_parse_file()
        ../../gcc-trunk/gcc/fortran/parse.c:4608
0x579415 gfc_be_parse_file
        ../../gcc-trunk/gcc/fortran/f95-lang.c:189
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.


The "-Wall" is important - without the code compiles without complaint.

I tagged this as invalid(?) because I don't think that giving the function
return value the TARGET attribute makes sense, although I couldn't find
anything that clearly says it's not allowed.


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

* [Bug fortran/56477] [4.8 Regression] ICE on invalid with pointer assignment to function result
  2013-02-27 21:55 [Bug fortran/56477] New: ICE on invalid with pointer assignment to function result abensonca at gmail dot com
@ 2013-02-27 22:15 ` tkoenig at gcc dot gnu.org
  2013-02-27 22:31 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-02-27 22:15 UTC (permalink / raw)
  To: gcc-bugs


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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|                            |2013-02-27
                 CC|                            |burnus at gcc dot gnu.org,
                   |                            |tkoenig at gcc dot gnu.org
     Ever Confirmed|0                           |1
            Summary|ICE on invalid with pointer |[4.8 Regression] ICE on
                   |assignment to function      |invalid with pointer
                   |result                      |assignment to function
                   |                            |result
   Target Milestone|---                         |4.8.0

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-02-27 22:14:33 UTC ---
The problem is in

       for (ns = rvalue->symtree->n.sym->ns;
        ns->proc_name && ns->proc_name->attr.flavor != FL_PROCEDURE;
        ns = ns->parent)

where value->symtree->n.sym->ns->parent is NULL.

Does not happen with 4.7 or 4.6.


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

* [Bug fortran/56477] [4.8 Regression] ICE on invalid with pointer assignment to function result
  2013-02-27 21:55 [Bug fortran/56477] New: ICE on invalid with pointer assignment to function result abensonca at gmail dot com
  2013-02-27 22:15 ` [Bug fortran/56477] [4.8 Regression] " tkoenig at gcc dot gnu.org
@ 2013-02-27 22:31 ` tkoenig at gcc dot gnu.org
  2013-03-03 19:59 ` mikael at gcc dot gnu.org
  2013-03-03 20:02 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2013-02-27 22:31 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2013-02-27 22:31:08 UTC ---

> where value->symtree->n.sym->ns->parent is NULL.

Should be rvalue->symtree->n.sym->ns->parent (copy&paste error).


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

* [Bug fortran/56477] [4.8 Regression] ICE on invalid with pointer assignment to function result
  2013-02-27 21:55 [Bug fortran/56477] New: ICE on invalid with pointer assignment to function result abensonca at gmail dot com
  2013-02-27 22:15 ` [Bug fortran/56477] [4.8 Regression] " tkoenig at gcc dot gnu.org
  2013-02-27 22:31 ` tkoenig at gcc dot gnu.org
@ 2013-03-03 19:59 ` mikael at gcc dot gnu.org
  2013-03-03 20:02 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-03-03 19:59 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Mikael Morin <mikael at gcc dot gnu.org> 2013-03-03 19:58:53 UTC ---
Author: mikael
Date: Sun Mar  3 19:58:49 2013
New Revision: 196417

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196417
Log:
fortran/
    PR fortran/56477
    * expr.c (gfc_check_pointer_assign): Avoid NULL pointer dereference.

testsuite/
    PR fortran/56477
    * gfortran.dg/pointer_check_13.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/pointer_check_13.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/56477] [4.8 Regression] ICE on invalid with pointer assignment to function result
  2013-02-27 21:55 [Bug fortran/56477] New: ICE on invalid with pointer assignment to function result abensonca at gmail dot com
                   ` (2 preceding siblings ...)
  2013-03-03 19:59 ` mikael at gcc dot gnu.org
@ 2013-03-03 20:02 ` mikael at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mikael at gcc dot gnu.org @ 2013-03-03 20:02 UTC (permalink / raw)
  To: gcc-bugs


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mikael at gcc dot gnu.org
         Resolution|                            |FIXED

--- Comment #4 from Mikael Morin <mikael at gcc dot gnu.org> 2013-03-03 20:01:44 UTC ---
Fixed.


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

end of thread, other threads:[~2013-03-03 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-27 21:55 [Bug fortran/56477] New: ICE on invalid with pointer assignment to function result abensonca at gmail dot com
2013-02-27 22:15 ` [Bug fortran/56477] [4.8 Regression] " tkoenig at gcc dot gnu.org
2013-02-27 22:31 ` tkoenig at gcc dot gnu.org
2013-03-03 19:59 ` mikael at gcc dot gnu.org
2013-03-03 20:02 ` 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).