Bug 52161 - Internal compiler errors with -fcheck=bounds in coarray tests
Summary: Internal compiler errors with -fcheck=bounds in coarray tests
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.7.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2012-02-07 21:46 UTC by Dominique d'Humieres
Modified: 2012-11-29 08:43 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2012-02-07 21:46:27 UTC
Compiling the tests gfortran.dg/coarray_2.f90 and gfortran.dg/coarray/sync_1.f90 with -fcheck=bounds gives an internal compiler error:

#0  fold_convert_loc (loc=<value optimized out>, type=<value optimized out>, arg=<value optimized out>) at ../../work/gcc/fold-const.c:1856
#1  0x0000000100119ffc in gfc_trans_sync (code=<value optimized out>, type=<value optimized out>) at ../../work/gcc/fortran/trans-stmt.c:773
#2  0x00000001000b8828 in trans_code (code=<value optimized out>, cond=<value optimized out>) at ../../work/gcc/fortran/trans.c:1457
#3  0x00000001000e1d14 in gfc_generate_function_code (ns=<value optimized out>) at ../../work/gcc/fortran/trans-decl.c:5344
#4  0x000000010007501d in gfc_parse_file () at ../../work/gcc/fortran/parse.c:4455
#5  0x00000001000b38d6 in gfc_be_parse_file () at ../../work/gcc/fortran/f95-lang.c:250
#6  0x00000001007b8741 in toplev_main (argc=4, argv=0x7fff5fbfd7a0) at ../../work/gcc/toplev.c:557
#7  0x0000000100001a94 in start ()

or

#0  fold_convert_loc (loc=<value optimized out>, type=<value optimized out>, arg=<value optimized out>) at ../../work/gcc/fold-const.c:1856
#1  0x0000000100119ffc in gfc_trans_sync (code=<value optimized out>, type=<value optimized out>) at ../../work/gcc/fortran/trans-stmt.c:773
#2  0x00000001000b8828 in trans_code (code=<value optimized out>, cond=<value optimized out>) at ../../work/gcc/fortran/trans.c:1457
#3  0x0000000100116554 in gfc_trans_if_1 (code=<value optimized out>) at ../../work/gcc/fortran/trans-stmt.c:963
#4  0x000000010011a8fb in gfc_trans_if (code=<value optimized out>) at ../../work/gcc/fortran/trans-stmt.c:994
#5  0x00000001000b8938 in trans_code (code=<value optimized out>, cond=<value optimized out>) at ../../work/gcc/fortran/trans.c:1416
#6  0x00000001000e1d14 in gfc_generate_function_code (ns=<value optimized out>) at ../../work/gcc/fortran/trans-decl.c:5344
#7  0x000000010007501d in gfc_parse_file () at ../../work/gcc/fortran/parse.c:4455
#8  0x00000001000b38d6 in gfc_be_parse_file () at ../../work/gcc/fortran/f95-lang.c:250
#9  0x00000001007b8741 in toplev_main (argc=4, argv=0x7fff5fbfd790) at ../../work/gcc/toplev.c:557
#10 0x0000000100001a94 in start ()
Comment 1 Dominique d'Humieres 2012-11-28 15:12:52 UTC
Still there at revision 193884.
Comment 2 Tobias Burnus 2012-11-28 16:03:46 UTC
Untested patch:

--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -797,3 +797,3 @@ gfc_trans_sync (gfc_code *code, gfc_exec_op type)
                               "%d in SYNC IMAGES",
-                              fold_convert (integer_type_node, se.expr));
+                              fold_convert (integer_type_node, images));
     }
Comment 3 Tobias Burnus 2012-11-28 21:42:21 UTC
Author: burnus
Date: Wed Nov 28 21:42:17 2012
New Revision: 193908

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193908
Log:
2012-11-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52161
        * trans-stmt.c (gfc_trans_sync): Fix bound checking.


2012-11-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52161
        * coarray/sync_3.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/coarray/sync_3.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
Comment 4 Tobias Burnus 2012-11-28 21:57:53 UTC
FIXED (on the 4.8 trunk).

Thanks for the report!
Comment 5 Tobias Burnus 2012-11-29 08:43:57 UTC
Author: burnus
Date: Thu Nov 29 08:43:48 2012
New Revision: 193924

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=193924
Log:
2012-11-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52161
        * trans-stmt.c (gfc_trans_sync): Fix bound checking
        for -fcoarray=lib.

2012-11-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52161
        * coarray/sync_3.f90: Extend test.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/coarray/sync_3.f90