public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51302] New: ICE with VOLATILE loop variable
@ 2011-11-25 13:10 burnus at gcc dot gnu.org
  2011-11-25 14:08 ` [Bug fortran/51302] " burnus at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-25 13:10 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51302
           Summary: ICE with VOLATILE loop variable
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


The following program ICEs for me with GCC 4.4 and 4.7. It does not ICE for me
with 4.3, 4.4, 4.5 and 4.6 though I think that's because those do not have tree
checking enabled.

$ gfortran foo.f90 # << 4.7
foo.f90: In function ‘MAIN__’:
foo.f90:3:0: internal compiler error: in gfc_add_modify_loc, at
fortran/trans.c:161

That's a check whether:
  t1 = TREE_TYPE (rhs);
  t2 = TREE_TYPE (lhs);
  gcc_assert (t1 == t2
              || AGGREGATE_TYPE_P (TREE_TYPE (lhs)));

Seemingly, the problem arises as one type is volatile and the other is not,
i.e., one probably needs to add a fold_convert which strips off the volatile.
As no one may modify the loop variable in the loop, stripping off should be
perfectly valid.

integer, volatile :: i
integer :: n = 1
do i = 1, n
end do
end


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

* [Bug fortran/51302] ICE with VOLATILE loop variable
  2011-11-25 13:10 [Bug fortran/51302] New: ICE with VOLATILE loop variable burnus at gcc dot gnu.org
@ 2011-11-25 14:08 ` burnus at gcc dot gnu.org
  2011-11-25 15:56 ` burnus at gcc dot gnu.org
  2011-11-25 15:59 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-25 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|rejects-valid               |ice-on-valid-code

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-25 13:43:39 UTC ---
Draft patch - untested:

--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -1259,7 +1280,8 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t
*pblock, tree dovar,
   loc = code->ext.iterator->start->where.lb->location;

   /* Initialize the DO variable: dovar = from.  */
-  gfc_add_modify_loc (loc, pblock, dovar, from);
+  gfc_add_modify_loc (loc, pblock, dovar,
+                     fold_convert (TREE_TYPE(dovar), from));

   /* Save value for do-tinkering checking. */
   if (gfc_option.rtcheck & GFC_RTCHECK_DO)


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

* [Bug fortran/51302] ICE with VOLATILE loop variable
  2011-11-25 13:10 [Bug fortran/51302] New: ICE with VOLATILE loop variable burnus at gcc dot gnu.org
  2011-11-25 14:08 ` [Bug fortran/51302] " burnus at gcc dot gnu.org
@ 2011-11-25 15:56 ` burnus at gcc dot gnu.org
  2011-11-25 15:59 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-25 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-25 15:18:10 UTC ---
Author: burnus
Date: Fri Nov 25 15:18:06 2011
New Revision: 181724

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

        PR fortran/51302
        * trans-stmt.c (gfc_trans_simple_do): Add a fold_convert.

2011-11-25  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51302
        * gfortran.dg/volatile13.f90: New.


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


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

* [Bug fortran/51302] ICE with VOLATILE loop variable
  2011-11-25 13:10 [Bug fortran/51302] New: ICE with VOLATILE loop variable burnus at gcc dot gnu.org
  2011-11-25 14:08 ` [Bug fortran/51302] " burnus at gcc dot gnu.org
  2011-11-25 15:56 ` burnus at gcc dot gnu.org
@ 2011-11-25 15:59 ` burnus at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-11-25 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-25 15:20:57 UTC ---
FIXED


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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-25 13:10 [Bug fortran/51302] New: ICE with VOLATILE loop variable burnus at gcc dot gnu.org
2011-11-25 14:08 ` [Bug fortran/51302] " burnus at gcc dot gnu.org
2011-11-25 15:56 ` burnus at gcc dot gnu.org
2011-11-25 15:59 ` burnus 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).