public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/61888] New: Wrong results with SIZEOF and assumed-rank arrays
@ 2014-07-23 13:19 burnus at gcc dot gnu.org
2014-07-26 18:01 ` [Bug fortran/61888] " burnus at gcc dot gnu.org
2014-09-03 6:42 ` burnus at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-07-23 13:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61888
Bug ID: 61888
Summary: Wrong results with SIZEOF and assumed-rank arrays
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Keywords: rejects-valid, wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Per https://gcc.gnu.org/onlinedocs/gfortran/SIZEOF.html, SIZEOF is an inquiry
function (and GNU extension); that's in line with C_SIZEOF. However, the code
doesn't reflect this. That's fixed by:
--- a/gcc/fortran/intrinsic.c
+++ b/gcc/fortran/intrinsic.c
@@ -2768 +2768 @@ add_functions (void)
- add_sym_1 ("sizeof", GFC_ISYM_SIZEOF, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER,
ii,
+ add_sym_1 ("sizeof", GFC_ISYM_SIZEOF, CLASS_INQUIRY, ACTUAL_NO, BT_INTEGER,
ii,
After doing so, the following test case shows that the size is wrongly
calculated for assumed-rank arrays.
Additionally, one should check whether c_sizeof() should be permitted in this
case. It currently fails with "Error: 'x' argument of 'c_sizeof' intrinsic at
(1) must be an interoperable data entity: Only explicit-size and assumed-size
arrays are interoperable". One has to decipher TS29113 whether those should be
permitted for c_sizeof or not.
use iso_c_binding
implicit none
integer, pointer :: ptr(:)
allocate(ptr(10))
call foo(ptr)
call bar(ptr)
contains
subroutine foo(x)
integer, dimension(:) :: x
print *, sizeof(x) ! Prints EXPECTED: 40
end
subroutine bar(x)
integer, dimension(..) :: x
print *, sizeof(x) ! WRONG: Prints 4
end
end
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/61888] Wrong results with SIZEOF and assumed-rank arrays
2014-07-23 13:19 [Bug fortran/61888] New: Wrong results with SIZEOF and assumed-rank arrays burnus at gcc dot gnu.org
@ 2014-07-26 18:01 ` burnus at gcc dot gnu.org
2014-09-03 6:42 ` burnus at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-07-26 18:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61888
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
FIXED on the GCC 5 trunk (via r213079).
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug fortran/61888] Wrong results with SIZEOF and assumed-rank arrays
2014-07-23 13:19 [Bug fortran/61888] New: Wrong results with SIZEOF and assumed-rank arrays burnus at gcc dot gnu.org
2014-07-26 18:01 ` [Bug fortran/61888] " burnus at gcc dot gnu.org
@ 2014-09-03 6:42 ` burnus at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: burnus at gcc dot gnu.org @ 2014-09-03 6:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61888
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Author: burnus
Date: Wed Sep 3 06:41:37 2014
New Revision: 214843
URL: https://gcc.gnu.org/viewcvs?rev=214843&root=gcc&view=rev
Log:
Missed that file in r213079 of 2014-07-26
2014-09-03 Tobias Burnus <burnus@net-b.de>
PR fortran/61881
PR fortran/61888
PR fortran/57305
* gfortran.dg/sizeof_4.f90: New.
Added:
trunk/gcc/testsuite/gfortran.dg/sizeof_4.f90
Modified:
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-03 6:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 13:19 [Bug fortran/61888] New: Wrong results with SIZEOF and assumed-rank arrays burnus at gcc dot gnu.org
2014-07-26 18:01 ` [Bug fortran/61888] " burnus at gcc dot gnu.org
2014-09-03 6:42 ` burnus at gcc dot gnu.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).