public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable
@ 2012-01-30 21:24 jakub at gcc dot gnu.org
  2012-01-30 21:31 ` [Bug fortran/52059] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-30 21:24 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52059
           Summary: [4.7 Regression] ICE in gfc_conv_variable
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org
                CC: mikael@gcc.gnu.org


subroutine baz
  real(kind=8) :: a(99), b
  interface bar
    function bar (x, y)
      integer, intent(in) :: x, y
      real(kind=8), dimension((y-x)) :: bar
    end function bar
  end interface
  b = 1.0_8
  a = foo (bar(0,35) / dble(34), b)
contains
  elemental real(kind=8) function foo(x, y)
    real(kind=8), intent(in) :: x, y
    foo = 1
  end function foo
end subroutine baz

ICEs starting with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=180906
(and, when b in the call is replaced with say 1.0_8, ICEs in gfc_conv_constant
and when the y argument from y is removed and the caller is adjusted too, ICEs
in gfc_trans_assignment.


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
@ 2012-01-30 21:31 ` jakub at gcc dot gnu.org
  2012-01-30 23:29 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-30 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
      Known to work|                            |4.6.3
   Target Milestone|---                         |4.7.0
      Known to fail|                            |4.7.0


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
  2012-01-30 21:31 ` [Bug fortran/52059] " jakub at gcc dot gnu.org
@ 2012-01-30 23:29 ` burnus at gcc dot gnu.org
  2012-01-31  1:08 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-30 23:29 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-30
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-30 23:03:28 UTC ---
In gfc_conv_variable, it fails at the assert:
1183          gcc_assert (ss_info->expr == expr);

Here, "expr" is the variable "b" while "ss_info->expr" is a BT_REAL constant.

If one replaces "b" by "1.0_8", one has the same issue (except that than both
values are constants.)

And without "y" argument, it fails for:
6919                      && rse.ss == gfc_ss_terminator);
One has rse.ss->info->type = GFC_SS_SCALAR and rse.ss->info->expr->expr_type ==
EXPR_CONSTANT.


It works if one undoes the change to trans-expr.c, i.e.

http://gcc.gnu.org/viewcvs/trunk/gcc/fortran/trans-expr.c?r1=180906&r2=180905&pathrev=180906


 * * *

Side note:
  real(kind=8) :: a(99)
  real(kind=8), dimension((y-x)) :: bar
  a = foo (bar(0,35), ...

The a(99) should be a(35) as "foo(bar()..." returns a array of dimension(35-0).


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
  2012-01-30 21:31 ` [Bug fortran/52059] " jakub at gcc dot gnu.org
  2012-01-30 23:29 ` burnus at gcc dot gnu.org
@ 2012-01-31  1:08 ` jakub at gcc dot gnu.org
  2012-01-31  5:57 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2012-01-31  1:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-30 23:33:11 UTC ---
Then plplot (see https://bugzilla.redhat.com/show_bug.cgi?id=785433 ) is buggy.
Anyway, it ICEs even with the same bounds.


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-01-31  1:08 ` jakub at gcc dot gnu.org
@ 2012-01-31  5:57 ` pinskia at gcc dot gnu.org
  2012-01-31 12:31 ` burnus at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-01-31  5:57 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aravindvijayan224185 at
                   |                            |gmail dot com

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-31 03:42:22 UTC ---
*** Bug 52063 has been marked as a duplicate of this bug. ***


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-01-31  5:57 ` pinskia at gcc dot gnu.org
@ 2012-01-31 12:31 ` burnus at gcc dot gnu.org
  2012-02-01  8:35 ` burnus at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-31 12:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-31 11:35:15 UTC ---
(In reply to comment #1)
> It works if one undoes the change to trans-expr.c, i.e. [...]

Completely untested patch (neither compiled nor tested in gdb):

Index: trans-expr.c
===================================================================
--- trans-expr.c        (revision 183722)
+++ trans-expr.c        (working copy)
@@ -3528,3 +3528,3 @@ gfc_conv_procedure_call (gfc_se * se, gf

-         if (se->ss->dimen > 0
+         if (se->ss->dimen > 0 && e->rank > 0
              && se->ss->info->data.array.ref == NULL)

 * * *

> Side note:
>   real(kind=8) :: a(99)
>   a = foo (bar(0,35), ...
> The a(99) should be a(35) as "foo(bar()..." returns an array
> of dimension(35-0).

(In reply to comment #2)
> Then plplot is buggy.

Indeed, though with gfortran, the excess elements are simply not touched and
keep their original value, which usually is fine. (For compilers which
scalarize the LHS [such as ifort] instead of the RHS, one reads too many bytes
on the RHS, which is problematic but often also works, unless the LHS is much
larger than the RHS -> invalid memory access/segfault.)

The proper assignment should use
  a(:35) = foo (bar(0,35), ...
or some variant of it. (One also can make make "a" allocatable; for "a = ", the
the LHS is then (re)allocated to match the shape of the RHS [Fortran 2003/GCC
4.6 feature].)


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-01-31 12:31 ` burnus at gcc dot gnu.org
@ 2012-02-01  8:35 ` burnus at gcc dot gnu.org
  2012-02-01 19:02 ` burnus at gcc dot gnu.org
  2012-02-01 19:13 ` burnus at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-02-01  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-02-01 08:34:32 UTC ---
Submitted patch:
  http://gcc.gnu.org/ml/fortran/2012-01/msg00276.html


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-02-01  8:35 ` burnus at gcc dot gnu.org
@ 2012-02-01 19:02 ` burnus at gcc dot gnu.org
  2012-02-01 19:13 ` burnus at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-02-01 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-02-01 19:01:54 UTC ---
Author: burnus
Date: Wed Feb  1 19:01:49 2012
New Revision: 183807

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183807
Log:
2012-02-01  Tobias Burnus

        PR fortran/52059
        * trans-expr.c (gfc_conv_procedure_call): Add array ref
        only to variables.

2012-02-01  Tobias Burnus

        PR fortran/52059
        * gfortran.dg/elemental_function_1.f90: New.


Added:
    trunk/gcc/testsuite/gfortran.dg/elemental_function_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug fortran/52059] [4.7 Regression] ICE in gfc_conv_variable
  2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-02-01 19:02 ` burnus at gcc dot gnu.org
@ 2012-02-01 19:13 ` burnus at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-02-01 19:13 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

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

--- Comment #7 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-02-01 19:12:27 UTC ---
FIXED on the trunk (4.7).


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

end of thread, other threads:[~2012-02-01 19:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-30 21:24 [Bug fortran/52059] New: [4.7 Regression] ICE in gfc_conv_variable jakub at gcc dot gnu.org
2012-01-30 21:31 ` [Bug fortran/52059] " jakub at gcc dot gnu.org
2012-01-30 23:29 ` burnus at gcc dot gnu.org
2012-01-31  1:08 ` jakub at gcc dot gnu.org
2012-01-31  5:57 ` pinskia at gcc dot gnu.org
2012-01-31 12:31 ` burnus at gcc dot gnu.org
2012-02-01  8:35 ` burnus at gcc dot gnu.org
2012-02-01 19:02 ` burnus at gcc dot gnu.org
2012-02-01 19:13 ` burnus 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).