------- Comment #3 from tkoenig at gcc dot gnu dot org  2008-03-30 16:36 -------

> Related program, which also fails (I thought we fixed this; this seems to be a
> libgfortran problem):
> 
>       integer xda(20)
>       integer, volatile :: n
>       n = 1
>       print *, size(XDA(n:2:-3)) ! should print 0, prints 1
>       END

This appears to be a problem in the front end, the descriptor
isn't filled out correctly:

$ gfortran -fdump-tree-original foo.f90 
$ cat foo.f90
      integer xda(20)
      integer :: n
      n = 1
      print *, size(XDA(n:2:-3)) ! should print 0, prints 1
      END
$ gfortran -g foo.f90 
$ gdb ./a.out 
GNU gdb 6.7.1-debian
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...
Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1".
(gdb) b _gfortran_size0     
Function "_gfortran_size0" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y

Breakpoint 1 (_gfortran_size0) pending.
(gdb) r
Starting program: /tmp/a.out 
Breakpoint 2 at 0xb7f90e94: file
../../../../gcc/trunk/libgfortran/intrinsics/size.c, line 35.
Pending breakpoint "_gfortran_size0" resolved

Breakpoint 2, *_gfortrani_size0 (array=0xbfdb3088)
    at ../../../../gcc/trunk/libgfortran/intrinsics/size.c:41
41        for (n = 0; n < GFC_DESCRIPTOR_RANK (array); n++)
(gdb) p *array
$1 = {data = 0x0, offset = 0, dtype = 265, dim = {{stride = -3, lbound = 1, 
      ubound = 1}, {stride = -1076149005, lbound = 1, ubound = -1076154168}, {
      stride = 134514393, lbound = 1, ubound = -1076154012}, {
      stride = -1076154152, lbound = -1076154144, ubound = -1209417740}, {
      stride = -1208222496, lbound = -1076154056, ubound = -1210674096}, {
      stride = -1208222496, lbound = 134514432, ubound = -1076154056}, {
      stride = -1210674096, lbound = 1, ubound = -1076154012}}}
(gdb) 


-- 


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

Reply via email to