public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
  2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
@ 2007-10-03 12:27 ` fxcoudert at gcc dot gnu dot org
  2007-10-03 13:04 ` dominiq at lps dot ens dot fr
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-03 12:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert 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         |2007-10-03 12:27:28
               date|                            |


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


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

* [Bug fortran/33636]  New: Rejects valid use of vector subscript in derived type parameter
@ 2007-10-03 12:27 fxcoudert at gcc dot gnu dot org
  2007-10-03 12:27 ` [Bug fortran/33636] " fxcoudert at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-03 12:27 UTC (permalink / raw)
  To: gcc-bugs

This was seen on ppc-darwin and x86_64-linux with -m32:

$ cat x.f90
  implicit none
  type vec3
    integer, dimension(1) :: coords
  end type vec3
  type(vec3), parameter :: v1 = vec3((/ 0 /))
  integer :: i

  i = 1
  print *, v1%coords ((/i/))
  end
$ gfortran -m32 x.f90
x.f90:9.23:

  print *, v1%coords ((/i/))
                     1
Error: index in dimension 1 is out of bounds at (1)


-- 
           Summary: Rejects valid use of vector subscript in derived type
                    parameter
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fxcoudert at gcc dot gnu dot org
OtherBugsDependingO 32834
             nThis:


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


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

* [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
  2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
  2007-10-03 12:27 ` [Bug fortran/33636] " fxcoudert at gcc dot gnu dot org
@ 2007-10-03 13:04 ` dominiq at lps dot ens dot fr
  2007-10-06 17:17 ` pault at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-10-03 13:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2007-10-03 13:03 -------
On PPC Darwin, I get:

[karma] f90/bug% gfc pr33636.f90
[karma] f90/bug% a.out
           0
[karma] f90/bug% gfc -m64 pr33636.f90
[karma] f90/bug% a.out
           0
[karma] f90/bug% gfc
/opt/gcc/_gcc-clean/gcc/testsuite/gfortran.dg/derived_comp_array_ref_5.f90
/opt/gcc/_gcc-clean/gcc/testsuite/gfortran.dg/derived_comp_array_ref_5.f90:34.28:

      v2 = vec3 (v1%coords ((/i+1, i, i-1/))) ! also broken
                           1
Error: index in dimension 1 is out of bounds at (1)
[karma] f90/bug% gfc -m64
/opt/gcc/_gcc-clean/gcc/testsuite/gfortran.dg/derived_comp_array_ref_5.f90
[karma] f90/bug% a.out 
[karma] f90/bug% 

i.e., the test case of this PR compiles for both 32 and 64 bit modes for gcc
version 4.3.0 20071002, while derived_comp_array_ref_5.f90 compiles only in 64
bit mode (wrong cast somewhere?-)


-- 


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


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

* [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
  2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
  2007-10-03 12:27 ` [Bug fortran/33636] " fxcoudert at gcc dot gnu dot org
  2007-10-03 13:04 ` dominiq at lps dot ens dot fr
@ 2007-10-06 17:17 ` pault at gcc dot gnu dot org
  2007-10-10 11:23 ` fxcoudert at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-10-06 17:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2007-10-06 17:17 -------
(In reply to comment #1)

Needless to say, it was developed on a 64bit machine.

Thanks, Dominique

Paul


-- 


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


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

* [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
  2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-10-06 17:17 ` pault at gcc dot gnu dot org
@ 2007-10-10 11:23 ` fxcoudert at gcc dot gnu dot org
  2007-10-10 11:57 ` fxcoudert at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-10 11:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from fxcoudert at gcc dot gnu dot org  2007-10-10 11:23 -------
The problem is that we try simplification in find_array_section() because the
vector subscript is EXPR_ARRAY, which is not necessarily constant (in this
case, the values in the constructor depend on variable i). So, the check for
constantness needs to call gfc_is_constant_expr(), as in the patch below.

(This was hidden on 64-bit machines because there, expressions "i", "i+1" and
"i-1" have to be converted to integer(8), which means the vector subscript
isn't an EXPR_ARRAY but and EXPR_FUNCTION. Thus, we bailed out of the
simplification business.)



Index: expr.c
===================================================================
--- expr.c      (revision 129054)
+++ expr.c      (working copy)
@@ -1165,7 +1165,7 @@ find_array_section (gfc_expr *expr, gfc_
        {
          gcc_assert (begin);

-         if (begin->expr_type != EXPR_ARRAY)
+         if (begin->expr_type != EXPR_ARRAY || !gfc_is_constant_expr (begin))
            {
              t = FAILURE;
              goto cleanup;


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |fxcoudert at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-10-03 12:27:28         |2007-10-10 11:23:10
               date|                            |


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


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

* [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
  2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-10-10 11:23 ` fxcoudert at gcc dot gnu dot org
@ 2007-10-10 11:57 ` fxcoudert at gcc dot gnu dot org
  2007-10-10 13:39 ` fxcoudert at gcc dot gnu dot org
  2007-10-10 13:41 ` fxcoudert at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-10 11:57 UTC (permalink / raw)
  To: gcc-bugs



-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |10/msg00548.html
           Keywords|                            |patch
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
  2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-10-10 11:57 ` fxcoudert at gcc dot gnu dot org
@ 2007-10-10 13:39 ` fxcoudert at gcc dot gnu dot org
  2007-10-10 13:41 ` fxcoudert at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-10 13:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from fxcoudert at gcc dot gnu dot org  2007-10-10 13:38 -------
Subject: Bug 33636

Author: fxcoudert
Date: Wed Oct 10 13:38:38 2007
New Revision: 129208

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129208
Log:
        PR fortran/33636
        * expr.c (find_array_section): Check for constructor constantness.

Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c


-- 


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


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

* [Bug fortran/33636] Rejects valid use of vector subscript in derived type parameter
  2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-10-10 13:39 ` fxcoudert at gcc dot gnu dot org
@ 2007-10-10 13:41 ` fxcoudert at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu dot org @ 2007-10-10 13:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-10-10 13:41 -------
Fixed.


-- 

fxcoudert at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-10-10 13:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-03 12:27 [Bug fortran/33636] New: Rejects valid use of vector subscript in derived type parameter fxcoudert at gcc dot gnu dot org
2007-10-03 12:27 ` [Bug fortran/33636] " fxcoudert at gcc dot gnu dot org
2007-10-03 13:04 ` dominiq at lps dot ens dot fr
2007-10-06 17:17 ` pault at gcc dot gnu dot org
2007-10-10 11:23 ` fxcoudert at gcc dot gnu dot org
2007-10-10 11:57 ` fxcoudert at gcc dot gnu dot org
2007-10-10 13:39 ` fxcoudert at gcc dot gnu dot org
2007-10-10 13:41 ` 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).