public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/38324]  New: Wrong lbound given to allocatable components
@ 2008-11-30  7:50 pault at gcc dot gnu dot org
  2008-12-01 13:55 ` [Bug fortran/38324] " dominiq at lps dot ens dot fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-11-30  7:50 UTC (permalink / raw)
  To: gcc-bugs

This was identified in comment #13 of PR34143 and is not fixed by the patch for
that PR.

The problem of conversion shows up even without -fdefault-integer-8 along with
bound problems as shown by the following code:

integer, parameter :: ik=4
type :: struct
   integer(4), allocatable :: ib(:)
end type struct
integer, parameter :: from=-1, to=2
integer(ik), allocatable :: ia(:)
type(struct) :: x
allocate(ia(from:to))
print *, 'bounds, full array           ', lbound(ia), ubound(ia)
print *, 'bounds, full implicit section', lbound(ia(:)), ubound(ia(:))
print *, 'bounds, full explicit section', lbound(ia(from:to)),
ubound(ia(from:to))
print *, 'derived type, ik=', ik
x=struct(ia)
print *, 'bounds, full array           ', lbound(x%ib), ubound(x%ib)
x=struct(ia(:))
print *, 'bounds, full implicit section', lbound(x%ib), ubound(x%ib)
x=struct(ia(from:to))
print *, 'bounds, full explicit section', lbound(x%ib), ubound(x%ib)
deallocate(ia)
end

with ik = 4, the ouput is:

 bounds, full array                     -1           2
 bounds, full implicit section           1           4
 bounds, full explicit section           1           4
 derived type, ik=           4
 bounds, full array                     -1           2
 bounds, full implicit section          -1           2    <-- should not it be
1 4 as above?
 bounds, full explicit section           1           4

with ik = 8:

...
 derived type, ik=           8
 bounds, full array                      1           4    <--- should not it be
-1 2 as for ik = 4?
 bounds, full implicit section           1           4
 bounds, full explicit section           1           4


-- 
           Summary: Wrong lbound given to allocatable components
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: pault at gcc dot gnu dot org
        ReportedBy: pault at gcc dot gnu dot org


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


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

* [Bug fortran/38324] Wrong lbound given to allocatable components
  2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
@ 2008-12-01 13:55 ` dominiq at lps dot ens dot fr
  2008-12-17 12:22 ` pault at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2008-12-01 13:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dominiq at lps dot ens dot fr  2008-12-01 13:54 -------
AFAICT this pr is the cause of half of the failures of
gfortran.dg/alloc_comp_constructor_1.f90 on i686-apple-darwin9 with
-fdefault-integer-8:

FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O0  execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O0  scan-tree-dump-times
original "builtin_free" 21
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O1  execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O1  scan-tree-dump-times
original "builtin_free" 21
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O2  execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O2  scan-tree-dump-times
original "builtin_free" 21
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -fomit-frame-pointer 
execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -fomit-frame-pointer 
scan-tree-dump-times original "builtin_free" 21
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -fomit-frame-pointer
-funroll-loops  execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -fomit-frame-pointer
-funroll-loops  scan-tree-dump-times original "builtin_free" 21
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -fomit-frame-pointer
-funroll-all-loops -finline-functions  scan-tree-dump-times original
"builtin_free" 21
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -g  execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -O3 -g  scan-tree-dump-times
original "builtin_free" 21
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -Os  execution test
FAIL: gfortran.dg/alloc_comp_constructor_1.f90  -Os  scan-tree-dump-times
original "builtin_free" 21

The second half is due to 24 "builtin_free" in the "original" dump. This is the
cause of some failures of this test on powerpc-apple-darwin9 (-O0/1, I have
filled pr38347 against the middle-end for the ICE got with higher
optimizations).


-- 


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


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

* [Bug fortran/38324] Wrong lbound given to allocatable components
  2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
  2008-12-01 13:55 ` [Bug fortran/38324] " dominiq at lps dot ens dot fr
@ 2008-12-17 12:22 ` pault at gcc dot gnu dot org
  2009-01-29 22:03 ` mikael at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2008-12-17 12:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pault at gcc dot gnu dot org  2008-12-17 12:20 -------
This is, of course, confirmed!

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2008-12-17 12:20:37
               date|                            |


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


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

* [Bug fortran/38324] Wrong lbound given to allocatable components
  2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
  2008-12-01 13:55 ` [Bug fortran/38324] " dominiq at lps dot ens dot fr
  2008-12-17 12:22 ` pault at gcc dot gnu dot org
@ 2009-01-29 22:03 ` mikael at gcc dot gnu dot org
  2010-01-30 18:22 ` pault at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mikael at gcc dot gnu dot org @ 2009-01-29 22:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from mikael at gcc dot gnu dot org  2009-01-29 22:03 -------
patch http://gcc.gnu.org/ml/fortran/2009-01/msg00348.html

The failure for ik=8 is not fixed by this patch. 
I thought it was ok because of the kind conversion function call. 
But it seems it's not.

It is impacting function calls too (descriptor with wrong bounds passed), but
the descriptor bounds are never used from within the function.
This needs a bit more investigation.


-- 

mikael at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug fortran/38324] Wrong lbound given to allocatable components
  2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2009-01-29 22:03 ` mikael at gcc dot gnu dot org
@ 2010-01-30 18:22 ` pault at gcc dot gnu dot org
  2010-01-31 12:05 ` pault at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-30 18:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pault at gcc dot gnu dot org  2010-01-30 18:22 -------
I just, at last, posted a fix on the list.

Paul


-- 


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


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

* [Bug fortran/38324] Wrong lbound given to allocatable components
  2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2010-01-30 18:22 ` pault at gcc dot gnu dot org
@ 2010-01-31 12:05 ` pault at gcc dot gnu dot org
  2010-01-31 14:57 ` pault at gcc dot gnu dot org
  2010-01-31 15:00 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-31 12:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pault at gcc dot gnu dot org  2010-01-31 12:05 -------
Subject: Bug 38324

Author: pault
Date: Sun Jan 31 12:05:22 2010
New Revision: 156399

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156399
Log:
2010-01-31  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/38324
        * expr.c (gfc_get_full_arrayspec_from_expr): New function.
        * gfortran.h : Add prototype for above.
        * trans-expr.c (gfc_trans_alloc_subarray_assign): New function.
        (gfc_trans_subcomponent_assign): Call new function to replace
        the code to deal with allocatable components.
        * trans-intrinsic.c (gfc_conv_intrinsic_bound): Call
        gfc_get_full_arrayspec_from_expr to replace existing code.

2010-01-31  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/38324
        * gfortran.dg/alloc_comp_basics_1.f90: Remove option -O2.
        * gfortran.dg/alloc_comp_bounds_1.f90: New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/alloc_comp_bounds_1.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/expr.c
    trunk/gcc/fortran/gfortran.h
    trunk/gcc/fortran/trans-expr.c
    trunk/gcc/fortran/trans-intrinsic.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90


-- 


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


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

* [Bug fortran/38324] Wrong lbound given to allocatable components
  2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2010-01-31 12:05 ` pault at gcc dot gnu dot org
@ 2010-01-31 14:57 ` pault at gcc dot gnu dot org
  2010-01-31 15:00 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-31 14:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pault at gcc dot gnu dot org  2010-01-31 14:57 -------
Subject: Bug 38324

Author: pault
Date: Sun Jan 31 14:57:13 2010
New Revision: 156401

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156401
Log:
2010-01-31  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/38324
        * expr.c (gfc_get_full_arrayspec_from_expr): New function.
        * gfortran.h : Add prototype for above.
        * trans-expr.c (gfc_trans_alloc_subarray_assign): New function.
        (gfc_trans_subcomponent_assign): Call new function to replace
        the code to deal with allocatable components.
        * trans-intrinsic.c (gfc_conv_intrinsic_bound): Call
        gfc_get_full_arrayspec_from_expr to replace existing code.

2010-01-31  Paul Thomas  <pault@gcc.gnu.org>

        PR fortran/38324
        * gfortran.dg/alloc_comp_basics_1.f90: Remove option -O2.
        * gfortran.dg/alloc_comp_bounds_1.f90: New test.


Added:
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/alloc_comp_bounds_1.f90
Modified:
    branches/gcc-4_4-branch/gcc/fortran/ChangeLog
    branches/gcc-4_4-branch/gcc/fortran/expr.c
    branches/gcc-4_4-branch/gcc/fortran/gfortran.h
    branches/gcc-4_4-branch/gcc/fortran/trans-expr.c
    branches/gcc-4_4-branch/gcc/fortran/trans-intrinsic.c
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/alloc_comp_basics_1.f90


-- 


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


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

* [Bug fortran/38324] Wrong lbound given to allocatable components
  2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2010-01-31 14:57 ` pault at gcc dot gnu dot org
@ 2010-01-31 15:00 ` pault at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pault at gcc dot gnu dot org @ 2010-01-31 15:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pault at gcc dot gnu dot org  2010-01-31 15:00 -------
Fixed on trunk and 4.4

Paul


-- 

pault at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2010-01-31 15:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-30  7:50 [Bug fortran/38324] New: Wrong lbound given to allocatable components pault at gcc dot gnu dot org
2008-12-01 13:55 ` [Bug fortran/38324] " dominiq at lps dot ens dot fr
2008-12-17 12:22 ` pault at gcc dot gnu dot org
2009-01-29 22:03 ` mikael at gcc dot gnu dot org
2010-01-30 18:22 ` pault at gcc dot gnu dot org
2010-01-31 12:05 ` pault at gcc dot gnu dot org
2010-01-31 14:57 ` pault at gcc dot gnu dot org
2010-01-31 15:00 ` 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).