public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/19015] New: shape / rank mismatch in maxloc / minloc leads to assertion failure at runtime
@ 2004-12-15 17:14 Thomas dot Koenig at online dot de
  2004-12-15 17:50 ` [Bug fortran/19015] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Thomas dot Koenig at online dot de @ 2004-12-15 17:14 UTC (permalink / raw)
  To: gcc-bugs

$ cat maxloc-2.f90
  integer, dimension(0:1,0:1) :: n
  integer, dimension(1) :: i
  n = reshape((/1, 2, 3, 4/), shape(n))
  i = maxloc(n)
  print *,i
end program
$ gfortran maxloc-2.f90
$ ./a.out
a.out: ../../../gcc-4.0-20041212/libgfortran/generated/maxloc0_4_i4.c:49:
__maxloc0_4_i4: Assertion `retarray->dim[0].ubound + 1 - retarray->dim[0].lbound
== rank' failed.
Aborted
$ gfortran -v
Reading specs from /home/zfkts/lib/gcc/ia64-unknown-linux-gnu/4.0.0/specs
Configured with: ../gcc-4.0-20041212/configure --prefix=/home/zfkts
--enable-languages=c,c++,f95 : (reconfigured) ../gcc-4.0-20041212/configure
--prefix=/home/zfkts --enable-languages=c,c++,f95 --disable-shared
Thread model: posix
gcc version 4.0.0 20041212 (experimental)

This is actually not too bad, but could be caught at compile-time.

Same for minloc.

-- 
           Summary: shape / rank mismatch in maxloc / minloc leads to
                    assertion failure at runtime
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas dot Koenig at online dot de
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc leads to assertion failure at runtime
  2004-12-15 17:14 [Bug fortran/19015] New: shape / rank mismatch in maxloc / minloc leads to assertion failure at runtime Thomas dot Koenig at online dot de
@ 2004-12-15 17:50 ` pinskia at gcc dot gnu dot org
  2005-04-28  8:10 ` tkoenig at gcc dot gnu dot org
  2005-06-06 20:22 ` [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-15 17:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-15 17:50 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-12-15 17:50:05
               date|                            |
            Version|unknown                     |4.0.0


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc leads to assertion failure at runtime
  2004-12-15 17:14 [Bug fortran/19015] New: shape / rank mismatch in maxloc / minloc leads to assertion failure at runtime Thomas dot Koenig at online dot de
  2004-12-15 17:50 ` [Bug fortran/19015] " pinskia at gcc dot gnu dot org
@ 2005-04-28  8:10 ` tkoenig at gcc dot gnu dot org
  2005-06-06 20:22 ` [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-04-28  8:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-04-28 08:07 -------
In 4.1, this is now a runtime error:

$ cat maxloc-2.f90
  integer, dimension(0:1,0:1) :: n
  integer, dimension(1) :: i
  n = reshape((/1, 2, 3, 4/), shape(n))
  i = maxloc(n)
  print *,i
end program
$ gfortran maxloc-2.f90
$ ./a.out
Fortran runtime error: dimension of return array incorrect


-- 


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time
  2004-12-15 17:14 [Bug fortran/19015] New: shape / rank mismatch in maxloc / minloc leads to assertion failure at runtime Thomas dot Koenig at online dot de
  2004-12-15 17:50 ` [Bug fortran/19015] " pinskia at gcc dot gnu dot org
  2005-04-28  8:10 ` tkoenig at gcc dot gnu dot org
@ 2005-06-06 20:22 ` tkoenig at gcc dot gnu dot org
  2 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2005-06-06 20:22 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From tkoenig at gcc dot gnu dot org  2005-06-06 20:22 -------
This is also a runtime error in 4.0 now.

I am changing the subject to reflect my preference that this
should be caught at compile time.

Thomas

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|shape / rank mismatch in    |shape / rank mismatch in
                   |maxloc / minloc leads to    |maxloc / minloc could be
                   |assertion failure at runtime|caught at compile time


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time
       [not found] <bug-19015-9515@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2006-05-21  7:35 ` pault at gcc dot gnu dot org
@ 2006-05-28 19:55 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-28 19:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pault at gcc dot gnu dot org  2006-05-28 19:55 -------
Fixed in trunk and 4.1

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
            Summary|shape / rank mismatch in    |shape / rank mismatch in
                   |maxloc / minloc could be    |maxloc / minloc could be
                   |caught at compile time      |caught at compile time
                   |(fixed in trunk)            |


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time
       [not found] <bug-19015-9515@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2006-05-15 20:35 ` patchapp at dberlin dot org
@ 2006-05-21  7:35 ` pault at gcc dot gnu dot org
  2006-05-28 19:55 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-21  7:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pault at gcc dot gnu dot org  2006-05-21 07:35 -------
Subject: Bug 19015

Author: pault
Date: Sun May 21 07:35:05 2006
New Revision: 113949

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113949
Log:
2006-05-21  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/25746
        * interface.c (gfc_extend_assign): Use new code EXEC_ASSIGN_CALL.
        * gfortran.h : Put EXEC_ASSIGN_CALL in enum.
        * trans-stmt.c (gfc_conv_elemental_dependencies): New function.
        (gfc_trans_call): Call it.  Add new boolian argument to flag
        need for dependency checking. Assert intent OUT and IN for arg1
        and arg2.
        (gfc_trans_forall_1): Use new code EXEC_ASSIGN_CALL.
        trans-stmt.h : Modify prototype of gfc_trans_call.
        trans.c (gfc_trans_code): Add call for EXEC_ASSIGN_CALL.
        st.c (gfc_free_statement): Free actual for EXEC_ASSIGN_CALL.
        * dependency.c (gfc_check_fncall_dependency): Don't check other
        against itself.

        PR fortran/25090
        * resolve.c : Remove resolving_index_expr.
        (entry_parameter): Remove.
        (gfc_resolve_expr, resolve_charlen, resolve_fl_variable): Remove
        calls to entry_parameter and references to resolving_index_expr.

        PR fortran/27584
        * check.c (gfc_check_associated): Replace NULL assert with an
        error message, since it is possible to generate bad code that
        has us fall through to here..

        PR fortran/19015
        * iresolve.c (maxloc, minloc): If DIM is not present, pass the
        rank of ARRAY as the shape of the result.  Otherwise, pass the
        shape of ARRAY, less the dimension DIM.
        (maxval, minval): The same, when DIM is present, otherwise no
        change.

2006-05-21  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/25746
        * gfortran.dg/elemental_subroutine_3.f90: New test.

        PR fortran/25090
        * gfortran.dg/entry_dummy_ref_1.f90: Remove.

        PR fortran/27584
        * gfortran.dg/associated_target_1.f90: New test.

        PR fortran/19015
        * gfortran.dg/maxloc_shape_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/associated_target_1.f90
    trunk/gcc/testsuite/gfortran.dg/elemental_subroutine_3.f90
    trunk/gcc/testsuite/gfortran.dg/maxloc_shape_1.f90
Removed:
    trunk/gcc/testsuite/gfortran.dg/entry_dummy_ref_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/check.c
    trunk/gcc/fortran/dependency.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/interface.c
    trunk/gcc/fortran/iresolve.c
    trunk/gcc/fortran/resolve.c
    trunk/gcc/fortran/st.c
    trunk/gcc/fortran/trans-stmt.c
    trunk/gcc/fortran/trans-stmt.h
    trunk/gcc/fortran/trans.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time
       [not found] <bug-19015-9515@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2006-05-15 19:03 ` pault at gcc dot gnu dot org
@ 2006-05-15 20:35 ` patchapp at dberlin dot org
  2006-05-21  7:35 ` pault at gcc dot gnu dot org
  2006-05-28 19:55 ` pault at gcc dot gnu dot org
  5 siblings, 0 replies; 10+ messages in thread
From: patchapp at dberlin dot org @ 2006-05-15 20:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from patchapp at dberlin dot org  2006-05-15 20:35 -------
Subject: Bug number PR19015

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/2006-05/msg00685.html


-- 


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time
       [not found] <bug-19015-9515@http.gcc.gnu.org/bugzilla/>
  2006-05-12 11:43 ` paul dot richard dot thomas at cea dot fr
  2006-05-12 13:46 ` paul dot richard dot thomas at cea dot fr
@ 2006-05-15 19:03 ` pault at gcc dot gnu dot org
  2006-05-15 20:35 ` patchapp at dberlin dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: pault at gcc dot gnu dot org @ 2006-05-15 19:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2006-05-15 19:02 -------
I'll submit tonight, once I have got a couple of other pending patches out of
the door.

Paul


-- 

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|2005-12-30 18:53:50         |2006-05-15 19:02:42
               date|                            |


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time
       [not found] <bug-19015-9515@http.gcc.gnu.org/bugzilla/>
  2006-05-12 11:43 ` paul dot richard dot thomas at cea dot fr
@ 2006-05-12 13:46 ` paul dot richard dot thomas at cea dot fr
  2006-05-15 19:03 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-05-12 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paul dot richard dot thomas at cea dot fr  2006-05-12 13:45 -------
Created an attachment (id=11444)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11444&action=view)
Corrected version of patch

This version of the patch survives regtesting!


-- 

paul dot richard dot thomas at cea dot fr changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #11442|0                           |1
        is obsolete|                            |


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


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

* [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time
       [not found] <bug-19015-9515@http.gcc.gnu.org/bugzilla/>
@ 2006-05-12 11:43 ` paul dot richard dot thomas at cea dot fr
  2006-05-12 13:46 ` paul dot richard dot thomas at cea dot fr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: paul dot richard dot thomas at cea dot fr @ 2006-05-12 11:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paul dot richard dot thomas at cea dot fr  2006-05-12 11:42 -------
Created an attachment (id=11442)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11442&action=view)
Patch to effect compile time checking

Thomas,

The attached patch corrects the problem and is presently regtesting.  Of
course, it can only deal with constant values of dim so the runtime checking
should remain in place.

Gruesse

Paul


-- 


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


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

end of thread, other threads:[~2006-05-28 19:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-15 17:14 [Bug fortran/19015] New: shape / rank mismatch in maxloc / minloc leads to assertion failure at runtime Thomas dot Koenig at online dot de
2004-12-15 17:50 ` [Bug fortran/19015] " pinskia at gcc dot gnu dot org
2005-04-28  8:10 ` tkoenig at gcc dot gnu dot org
2005-06-06 20:22 ` [Bug fortran/19015] shape / rank mismatch in maxloc / minloc could be caught at compile time tkoenig at gcc dot gnu dot org
     [not found] <bug-19015-9515@http.gcc.gnu.org/bugzilla/>
2006-05-12 11:43 ` paul dot richard dot thomas at cea dot fr
2006-05-12 13:46 ` paul dot richard dot thomas at cea dot fr
2006-05-15 19:03 ` pault at gcc dot gnu dot org
2006-05-15 20:35 ` patchapp at dberlin dot org
2006-05-21  7:35 ` pault at gcc dot gnu dot org
2006-05-28 19:55 ` 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).