public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/31011]  New: Incorrect error: parameter array sections
@ 2007-03-01 16:50 terry at chem dot gu dot se
  2007-03-01 18:02 ` [Bug fortran/31011] " burnus at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: terry at chem dot gu dot se @ 2007-03-01 16:50 UTC (permalink / raw)
  To: gcc-bugs

On a 64-bit Ubuntu 6.10 system with gcc-4.2-20070228, gfortran erroneously
gives an error for good F90 code.  In the code two parameter arrays are defined
then one is multiplied by a section of the other, with the section selected
with non-unit stride.  An error is generated referencing the declaration of the
sectioned array.  It looks like the array section is not being generated
properly, but simply writing the array section to stdout produces the expected
output.

The error is not produced if either of the arrays are not parameters, or the
array section is unit stride.  gfortran from Ubuntu's gcc-4.1.2 gives the same
error.


[tjf@fkpc167 VielPotential]$ cat bugtest.f90 
program PotentialMatrix
implicit none
real(kind=8),dimension(2),parameter::v2=(/1,2/)
real(kind=8),dimension(4),parameter::v4=(/1,2,3,4/)
write(*,*)v2*v4(1:3:2)
end

[tjf@fkpc167 VielPotential]$ gfortran -v -g -o bugtest bugtest.f90
Driving: gfortran -v -g -o bugtest bugtest.f90 -lgfortranbegin -lgfortran -lm
-shared-libgcc
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --disable-multilib --enable-languages=fortran
Thread model: posix
gcc version 4.2.0 20070228 (prerelease)
 /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.2.0/f951 bugtest.f90 -quiet
-dumpbase bugtest.f90 -mtune=generic -auxbase bugtest -g -version -I
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.2.0/finclude -o /tmp/cc5EhKbq.s
GNU F95 version 4.2.0 20070228 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.2.0 20070228 (prerelease).
GGC heuristics: --param ggc-min-expand=89 --param ggc-min-heapsize=112046
bugtest.f90:3.40:

real(kind=8),dimension(2),parameter::v2=(/1,2/)
                                       1
Error: different shape for Elemental binary operation at (1) on dimension 1
(2/1)
bugtest.f90:3.40:

real(kind=8),dimension(2),parameter::v2=(/1,2/)
                                       1
Error: Array operands are incommensurate at (1)
[tjf@fkpc167 VielPotential]$


-- 
           Summary: Incorrect error: parameter array sections
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: terry at chem dot gu dot se
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug fortran/31011] Incorrect error: parameter array sections
  2007-03-01 16:50 [Bug fortran/31011] New: Incorrect error: parameter array sections terry at chem dot gu dot se
@ 2007-03-01 18:02 ` burnus at gcc dot gnu dot org
  2007-03-07  9:41 ` 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 @ 2007-03-01 18:02 UTC (permalink / raw)
  To: gcc-bugs



-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-01 18:02:09
               date|                            |


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


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

* [Bug fortran/31011] Incorrect error: parameter array sections
  2007-03-01 16:50 [Bug fortran/31011] New: Incorrect error: parameter array sections terry at chem dot gu dot se
  2007-03-01 18:02 ` [Bug fortran/31011] " burnus at gcc dot gnu dot org
@ 2007-03-07  9:41 ` pault at gcc dot gnu dot org
  2007-03-08  6:25 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-07  9:41 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]



------- Comment #1 from pault at gcc dot gnu dot org  2007-03-07 09:41 -------
confirmed - this is an arithmetic error in expr.c(find_array_section).

The following fixes the problem, although it has not yet been regtested.

Paul

Index: gcc/fortran/expr.c
===================================================================
*** gcc/fortran/expr.c  (révision 122159)
--- gcc/fortran/expr.c  (copie de travail)
*************** find_array_section (gfc_expr *expr, gfc_
*** 1137,1144 ****
            }

          /* Calculate the number of elements and the shape.  */
!         mpz_abs (tmp_mpz, stride[d]);
!         mpz_div (tmp_mpz, stride[d], tmp_mpz);
          mpz_add (tmp_mpz, end[d], tmp_mpz);
          mpz_sub (tmp_mpz, tmp_mpz, ctr[d]);
          mpz_div (tmp_mpz, tmp_mpz, stride[d]);
--- 1137,1143 ----
            }

          /* Calculate the number of elements and the shape.  */
!         mpz_set (tmp_mpz, stride[d]);
          mpz_add (tmp_mpz, end[d], tmp_mpz);
          mpz_sub (tmp_mpz, tmp_mpz, ctr[d]);
          mpz_div (tmp_mpz, tmp_mpz, stride[d]);


-- 

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|2007-03-01 18:02:09         |2007-03-07 09:41:39
               date|                            |


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


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

* [Bug fortran/31011] Incorrect error: parameter array sections
  2007-03-01 16:50 [Bug fortran/31011] New: Incorrect error: parameter array sections terry at chem dot gu dot se
  2007-03-01 18:02 ` [Bug fortran/31011] " burnus at gcc dot gnu dot org
  2007-03-07  9:41 ` pault at gcc dot gnu dot org
@ 2007-03-08  6:25 ` patchapp at dberlin dot org
  2007-03-08  9:10 ` pault at gcc dot gnu dot org
  2007-03-27  9:02 ` [Bug fortran/31011] [4.2 and 4.1 only] " pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: patchapp at dberlin dot org @ 2007-03-08  6:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from patchapp at dberlin dot org  2007-03-08 06:25 -------
Subject: Bug number PR31011

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00459.html


-- 


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


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

* [Bug fortran/31011] Incorrect error: parameter array sections
  2007-03-01 16:50 [Bug fortran/31011] New: Incorrect error: parameter array sections terry at chem dot gu dot se
                   ` (2 preceding siblings ...)
  2007-03-08  6:25 ` patchapp at dberlin dot org
@ 2007-03-08  9:10 ` pault at gcc dot gnu dot org
  2007-03-27  9:02 ` [Bug fortran/31011] [4.2 and 4.1 only] " pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-08  9:10 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pault at gcc dot gnu dot org  2007-03-08 09:09 -------
Subject: Bug 31011

Author: pault
Date: Thu Mar  8 09:09:38 2007
New Revision: 122689

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122689
Log:
2007-03-08 Paul Thomas <pault@gcc.gnu.org>

        PR fortran/31011
        * expr.c (find_array_section): Correct arithmetic for section
        size.

2007-03-08 Paul Thomas <pault@gcc.gnu.org>

        PR fortran/31011
        * gfortran.dg/parameter_array_section_2.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/parameter_array_section_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/31011] [4.2 and 4.1 only] Incorrect error: parameter array sections
  2007-03-01 16:50 [Bug fortran/31011] New: Incorrect error: parameter array sections terry at chem dot gu dot se
                   ` (3 preceding siblings ...)
  2007-03-08  9:10 ` pault at gcc dot gnu dot org
@ 2007-03-27  9:02 ` pault at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pault at gcc dot gnu dot org @ 2007-03-27  9:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2007-03-27 10:02 -------
This is not a regression wrt 4.1 so closing.

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=31011


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

end of thread, other threads:[~2007-03-27  9:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-01 16:50 [Bug fortran/31011] New: Incorrect error: parameter array sections terry at chem dot gu dot se
2007-03-01 18:02 ` [Bug fortran/31011] " burnus at gcc dot gnu dot org
2007-03-07  9:41 ` pault at gcc dot gnu dot org
2007-03-08  6:25 ` patchapp at dberlin dot org
2007-03-08  9:10 ` pault at gcc dot gnu dot org
2007-03-27  9:02 ` [Bug fortran/31011] [4.2 and 4.1 only] " 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).