Bug 1520011
| Summary: | gfortran doesn't consider c_loc addresses c_associated | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Red Hat Developer Toolset | Reporter: | Ben Woodard <woodard> | ||||
| Component: | gcc | Assignee: | Marek Polacek <mpolacek> | ||||
| Status: | CLOSED ERRATA | QA Contact: | Michael Petlan <mpetlan> | ||||
| Severity: | unspecified | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | DTS 7.0 RHEL 7 | CC: | bgollahe, jakub, kanderso, law, mcermak, mnewsome, ohudlick, tgummels | ||||
| Target Milestone: | alpha | ||||||
| Target Release: | 7.1 | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | devtoolset-7-gcc-7.2.1-6.el6 | Doc Type: | No Doc Update | ||||
| Doc Text: |
undefined
|
Story Points: | --- | ||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2018-05-03 05:13:47 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
The problem (if it is a problem) also seems to exist in Fortran and with upstream GCC Created attachment 1361869 [details]
test program as an attachment
To be noted this behavior is different than the system compiler. [ben@localhost ~]$ gfortran --version GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16) Copyright (C) 2015 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING [ben@localhost ~]$ gfortran cassoc.f90 [ben@localhost ~]$ ./a.out true true [ben@localhost cassoc]$ scl enable devtoolset-6 'bash' [ben@localhost cassoc]$ gfortran --version GNU Fortran (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3) Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [ben@localhost cassoc]$ gfortran cassoc.f90 -o cassoc.6.3.1 [ben@localhost cassoc]$ ./cassoc.6.3.1 true true Tests passed with devtoolset-7-gcc-7.3.1-5.4.el{6,7}.
VERIFIED.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:1293 |
Description of problem: ! gfortran 7.1.0 prints: ! true ! false ! Correct answer is: ! true ! true program tester use iso_c_binding implicit none integer(c_int), target :: ivar type(c_ptr) jvar, kvar ivar = 42 jvar = c_loc(ivar) kvar = c_loc(ivar) call assert_true(c_associated(jvar, kvar)) call assert_true(c_associated(c_loc(ivar), c_loc(ivar))) contains subroutine assert_true(var1) logical, intent(in) :: var1 if (var1 .eqv. .true.) then print *, "true" else print *, "false" endif end subroutine assert_true end program tester I’ve reproduced this on even the latest gcc but I really don’t know if their statement of the problem is accurate and can’t find enough about what c_associated is supposed to do to really know if this is in fact a problem or if it is just a misunderstanding of what c_loc and c_associated are supposed to do. Could someone with a deeper understanding of modern fortran take a quick look at this and tell me if I should file a bug or if I should push back on this?