public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/50069] New: FORALL fails on a character array
@ 2011-08-13  7:09 zeccav at gmail dot com
  2011-08-15 12:14 ` [Bug fortran/50069] " burnus at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: zeccav at gmail dot com @ 2011-08-13  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50069
           Summary: FORALL fails on a character array
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zeccav@gmail.com


Created attachment 24997
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24997
compile it and run

Must be compiled and run. g95 and Intel ifort deliver the correct result.


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

* [Bug fortran/50069] FORALL fails on a character array
  2011-08-13  7:09 [Bug fortran/50069] New: FORALL fails on a character array zeccav at gmail dot com
@ 2011-08-15 12:14 ` burnus at gcc dot gnu.org
  2011-08-17  8:25 ` burnus at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-15 12:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-15 12:12:12 UTC ---
Wild guess: Dependency analysis (forward/backward etc.) does not take character
substrings into account. If so, it vaguely reminds me of PR 47674.


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

* [Bug fortran/50069] FORALL fails on a character array
  2011-08-13  7:09 [Bug fortran/50069] New: FORALL fails on a character array zeccav at gmail dot com
  2011-08-15 12:14 ` [Bug fortran/50069] " burnus at gcc dot gnu.org
@ 2011-08-17  8:25 ` burnus at gcc dot gnu.org
  2011-08-17  8:52 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-17  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-08-17
     Ever Confirmed|0                           |1
      Known to fail|                            |4.1.2, 4.3.4, 4.4.0, 4.5.1,
                   |                            |4.6.1, 4.7.0

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-17 08:21:34 UTC ---
Draft patch:

diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c
index a911a5b..7d85413 100644
--- a/gcc/fortran/trans-stmt.c
+++ b/gcc/fortran/trans-stmt.c
@@ -2452,6 +2452,9 @@ forall_make_variable_temp (gfc_code *c, stmtblock_t *pre,
stmtblock_t *post)
          tmp = gfc_conv_array_offset (old_sym->backend_decl);
          gfc_conv_descriptor_offset_set (pre, tse.expr, tmp);
        }
+      else
+       gfc_conv_descriptor_offset_set (pre, tse.expr,
+               build_int_cst (gfc_array_index_type, -1));
     }
   else
     {


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

* [Bug fortran/50069] FORALL fails on a character array
  2011-08-13  7:09 [Bug fortran/50069] New: FORALL fails on a character array zeccav at gmail dot com
  2011-08-15 12:14 ` [Bug fortran/50069] " burnus at gcc dot gnu.org
  2011-08-17  8:25 ` burnus at gcc dot gnu.org
@ 2011-08-17  8:52 ` burnus at gcc dot gnu.org
  2013-04-16  8:50 ` zeccav at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: burnus at gcc dot gnu.org @ 2011-08-17  8:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-17 08:44:30 UTC ---
(In reply to comment #2)
> Draft patch:

This patch fails for gfortran.dg/forall_12.f90 test (of PR31217 and PR33811):

    character(LEN=12) :: a(2) = "123456789012"
    forall (i = 3:10) a(:)(i:i+2) = a(:)(i-2:i)

The result with the patch is
 12@+@+
instead of
 121234567890

 * * *

For the test of comment 0, gfortran (unpatched) produces:
    atmp.1.offset = 0;
and accesses
    atmp.1.data)[atmp.1.offset + 1]

While for the now failing test case forall_12.f90, gfortran (unpatched)
produces also
    atmp.1.offset = 0;
but uses
      D.1578 = atmp.1.offset;
      D.1577 = ... atmp.1.data;
      &(*D.1577)[S.5 + D.1578]
where S.5 is the loop variable, which runs from 0 to 1.


Thus, the actual problem seems to be that "a(1)" is translated into
"a[1+offset]" instead of "a[0+offset]".


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

* [Bug fortran/50069] FORALL fails on a character array
  2011-08-13  7:09 [Bug fortran/50069] New: FORALL fails on a character array zeccav at gmail dot com
                   ` (2 preceding siblings ...)
  2011-08-17  8:52 ` burnus at gcc dot gnu.org
@ 2013-04-16  8:50 ` zeccav at gmail dot com
  2015-08-31 16:38 ` zeccav at gmail dot com
  2015-10-12  1:03 ` zmi007 at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: zeccav at gmail dot com @ 2013-04-16  8:50 UTC (permalink / raw)
  To: gcc-bugs


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

Vittorio Zecca <zeccav at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.6.1                       |4.8.0

--- Comment #4 from Vittorio Zecca <zeccav at gmail dot com> 2013-04-16 08:50:50 UTC ---
I still have the same bug on gfortran 4.8.0.


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

* [Bug fortran/50069] FORALL fails on a character array
  2011-08-13  7:09 [Bug fortran/50069] New: FORALL fails on a character array zeccav at gmail dot com
                   ` (3 preceding siblings ...)
  2013-04-16  8:50 ` zeccav at gmail dot com
@ 2015-08-31 16:38 ` zeccav at gmail dot com
  2015-10-12  1:03 ` zmi007 at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: zeccav at gmail dot com @ 2015-08-31 16:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50069

--- Comment #5 from Vittorio Zecca <zeccav at gmail dot com> ---
Still on gfortran 5.2.0


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

* [Bug fortran/50069] FORALL fails on a character array
  2011-08-13  7:09 [Bug fortran/50069] New: FORALL fails on a character array zeccav at gmail dot com
                   ` (4 preceding siblings ...)
  2015-08-31 16:38 ` zeccav at gmail dot com
@ 2015-10-12  1:03 ` zmi007 at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: zmi007 at gmail dot com @ 2015-10-12  1:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50069

zmi <zmi007 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zmi007 at gmail dot com

--- Comment #6 from zmi <zmi007 at gmail dot com> ---
A am not sure if its the same bug, but I get ICE for the function

!-----------------------------------------------------------------------
!Function
!-----------------------------------------------------------------------
function  reverse(string) ! bind(c, name='reverse')
implicit none
character(len=*), intent(in) :: string
character(len=:),allocatable :: reverse
reverse = string
forall (i=1:len(reverse)) reverse(i:i) =
reverse(len(reverse)-i+1:len(reverse)-i+1)
end function reverse



forall (i=1:len(reverse)) reverse(i:i) =
reverse(len(reverse)-i+1:len(reverse)-i+1)
 1
internal compiler error: in gfc_conv_variable, at fortran/trans-expr.c:2368


gfortran --version
GNU Fortran (SUSE Linux) 5.2.1 20150721 [gcc-5-branch revision 226027]


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

end of thread, other threads:[~2015-10-12  1:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-13  7:09 [Bug fortran/50069] New: FORALL fails on a character array zeccav at gmail dot com
2011-08-15 12:14 ` [Bug fortran/50069] " burnus at gcc dot gnu.org
2011-08-17  8:25 ` burnus at gcc dot gnu.org
2011-08-17  8:52 ` burnus at gcc dot gnu.org
2013-04-16  8:50 ` zeccav at gmail dot com
2015-08-31 16:38 ` zeccav at gmail dot com
2015-10-12  1:03 ` zmi007 at gmail dot com

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).