public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/51758] New: ICE with optional arguments of elemental procedures
@ 2012-01-05  0:46 mikael at gcc dot gnu.org
  2012-01-05  0:57 ` [Bug fortran/51758] " mikael at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-01-05  0:46 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51758
           Summary: ICE with optional arguments of elemental procedures
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mikael@gcc.gnu.org


Follow-up to PR50981.

gfortran chokes with the testcase below.

with 4.7:
   internal compiler error: in gfc_trans_assignment_1, at
fortran/trans-expr.c:6794

The code is accepted without the elemental cases, and the null() seems to be
handled correctly.


with 4.5:
  a = foo((/ 1, 1 /), null())
                      1
Error: Rank mismatch in argument 'b' at (1) (1 and 0)

The code is accepted without the non-elemental case, but the null() is
mishandled.




program p

  integer :: a(2)
  integer :: b

  a = 0
  a = foo((/ 1, 1 /), null())
  print *, a
  !if (any(a /= 2)) call abort

  a = 0
  a = bar((/ 1, 1 /), null())
  print *, a
  !if (any(a /= 2)) call abort

! b = 0
! b = bar(1, null())
! print *, a
  !if (b /= 2) call abort

contains

  function foo(a, b)
    integer           :: a(:)
    integer, optional :: b(:)
    integer           :: foo(size(a))

    if (present(b)) call abort

    foo = 2
  end function foo

  elemental function bar(a, b)
    integer, intent(in)           :: a
    integer, intent(in), optional :: b
    integer                       :: bar

    bar = 2

    if (present(b)) bar = 1

  end function bar

end program p


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
@ 2012-01-05  0:57 ` mikael at gcc dot gnu.org
  2012-01-05  8:04 ` burnus at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-01-05  0:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> 2012-01-05 00:56:59 UTC ---
Related bugs (null as actual argument):
PR12841 (fixed long ago), PR44666 (fixed on 4.6)


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
  2012-01-05  0:57 ` [Bug fortran/51758] " mikael at gcc dot gnu.org
@ 2012-01-05  8:04 ` burnus at gcc dot gnu.org
  2012-01-06 11:29 ` burnus at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-05  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-05
                 CC|                            |burnus at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-05 08:03:28 UTC ---
Compiles and runs with ifort 12.1.1; compiles but fails at run time with ifort
12.0.5.

Nit: The commented
  ! print *, a
should be 
  ! print *, b


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
  2012-01-05  0:57 ` [Bug fortran/51758] " mikael at gcc dot gnu.org
  2012-01-05  8:04 ` burnus at gcc dot gnu.org
@ 2012-01-06 11:29 ` burnus at gcc dot gnu.org
  2012-01-06 15:56 ` burnus at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-06 11:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-06 11:29:32 UTC ---
The assert
  rse.ss == gfc_ss_terminator
is not fulfilled in gfc_trans_assignment_1.

If one manually sets "rse.see = gfc_ss_terminator" in the debugger, the
original dump looks fine.

Thus, it looks like some issue with the scalarizer handling.


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-01-06 11:29 ` burnus at gcc dot gnu.org
@ 2012-01-06 15:56 ` burnus at gcc dot gnu.org
  2012-01-09 13:44 ` mikael at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-01-06 15:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-06 15:55:36 UTC ---
Draft patch.

--- trans-expr.c        (revision 182957)
+++ trans-expr.c        (working copy)
@@ -3408,6 +3408,9 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol *
          parmse.expr = null_pointer_node;
          if (arg->missing_arg_type == BT_CHARACTER)
            parmse.string_length = build_int_cst (gfc_charlen_type_node, 0);
+         if (se->ss && (se->ss->info->type == GFC_SS_SCALAR
+                        || se->ss->info->type == GFC_SS_REFERENCE))
+           gfc_advance_se_ss_chain (se);
        }
       else if (fsym && fsym->ts.type == BT_CLASS
                 && e->ts.type == BT_DERIVED)


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-01-06 15:56 ` burnus at gcc dot gnu.org
@ 2012-01-09 13:44 ` mikael at gcc dot gnu.org
  2012-01-09 13:49 ` dominiq at lps dot ens.fr
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-01-09 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |mikael at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #5 from Mikael Morin <mikael at gcc dot gnu.org> 2012-01-09 13:43:35 UTC ---
I'm taking care.


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-01-09 13:44 ` mikael at gcc dot gnu.org
@ 2012-01-09 13:49 ` dominiq at lps dot ens.fr
  2012-01-09 19:02 ` mikael at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dominiq at lps dot ens.fr @ 2012-01-09 13:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> 2012-01-09 13:48:14 UTC ---
See patch at http://gcc.gnu.org/ml/fortran/2012-01/msg00066.html .


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-01-09 13:49 ` dominiq at lps dot ens.fr
@ 2012-01-09 19:02 ` mikael at gcc dot gnu.org
  2012-07-14 15:24 ` mikael at gcc dot gnu.org
  2012-07-14 16:02 ` mikael at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-01-09 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Mikael Morin <mikael at gcc dot gnu.org> 2012-01-09 19:01:44 UTC ---
Author: mikael
Date: Mon Jan  9 19:01:34 2012
New Revision: 183024

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=183024
Log:
2012-01-09  Mikael Morin  <mikael@gcc.gnu.org>

    PR fortran/51758
    * trans-array.c (gfc_walk_elemental_function_args):
    Skip over NULL() actual arguments.

2012-01-09  Tobias Burnus  <burnus@net-b.de>

    PR fortran/51758
    * gfortran.dg/optional_absent_2.f90: New.


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


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2012-01-09 19:02 ` mikael at gcc dot gnu.org
@ 2012-07-14 15:24 ` mikael at gcc dot gnu.org
  2012-07-14 16:02 ` mikael at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-07-14 15:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Mikael Morin <mikael at gcc dot gnu.org> 2012-07-14 15:24:17 UTC ---
Author: mikael
Date: Sat Jul 14 15:24:12 2012
New Revision: 189480

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=189480
Log:
2012-07-14  Mikael Morin  <mikael@gcc.gnu.org>

    Backport from trunk:
    2012-01-09  Mikael Morin  <mikael@gcc.gnu.org>

    PR fortran/51758
    * trans-array.c (gfc_walk_elemental_function_args):
    Skip over NULL() actual arguments.

2012-07-14  Mikael Morin  <mikael.morin@gcc.gnu.org>

    Backport from trunk:
    2012-01-09  Tobias Burnus  <burnus@net-b.de>

    PR fortran/51758
    * gfortran.dg/optional_absent_2.f90: New.



Added:
    branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/optional_absent_2.f90
Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/trans-array.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug fortran/51758] ICE with optional arguments of elemental procedures
  2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2012-07-14 15:24 ` mikael at gcc dot gnu.org
@ 2012-07-14 16:02 ` mikael at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: mikael at gcc dot gnu.org @ 2012-07-14 16:02 UTC (permalink / raw)
  To: gcc-bugs

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

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
            Version|4.7.0                       |4.6.4
         Resolution|                            |FIXED

--- Comment #9 from Mikael Morin <mikael at gcc dot gnu.org> 2012-07-14 16:01:43 UTC ---
Fixed for 4.7.0 and 4.6.4.


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

end of thread, other threads:[~2012-07-14 16:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-05  0:46 [Bug fortran/51758] New: ICE with optional arguments of elemental procedures mikael at gcc dot gnu.org
2012-01-05  0:57 ` [Bug fortran/51758] " mikael at gcc dot gnu.org
2012-01-05  8:04 ` burnus at gcc dot gnu.org
2012-01-06 11:29 ` burnus at gcc dot gnu.org
2012-01-06 15:56 ` burnus at gcc dot gnu.org
2012-01-09 13:44 ` mikael at gcc dot gnu.org
2012-01-09 13:49 ` dominiq at lps dot ens.fr
2012-01-09 19:02 ` mikael at gcc dot gnu.org
2012-07-14 15:24 ` mikael at gcc dot gnu.org
2012-07-14 16:02 ` mikael 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).