public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/53824] New: ICE with ALLOCATE of coarrays
@ 2012-06-30 20:01 burnus at gcc dot gnu.org
  2012-07-01 16:29 ` [Bug fortran/53824] " tkoenig at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-06-30 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53824
           Summary: ICE with ALLOCATE of coarrays
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org
                CC: tkoenig@gcc.gnu.org


Test case by Vladimír Fuka: http://gcc.gnu.org/ml/fortran/2012-06/msg00157.html

The ICE is in:

#0  0x00000000005b209b in gfc_dep_compare_expr (e1=0x0, e2=0x0)
    at fortran/dependency.c:254
#1  0x00000000005936f7 in resolve_allocate_deallocate
(code=code@entry=0x1671700,
    fcn=fcn@entry=0xe78399 "ALLOCATE") at fortran/resolve.c:7439

Seemingly the NULL is neither handled in the caller nor in the callee. The
check is part of

  /* Check that an allocate-object appears only once in the statement.  
     FIXME: Checking derived types is disabled.  */
...
                      /* Handle cases like allocate(v(3)%x(3), v(2)%x(3)),
                         which are legal.  */
...
                          if (gfc_dep_compare_expr (par->start[0],
                                                    qar->start[0]) != 0)

(side question: Is the FIXME still valid?)

Which has been introduced 2011-01-05 for PR 46017,
http://gcc.gnu.org/ml/gcc-cvs/2011-01/msg00123.html


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

* [Bug fortran/53824] ICE with ALLOCATE of coarrays
  2012-06-30 20:01 [Bug fortran/53824] New: ICE with ALLOCATE of coarrays burnus at gcc dot gnu.org
@ 2012-07-01 16:29 ` tkoenig at gcc dot gnu.org
  2012-07-15 10:16 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-07-01 16:29 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-07-01
     Ever Confirmed|0                           |1

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-07-01 16:28:49 UTC ---
This looks straightforward and fixes the ICE:

Index: resolve.c
===================================================================
--- resolve.c   (Revision 188916)
+++ resolve.c   (Arbeitskopie)
@@ -7325,8 +7325,8 @@ resolve_allocate_deallocate (gfc_code *code, const
          }
     }

-  /* Check that an allocate-object appears only once in the statement.  
-     FIXME: Checking derived types is disabled.  */
+  /* Check that an allocate-object appears only once in the statement.  */
+
   for (p = code->ext.alloc.list; p; p = p->next)
     {
       pe = p->expr;
@@ -7376,9 +7376,10 @@ resolve_allocate_deallocate (gfc_code *code, const
                        {
                          gfc_array_ref *par = &(pr->u.ar);
                          gfc_array_ref *qar = &(qr->u.ar);
-                         if (gfc_dep_compare_expr (par->start[0],
-                                                   qar->start[0]) != 0)
-                             break;
+                         if ((par->start[0] != NULL || qar->start[0] != NULL)
+                             && gfc_dep_compare_expr (par->start[0],
+                                                      qar->start[0]) != 0)
+                           break;
                        }
                    }
                  else


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

* [Bug fortran/53824] ICE with ALLOCATE of coarrays
  2012-06-30 20:01 [Bug fortran/53824] New: ICE with ALLOCATE of coarrays burnus at gcc dot gnu.org
  2012-07-01 16:29 ` [Bug fortran/53824] " tkoenig at gcc dot gnu.org
@ 2012-07-15 10:16 ` tkoenig at gcc dot gnu.org
  2012-07-16 20:58 ` tkoenig at gcc dot gnu.org
  2012-11-11 15:09 ` tkoenig at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-07-15 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |tkoenig at gcc dot gnu.org
                   |gnu.org                     |


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

* [Bug fortran/53824] ICE with ALLOCATE of coarrays
  2012-06-30 20:01 [Bug fortran/53824] New: ICE with ALLOCATE of coarrays burnus at gcc dot gnu.org
  2012-07-01 16:29 ` [Bug fortran/53824] " tkoenig at gcc dot gnu.org
  2012-07-15 10:16 ` tkoenig at gcc dot gnu.org
@ 2012-07-16 20:58 ` tkoenig at gcc dot gnu.org
  2012-11-11 15:09 ` tkoenig at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-07-16 20:58 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-07-16 20:58:08 UTC ---
Author: tkoenig
Date: Mon Jul 16 20:58:04 2012
New Revision: 189549

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189549
Log:
2012-07-16  Thomas König  <tkoenig@gcc.gnu.org>

    PR fortran/53824
    * resolve.c (resolve_allocate_deallocate):  If both
    start indices are NULL, skip the test for equality.

2012-07-16  Thomas König  <tkoenig@gcc.gnu.org>

    PR fortran/53824
    * gfortran.dg/coarray_allocate_1.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/coarray_allocate_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/53824] ICE with ALLOCATE of coarrays
  2012-06-30 20:01 [Bug fortran/53824] New: ICE with ALLOCATE of coarrays burnus at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-07-16 20:58 ` tkoenig at gcc dot gnu.org
@ 2012-11-11 15:09 ` tkoenig at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2012-11-11 15:09 UTC (permalink / raw)
  To: gcc-bugs


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

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

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

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> 2012-11-11 15:08:55 UTC ---
Applying the patch from http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189549
runs into another problem:


ig25@linux-fd1f:~/Krempel/Co> gdb ~/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/f951
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/ig25/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/f951...done.
(gdb) r coarray_allocate_1.f90 
Starting program: /home/ig25/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/f951
coarray_allocate_1.f90
coarray_allocate_1.f90:20.31:

 type(Domain),allocatable :: D[:,:,:]
                               1
Schwerwiegender Fehler: Coarray bei (1) ausgeschaltet, -fcoarray= zum
Einschalten verwenden
[Inferior 1 (process 1073) exited with code 01]
(gdb) r ^CQuity_allocate_1.f90 
(gdb) q
ig25@linux-fd1f:~/Krempel/Co> gdb ~/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/f951
GNU gdb (GDB) 7.5
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from
/home/ig25/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/f951...done.
(gdb) r -fcoarray=single coarray_allocate_1.f90 
Starting program: /home/ig25/lib/gcc/x86_64-unknown-linux-gnu/4.7.3/f951
-fcoarray=single coarray_allocate_1.f90
 jac
Program received signal SIGSEGV, Segmentation fault.
0x000000000058ddd5 in gfc_build_array_ref (base=0x7ffff5df8968, offset=0x0,
decl=0x0) at ../../4-7/gcc/fortran/trans.c:341
341       STRIP_TYPE_NOPS (offset);
(gdb) bt
#0  0x000000000058ddd5 in gfc_build_array_ref (base=0x7ffff5df8968, offset=0x0,
decl=0x0) at ../../4-7/gcc/fortran/trans.c:341
#1  0x0000000000590936 in gfc_conv_descriptor_ubound (desc=<optimized out>,
dim=<optimized out>) at ../../4-7/gcc/fortran/trans-array.c:364
#2  0x0000000000591b07 in gfc_conv_descriptor_ubound_get (dim=0x0,
desc=0x7ffff5d03c80) at ../../4-7/gcc/fortran/trans-array.c:377
#3  get_full_array_size (block=0x7fffffffd2c0, decl=0x7ffff5d03c80,
rank=<optimized out>) at ../../4-7/gcc/fortran/trans-array.c:7141
#4  0x0000000000598e40 in structure_alloc_comps (der_type=0x1496a90,
decl=0x7ffff5d03c80, dest=dest@entry=0x0, rank=0, purpose=purpose@entry=2)
    at ../../4-7/gcc/fortran/trans-array.c:7313
#5  0x000000000059972f in gfc_nullify_alloc_comp (der_type=<optimized out>,
decl=<optimized out>, rank=<optimized out>)
    at ../../4-7/gcc/fortran/trans-array.c:7618
#6  0x000000000059a0cb in gfc_array_allocate (se=<optimized out>,
expr=0x14c44b0, status=0x0, errmsg=0x0, errlen=0x0, label_finish=0x0, 
    expr3_elem_size=0x7ffff5e0e840, nelems=0x7fffffffd798, expr3=0x0) at
../../4-7/gcc/fortran/trans-array.c:5147
#7  0x00000000005d77f2 in gfc_trans_allocate (code=<optimized out>) at
../../4-7/gcc/fortran/trans-stmt.c:4849
#8  0x000000000058ee58 in trans_code (code=0x14a19e0, cond=0x0) at
../../4-7/gcc/fortran/trans.c:1462
#9  0x00000000005ab3f8 in gfc_generate_function_code (ns=<optimized out>) at
../../4-7/gcc/fortran/trans-decl.c:5344
#10 0x0000000000550dd7 in translate_all_program_units (main_in_tu=true,
gfc_global_ns_list=0x1493120) at ../../4-7/gcc/fortran/parse.c:4455
#11 gfc_parse_file () at ../../4-7/gcc/fortran/parse.c:4668
#12 0x000000000058b256 in gfc_be_parse_file () at
../../4-7/gcc/fortran/f95-lang.c:250
#13 0x0000000000838f30 in compile_file () at ../../4-7/gcc/toplev.c:557
#14 do_compile () at ../../4-7/gcc/toplev.c:1938
#15 toplev_main (argc=3, argv=0x7fffffffdca8) at ../../4-7/gcc/toplev.c:2014
#16 0x00007ffff643723d in __libc_start_main () from /lib64/libc.so.6
#17 0x00000000004e6f41 in _start () at ../sysdeps/x86_64/elf/start.S:113

so it seems more than this patch is needed to fix this.

Therefore, no backport to 4.7 (since it is fixed on trunk).

Closing.


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

end of thread, other threads:[~2012-11-11 15:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-30 20:01 [Bug fortran/53824] New: ICE with ALLOCATE of coarrays burnus at gcc dot gnu.org
2012-07-01 16:29 ` [Bug fortran/53824] " tkoenig at gcc dot gnu.org
2012-07-15 10:16 ` tkoenig at gcc dot gnu.org
2012-07-16 20:58 ` tkoenig at gcc dot gnu.org
2012-11-11 15:09 ` tkoenig 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).