public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35940]  New: Array BACK ignored in INDEX intrinsic when other args scalar
@ 2008-04-14 21:47 dick dot hendrickson at gmail dot com
  2008-04-14 21:50 ` [Bug fortran/35940] " dick dot hendrickson at gmail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: dick dot hendrickson at gmail dot com @ 2008-04-14 21:47 UTC (permalink / raw)
  To: gcc-bugs

The following gives the wrong answers.  It may have to do
with broadcasting things to arrays.  The all scalar case works
and an array first argument works.

      program FA1031

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

      INTEGER IDA1(10)
      LOGICAL GDA1(10)

      IDA1   = 0
      gda1 = (/ (i/2*2 .ne. I, i=1,10) /)
      print '(10L2)', gda1

      IDA1 = INDEX ( 'DEFDEF' , 'DEF', GDA1 )    !fails
      print '(10I2)', ida1

      IDA1 = INDEX ( (/ ('DEFDEF',i=1,10) /) , 'DEF', GDA1 )    !works
      print '(10I2)', ida1

      IDA = INDEX ( 'DEFDEF' , 'DEF', .true. )   !works
      print '(I2)', ida

      END


-- 
           Summary: Array BACK ignored in INDEX intrinsic when other args
                    scalar
           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=35940


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
@ 2008-04-14 21:50 ` dick dot hendrickson at gmail dot com
  2008-04-16 18:10 ` tkoenig at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dick dot hendrickson at gmail dot com @ 2008-04-14 21:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dick dot hendrickson at gmail dot com  2008-04-14 21:49 -------
I forgot to include the output

C:\gfortran>gfortran fa1031.f

C:\gfortran>a
 T F T F T F T F T F
 1 1 1 1 1 1 1 1 1 1
 4 1 4 1 4 1 4 1 4 1
 4


-- 

dick dot hendrickson at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dick dot hendrickson at
                   |                            |gmail dot com


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


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
  2008-04-14 21:50 ` [Bug fortran/35940] " dick dot hendrickson at gmail dot com
@ 2008-04-16 18:10 ` tkoenig at gcc dot gnu dot org
  2008-04-16 18:16 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-04-16 18:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at gcc dot gnu dot org  2008-04-16 18:09 -------
Confirmed, not a regression.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code


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


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
  2008-04-14 21:50 ` [Bug fortran/35940] " dick dot hendrickson at gmail dot com
  2008-04-16 18:10 ` tkoenig at gcc dot gnu dot org
@ 2008-04-16 18:16 ` tkoenig at gcc dot gnu dot org
  2008-04-29 19:24 ` bdavis at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-04-16 18:16 UTC (permalink / raw)
  To: gcc-bugs



-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-04-16 18:16:05
               date|                            |


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


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
                   ` (2 preceding siblings ...)
  2008-04-16 18:16 ` tkoenig at gcc dot gnu dot org
@ 2008-04-29 19:24 ` bdavis at gcc dot gnu dot org
  2008-04-30  0:01 ` jvdelisle at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2008-04-29 19:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bdavis at gcc dot gnu dot org  2008-04-29 19:23 -------
this looks promising:

Index: gcc/gcc/fortran/simplify.c
===================================================================
--- gcc/gcc/fortran/simplify.c  (revision 134801)
+++ gcc/gcc/fortran/simplify.c  (working copy)
@@ -1570,7 +1570,8 @@
   int back, len, lensub;
   int i, j, k, count, index = 0, start;

-  if (x->expr_type != EXPR_CONSTANT || y->expr_type != EXPR_CONSTANT)
+  if (x->expr_type != EXPR_CONSTANT || y->expr_type != EXPR_CONSTANT 
+      || b->expr_type !=  EXPR_CONSTANT)
     return NULL;

   if (b != NULL && b->value.logical != 0)


-- 


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


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
                   ` (3 preceding siblings ...)
  2008-04-29 19:24 ` bdavis at gcc dot gnu dot org
@ 2008-04-30  0:01 ` jvdelisle at gcc dot gnu dot org
  2008-04-30  0:54 ` bdavis at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-04-30  0:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2008-04-30 00:00 -------
Note the last line of patch is checking for b != NULL before using it. 
Probably want to do likewise for the added test condition above.


-- 


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


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
                   ` (4 preceding siblings ...)
  2008-04-30  0:01 ` jvdelisle at gcc dot gnu dot org
@ 2008-04-30  0:54 ` bdavis at gcc dot gnu dot org
  2008-04-30  0:56 ` bdavis at gcc dot gnu dot org
  2008-05-12 18:02 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2008-04-30  0:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from bdavis at gcc dot gnu dot org  2008-04-30 00:54 -------
close.  here is a better patch.

http://gcc.gnu.org/ml/fortran/2008-04/msg00278.html


-- 


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


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
                   ` (5 preceding siblings ...)
  2008-04-30  0:54 ` bdavis at gcc dot gnu dot org
@ 2008-04-30  0:56 ` bdavis at gcc dot gnu dot org
  2008-05-12 18:02 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: bdavis at gcc dot gnu dot org @ 2008-04-30  0:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from bdavis at gcc dot gnu dot org  2008-04-30 00:55 -------
notice the 6 minutes between the above posts :)
jerry was correct, it needed a NULL check. 


-- 


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


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

* [Bug fortran/35940] Array BACK ignored in INDEX intrinsic when other args scalar
  2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
                   ` (6 preceding siblings ...)
  2008-04-30  0:56 ` bdavis at gcc dot gnu dot org
@ 2008-05-12 18:02 ` fxcoudert at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2008-05-12 18:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from fxcoudert at gcc dot gnu dot org  2008-05-12 18:02 -------
Patch committed, fixed on mainline.


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu dot
                   |                            |org
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.4.0


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


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

end of thread, other threads:[~2008-05-12 18:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14 21:47 [Bug fortran/35940] New: Array BACK ignored in INDEX intrinsic when other args scalar dick dot hendrickson at gmail dot com
2008-04-14 21:50 ` [Bug fortran/35940] " dick dot hendrickson at gmail dot com
2008-04-16 18:10 ` tkoenig at gcc dot gnu dot org
2008-04-16 18:16 ` tkoenig at gcc dot gnu dot org
2008-04-29 19:24 ` bdavis at gcc dot gnu dot org
2008-04-30  0:01 ` jvdelisle at gcc dot gnu dot org
2008-04-30  0:54 ` bdavis at gcc dot gnu dot org
2008-04-30  0:56 ` bdavis at gcc dot gnu dot org
2008-05-12 18:02 ` fxcoudert 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).