Bug 33297 - SIZE intrinsic crashes gfortran on invalid usage
Summary: SIZE intrinsic crashes gfortran on invalid usage
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: ice-on-invalid-code
Depends on:
Reported: 2007-09-04 07:14 UTC by Henrik Holst
Modified: 2007-09-12 10:34 UTC (History)
2 users (show)

See Also:
Known to work:
Known to fail: 4.1.2 4.3.0
Last reconfirmed: 2007-09-04 10:42:06


Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Holst 2007-09-04 07:14:58 UTC
Im using the standard Gfortran compiler in Ubuntu 7.04 (64 bit platform)

GFortran 4.1 crashes when you try and compile a program with a SIZE(ARRAY,(\I1,I2\)) call. This is not valid according to Fortran standard but I was curious to try it. However,...

kron.f90:19: internal compiler error: in 
             gfc_conv_array_constructor_expr, at fortran/trans-expr.c:2424

The bug has also been seen on,
GNU Fortran (GCC) 4.3.0 20070722 (experimental)

Thanks for your help,
Henrik Holst, Sweden
Comment 1 Francois-Xavier Coudert 2007-09-04 10:42:06 UTC
  integer array(5), i1, i2
  print *, size(array,(/i1,i2/))

#0  fancy_abort (file=0xb1b960 "../../../trunk2/gcc/fortran/trans-expr.c",
    line=2857, function=0xb1c1e0 "gfc_conv_array_constructor_expr")
    at ../../../trunk2/gcc/diagnostic.c:654
#1  0x0000000000494610 in gfc_conv_expr (se=0x7fffe7913840, expr=0xea5c60)
    at ../../../trunk2/gcc/fortran/trans-expr.c:2857
#2  0x0000000000495a68 in gfc_conv_expr_val (se=0x7fffe7913840, expr=0xb29)
    at ../../../trunk2/gcc/fortran/trans-expr.c:3361
#3  0x0000000000495b19 in gfc_conv_expr_type (se=0xb1b960, expr=0xb29,
    type=0xb1c1e0) at ../../../trunk2/gcc/fortran/trans-expr.c:3375
#4  0x000000000049c7e4 in gfc_conv_intrinsic_size (se=0x7fffe7913cb0,
    expr=0xea5540) at ../../../trunk2/gcc/fortran/trans-intrinsic.c:2833
Comment 2 Tobias Burnus 2007-09-04 15:25:37 UTC
>  integer array(5), i1, i2
>  print *, size(array,(/i1,i2/))

13.7.112 SIZE (ARRAY [, DIM, KIND])

ARRAY may be of any type. It shall not be scalar.
DIM (optional) shall be scalar and of type integer
KIND (optional) shall be a scalar integer initialization expression.
Comment 3 patchapp@dberlin.org 2007-09-06 11:57:29 UTC
Subject: Bug number PR33297

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/2007-09/msg00400.html
Comment 4 Tobias Burnus 2007-09-12 10:30:34 UTC
Subject: Bug 33297

Author: burnus
Date: Wed Sep 12 10:30:22 2007
New Revision: 128424

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128424
2007-09-12  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33297
	* check.c (scalar_check): Move up in the file.
	(kind_check): Call scalar_check.
	(dim_check): If optional, do not call nonoptional_check; use
	bool for optional.
	gfc_check_spread,gfc_check_ubound): Use true/false instead of 0/1
	for dim_check; honor changed meaning of optional.
	(gfc_check_int): Replace checks by kind_check.
	(gfc_check_size): Replace checks by dim_check.

2007-09-12  Tobias Burnus  <burnus@net-b.de>

	PR fortran/33297
	* gfortran.dg/intrinsic_size.f90: New.


Comment 5 Tobias Burnus 2007-09-12 10:34:25 UTC
FIXED for the trunk (GCC gfortran 4.3.0).

Thanks for the report.