Bug 37836 - ICE in gfc_trans_auto_array_allocation
ICE in gfc_trans_auto_array_allocation
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.4.0
: P3 normal
: ---
Assigned To: Paul Thomas
: ice-on-valid-code
Depends on:
Blocks: 32834
  Show dependency treegraph
 
Reported: 2008-10-15 08:32 UTC by Tobias Burnus
Modified: 2008-11-14 06:17 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-10-20 22:21:39


Attachments
A draft patch for the PR (5.11 KB, patch)
2008-11-08 21:12 UTC, Paul Thomas
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2008-10-15 08:32:49 UTC
Found at http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/57938d5454a90397/589afd86ab2aab9b

 	 
The following program gives an ICE:

test.f90:14: internal compiler error: in gfc_trans_auto_array_allocation, at fortran/trans-array.c:4115

The bug has been found by James Van Buskirk.


! Automatic data object
      function fun4a(x)
         real x,fun4a
!         real y(nint(exp(3.0)))
         real y(minval([nint(exp(3.0))]))

         fun4a = y(1)
         y = x
      end function fun4a

      function fun4b(x)
         real x,fun4b
!         real y(nint(exp(3.0)))
         real y(minval([nint(exp(3.0))]))
         save

         fun4b = y(1)
         y = x
      end function fun4b
Comment 1 Paul Thomas 2008-10-20 22:21:38 UTC
minval and maxval do not get simplified.

Confirmed

Paul
Comment 2 Paul Thomas 2008-11-08 21:12:05 UTC
Created attachment 16638 [details]
A draft patch for the PR

This bootstraps and regtests on FC9/x86_i64

I'll clean it up tomorrow, add the testcase/ChangeLogs and submit to the list.

Paul
Comment 3 Paul Thomas 2008-11-09 17:41:53 UTC
Subject: Bug 37836

Author: pault
Date: Sun Nov  9 17:40:30 2008
New Revision: 141717

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141717
Log:
2008-11-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/37836
        * intrinsic.c (add_functions): Reference gfc_simplify._minval
	and gfc_simplify_maxval.
	* intrinsic.h : Add prototypes for gfc_simplify._minval and
	gfc_simplify_maxval.
	* simplify.c (min_max_choose): New function extracted from
	simplify_min_max.
	(simplify_min_max): Call it.
	(simplify_minval_maxval, gfc_simplify_minval,
	gfc_simplify_maxval): New functions.

2008-11-09  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/37836
        * gfortran.dg/minmaxval_1.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/minmaxval_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/intrinsic.c
    trunk/gcc/fortran/intrinsic.h
    trunk/gcc/fortran/simplify.c
    trunk/gcc/testsuite/ChangeLog

Comment 4 Paul Thomas 2008-11-14 06:16:15 UTC
Subject: Bug 37836

Author: pault
Date: Fri Nov 14 06:14:46 2008
New Revision: 141847

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141847
Log:
2008-11-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/37836
        * intrinsic.c (add_functions): Reference gfc_simplify._minval
	and gfc_simplify_maxval.
	* intrinsic.h : Add prototypes for gfc_simplify._minval and
	gfc_simplify_maxval.
	* simplify.c (min_max_choose): New function extracted from
	simplify_min_max.
	(simplify_min_max): Call it.
	(simplify_minval_maxval, gfc_simplify_minval,
	gfc_simplify_maxval): New functions.

2008-11-14  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/37836
        * gfortran.dg/minmaxval_1.f90: New test.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/minmaxval_1.f90
Modified:
    branches/gcc-4_3-branch/gcc/fortran/ChangeLog
    branches/gcc-4_3-branch/gcc/fortran/intrinsic.c
    branches/gcc-4_3-branch/gcc/fortran/intrinsic.h
    branches/gcc-4_3-branch/gcc/fortran/simplify.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 5 Paul Thomas 2008-11-14 06:17:00 UTC
Fixed on trunk and 4.3.

The latter was a bit less than the week delay that was promised but it was the most convenient time.

Paul