public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result
@ 2014-08-12  9:34 m.a.hulsen at tue dot nl
  2014-08-12  9:45 ` [Bug fortran/62106] " m.a.hulsen at tue dot nl
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: m.a.hulsen at tue dot nl @ 2014-08-12  9:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62106
           Summary: Adding a scalar variable to an array constructor gives
                    wrong result
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: m.a.hulsen at tue dot nl

The following code

program t
  integer :: ndim=2, ndfp=4, i
  print *, (/ ( i, i = 1, ndfp ) /) + ndim
end program t

gives 
           1           2           3           4
whereas it should be
           3           4           5           6

Note, that both ndfp and ndim need to be variables not constants, in order to
generate the wrong result.


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

* [Bug fortran/62106] Adding a scalar variable to an array constructor gives wrong result
  2014-08-12  9:34 [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result m.a.hulsen at tue dot nl
@ 2014-08-12  9:45 ` m.a.hulsen at tue dot nl
  2014-08-12 12:52 ` [Bug fortran/62106] [4.9/4.10 Regression] " dominiq at lps dot ens.fr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: m.a.hulsen at tue dot nl @ 2014-08-12  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martien Hulsen <m.a.hulsen at tue dot nl> ---
It only shows up using optimisation, i.e. -On, with n>=1.


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

* [Bug fortran/62106] [4.9/4.10 Regression] Adding a scalar variable to an array constructor gives wrong result
  2014-08-12  9:34 [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result m.a.hulsen at tue dot nl
  2014-08-12  9:45 ` [Bug fortran/62106] " m.a.hulsen at tue dot nl
@ 2014-08-12 12:52 ` dominiq at lps dot ens.fr
  2014-08-13 19:01 ` [Bug fortran/62106] [4.9/5 " tkoenig at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-08-12 12:52 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-08-12
                 CC|                            |tkoenig at gcc dot gnu.org
            Summary|Adding a scalar variable to |[4.9/4.10 Regression]
                   |an array constructor gives  |Adding a scalar variable to
                   |wrong result                |an array constructor gives
                   |                            |wrong result
     Ever confirmed|0                           |1
      Known to fail|                            |4.10.0, 4.9.1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This is regression from 4.8.3, revision r197010 (2013-03-23) is OK, r197238
(2013-03-29) is not, likely r197216.

Workaround: compile with -fno-frontend-optimize.


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

* [Bug fortran/62106] [4.9/5 Regression] Adding a scalar variable to an array constructor gives wrong result
  2014-08-12  9:34 [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result m.a.hulsen at tue dot nl
  2014-08-12  9:45 ` [Bug fortran/62106] " m.a.hulsen at tue dot nl
  2014-08-12 12:52 ` [Bug fortran/62106] [4.9/4.10 Regression] " dominiq at lps dot ens.fr
@ 2014-08-13 19:01 ` tkoenig at gcc dot gnu.org
  2014-08-14 18:52 ` tkoenig at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2014-08-13 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |tkoenig at gcc dot gnu.org
      Known to fail|4.10.0                      |5.0

--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
I have a patch.


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

* [Bug fortran/62106] [4.9/5 Regression] Adding a scalar variable to an array constructor gives wrong result
  2014-08-12  9:34 [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result m.a.hulsen at tue dot nl
                   ` (2 preceding siblings ...)
  2014-08-13 19:01 ` [Bug fortran/62106] [4.9/5 " tkoenig at gcc dot gnu.org
@ 2014-08-14 18:52 ` tkoenig at gcc dot gnu.org
  2014-08-15 20:48 ` tkoenig at gcc dot gnu.org
  2014-08-15 20:48 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2014-08-14 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Thu Aug 14 18:52:12 2014
New Revision: 213980

URL: https://gcc.gnu.org/viewcvs?rev=213980&root=gcc&view=rev
Log:
2014-08-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/62106
    * gfortran.h (symbol_attribute):  Add fe_temp flag.
    * frontend-passes.c (is_fe_temp):  New function.
    (create_var):  Don't add a temporary for an already
    created variable or for a constant.
    (combine_ARRAY_constructor):  Remove special handling
    for constants.

2014-08-14  Thomas Koenig  <tkoenig@gcc.gnu.org>

    PR fortran/62106
    * gfortran.dg/array_constructor_49.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/array_constructor_49.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/frontend-passes.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/62106] [4.9/5 Regression] Adding a scalar variable to an array constructor gives wrong result
  2014-08-12  9:34 [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result m.a.hulsen at tue dot nl
                   ` (4 preceding siblings ...)
  2014-08-15 20:48 ` tkoenig at gcc dot gnu.org
@ 2014-08-15 20:48 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2014-08-15 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

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

--- Comment #6 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Fixed on all affected branches, closing.


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

* [Bug fortran/62106] [4.9/5 Regression] Adding a scalar variable to an array constructor gives wrong result
  2014-08-12  9:34 [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result m.a.hulsen at tue dot nl
                   ` (3 preceding siblings ...)
  2014-08-14 18:52 ` tkoenig at gcc dot gnu.org
@ 2014-08-15 20:48 ` tkoenig at gcc dot gnu.org
  2014-08-15 20:48 ` tkoenig at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2014-08-15 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Author: tkoenig
Date: Fri Aug 15 20:47:30 2014
New Revision: 214038

URL: https://gcc.gnu.org/viewcvs?rev=214038&root=gcc&view=rev
Log:
2014-08-15  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk
    PR fortran/62106
    * gfortran.h (symbol_attribute):  Add fe_temp flag.
    * frontend-passes.c (is_fe_temp):  New function.
    (create_var):  Don't add a temporary for an already
    created variable or for a constant.
    (combine_ARRAY_constructor):  Remove special handling
    for constants.

2014-08-15  Thomas Koenig  <tkoenig@gcc.gnu.org>

    Backport from trunk
    PR fortran/62106
    * gfortran.dg/array_constructor_49.f90:  New test.


Added:
    branches/gcc-4_9-branch/gcc/testsuite/gfortran.dg/array_constructor_49.f90
Modified:
    branches/gcc-4_9-branch/gcc/fortran/ChangeLog
    branches/gcc-4_9-branch/gcc/fortran/frontend-passes.c
    branches/gcc-4_9-branch/gcc/fortran/gfortran.h
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2014-08-15 20:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-12  9:34 [Bug fortran/62106] New: Adding a scalar variable to an array constructor gives wrong result m.a.hulsen at tue dot nl
2014-08-12  9:45 ` [Bug fortran/62106] " m.a.hulsen at tue dot nl
2014-08-12 12:52 ` [Bug fortran/62106] [4.9/4.10 Regression] " dominiq at lps dot ens.fr
2014-08-13 19:01 ` [Bug fortran/62106] [4.9/5 " tkoenig at gcc dot gnu.org
2014-08-14 18:52 ` tkoenig at gcc dot gnu.org
2014-08-15 20:48 ` tkoenig at gcc dot gnu.org
2014-08-15 20:48 ` tkoenig at gcc dot gnu.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).