GCC Bugzilla will be upgraded from version 4.4.9 to 5.0rc3 on Saturday, April 25, starting around 17:00 UTC. The upgrade process should only last a few minutes. Check bug 64968 for details.
Bug 53298 - ICE in gfc_conv_scalarized_array_ref for ARRAY + substring
ICE in gfc_conv_scalarized_array_ref for ARRAY + substring
Status: NEW
Product: gcc
Classification: Unclassified
Component: fortran
4.8.0
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
: ice-on-valid-code
Depends on:
Blocks: 45424 56818
  Show dependency treegraph
 
Reported: 2012-05-09 17:11 UTC by Tobias Burnus
Modified: 2013-04-27 13:31 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-04-27 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Burnus 2012-05-09 17:11:03 UTC
The following program segfaults. The problem is the expression
   array(:)(1:)
           ^^^--<-- substring

This combination is seemingly not handled by gfc_conv_expr_descriptor.

At the end, one gets a segfault for:
  gfc_conv_scalarized_array_ref (se=0x7fffffffcfe0, ar=0x1700538)
      at fortran/trans-array.c:3016
  3016      expr = ss->info->expr;

which is called via gfc_conv_array_ref <<< gfc_conv_variable <<< gfc_conv_string_length <<< get_array_charlen <<< gfc_conv_expr_descriptor.


  character(len=5) :: str(3)
  call f(str(:))
contains
  subroutine f(x)
   character(len=*) :: x(:)
   logical :: llll
   print *, size(x(:)(1:))
  end subroutine f
end


The program compiles flawlessly with NAG f95 and prints "3".  It fails with GCC 4.1.2, 4.3.4, 4.8.0 and probably all other versions.
Comment 1 Thomas Koenig 2013-04-06 11:46:37 UTC
Also looks like something that we could include with the array descritor reform.
Comment 2 Dominique d'Humieres 2013-04-27 13:31:04 UTC
The ICE occurs also with the fortran-dev branch (r198346 with the patch at http://gcc.gnu.org/ml/fortran/2013-04/msg00237.html).