public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35756]  New: incorrect WHERE for functions in ELSEWHERE and overlaps
@ 2008-03-29 15:38 dick dot hendrickson at gmail dot com
  2008-03-29 15:52 ` [Bug fortran/35756] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: dick dot hendrickson at gmail dot com @ 2008-03-29 15:38 UTC (permalink / raw)
  To: gcc-bugs

The following program computes the wrong values for the even
(elsewhere branch) of the left hand array.  It looks like the
function R_MY_MIN_I is evaluated before the store in the WHERE
branch happens.

The same thing happens if the R_M* functions are external 
rather than contained.

Dick Hendrickson

      program RA1028

! fails on Windows XP
! gcc version 4.4.0 20080312 (experimental) [trunk revision 133139]

      INTEGER  ILA(10)
      LOGICAL  LDA(10)

      ILA = (/ (I, i=1,10) /)
      LDA = (/ (i/2*2 .ne. I, i=1,10) /)

      WHERE(LDA)
        ILA = R_MY_MAX_I(ILA)
      ELSEWHERE
        ILA = R_MY_MIN_I(ILA)
      ENDWHERE

      print *, 10,2,10,2, '  etc'        !expected
      print *, ila

      CONTAINS

      INTEGER FUNCTION R_MY_MAX_I(A)
      INTEGER  ::  A(:)
      R_MY_MAX_I = MAXVAL(A)
      END FUNCTION R_MY_MAX_I     !internal procedure

      INTEGER FUNCTION R_MY_MIN_I(A)
      INTEGER  ::  A(:)
      R_MY_MIN_I = MINVAL(A)
      END FUNCTION R_MY_MIN_I     !internal procedure

      END



C:\g_experiments\gfortran>gfortran ra1028.f

C:\g_experiments\gfortran>a
          10           2          10           2   etc
          10           1          10           1          10           1
  10           1          10           1


-- 
           Summary: incorrect WHERE for functions in ELSEWHERE and overlaps
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


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


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

* [Bug fortran/35756] incorrect WHERE for functions in ELSEWHERE and overlaps
  2008-03-29 15:38 [Bug fortran/35756] New: incorrect WHERE for functions in ELSEWHERE and overlaps dick dot hendrickson at gmail dot com
@ 2008-03-29 15:52 ` burnus at gcc dot gnu dot org
  2008-03-31 20:37 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-03-29 15:52 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from burnus at gcc dot gnu dot org  2008-03-29 15:52 -------
Confirm.  See also PR 35745.


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |wrong-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-03-29 15:52:08
               date|                            |


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


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

* [Bug fortran/35756] incorrect WHERE for functions in ELSEWHERE and overlaps
  2008-03-29 15:38 [Bug fortran/35756] New: incorrect WHERE for functions in ELSEWHERE and overlaps dick dot hendrickson at gmail dot com
  2008-03-29 15:52 ` [Bug fortran/35756] " burnus at gcc dot gnu dot org
@ 2008-03-31 20:37 ` pault at gcc dot gnu dot org
  2008-05-16 21:13 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-03-31 20:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2008-03-31 20:36 -------
This is fixed by my patch for PR35759.  I am holding off on this for 24 hours
because (i) I know that there is an issue with derived types with allocatable
components and (ii) I've spent a bit too long looking at some other PRs of
yours an have broken my tree in so doing:) It must be bed time!

Cheers

Pau


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pault at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-03-29 15:52:08         |2008-03-31 20:36:30
               date|                            |


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


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

* [Bug fortran/35756] incorrect WHERE for functions in ELSEWHERE and overlaps
  2008-03-29 15:38 [Bug fortran/35756] New: incorrect WHERE for functions in ELSEWHERE and overlaps dick dot hendrickson at gmail dot com
  2008-03-29 15:52 ` [Bug fortran/35756] " burnus at gcc dot gnu dot org
  2008-03-31 20:37 ` pault at gcc dot gnu dot org
@ 2008-05-16 21:13 ` pault at gcc dot gnu dot org
  2008-05-17  7:12 ` pault at gcc dot gnu dot org
  2008-05-17  7:17 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-05-16 21:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2008-05-16 21:12 -------
Subject: Bug 35756

Author: pault
Date: Fri May 16 21:12:04 2008
New Revision: 135443

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135443
Log:
2008-05-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35756
        PR fortran/35759
        * trans-stmt.c (gfc_trans_where): Tighten up the dependency
        check for calling gfc_trans_where_3.

        PR fortran/35743
        * trans-stmt.c (gfc_trans_where_2): Set the mask size to zero
        if it is calculated to be negative.

        PR fortran/35745
        * trans-stmt.c (gfc_trans_where_3, gfc_trans_where_assign): Set
        ss->where for scalar right hand sides.
        * trans-array.c (gfc_add_loop_ss_code): If ss->where is set do
        not evaluate scalars outside the loop.  Clean up whitespace.
        * trans.h : Add a bitfield 'where' to gfc_ss.

2008-05-16  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/35756
        PR fortran/35759
        * gfortran.dg/where_1.f90: New test.

        PR fortran/35743
        PR fortran/35745
        * gfortran.dg/where_2.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/where_1.f90
    trunk/gcc/testsuite/gfortran.dg/where_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-array.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/fortran/trans.h
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/35756] incorrect WHERE for functions in ELSEWHERE and overlaps
  2008-03-29 15:38 [Bug fortran/35756] New: incorrect WHERE for functions in ELSEWHERE and overlaps dick dot hendrickson at gmail dot com
                   ` (2 preceding siblings ...)
  2008-05-16 21:13 ` pault at gcc dot gnu dot org
@ 2008-05-17  7:12 ` pault at gcc dot gnu dot org
  2008-05-17  7:17 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-05-17  7:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2008-05-17 07:11 -------
Subject: Bug 35756

Author: pault
Date: Sat May 17 07:10:13 2008
New Revision: 135461

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135461
Log:
2008-05-17  Paul Thomas  <pault@gcc.gnu.org>

        Backport from mainline:
        PR fortran/35756
        PR fortran/35759
        * trans-stmt.c (gfc_trans_where): Tighten up the dependency
        check for calling gfc_trans_where_3.

        PR fortran/35743
        * trans-stmt.c (gfc_trans_where_2): Set the mask size to zero
        if it is calculated to be negative.

        PR fortran/35745
        * trans-stmt.c (gfc_trans_where_3, gfc_trans_where_assign): Set
        ss->where for scalar right hand sides.
        * trans-array.c (gfc_add_loop_ss_code): If ss->where is set do
        not evaluate scalars outside the loop.  Clean up whitespace.
        * trans.h : Add a bitfield 'where' to gfc_ss.

       PR fortran/36233
       * interface.c (compare_actual_formal): Do not check sizes if the
       actual is BT_PROCEDURE.

2008-05-17  Paul Thomas  <pault@gcc.gnu.org>

        Backport from mainline:
        PR fortran/35756
        PR fortran/35759
        * gfortran.dg/where_1.f90: New test.

        PR fortran/35743
        PR fortran/35745
        * gfortran.dg/where_2.f90: New test.

       PR fortran/36233
       * gfortran.dg/actual_procedure_1.f90: New test

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/actual_procedure_1.f90
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/where_1.f90
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/where_2.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/interface.c
    branches/gcc-4_3-branch/gcc/fortran/trans-array.c
    branches/gcc-4_3-branch/gcc/fortran/trans-stmt.c
    branches/gcc-4_3-branch/gcc/fortran/trans.h
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/35756] incorrect WHERE for functions in ELSEWHERE and overlaps
  2008-03-29 15:38 [Bug fortran/35756] New: incorrect WHERE for functions in ELSEWHERE and overlaps dick dot hendrickson at gmail dot com
                   ` (3 preceding siblings ...)
  2008-05-17  7:12 ` pault at gcc dot gnu dot org
@ 2008-05-17  7:17 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-05-17  7:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2008-05-17 07:16 -------
Fixed on trunk and 4.3.

Thanks for the report.

Paul


-- 

pault at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-05-17  7:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-29 15:38 [Bug fortran/35756] New: incorrect WHERE for functions in ELSEWHERE and overlaps dick dot hendrickson at gmail dot com
2008-03-29 15:52 ` [Bug fortran/35756] " burnus at gcc dot gnu dot org
2008-03-31 20:37 ` pault at gcc dot gnu dot org
2008-05-16 21:13 ` pault at gcc dot gnu dot org
2008-05-17  7:12 ` pault at gcc dot gnu dot org
2008-05-17  7:17 ` pault at gcc dot gnu dot 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).