public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "dcesari69 at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/111521] New: Polymorphic variable loses information about the actual type assigned when passed as function result Date: Thu, 21 Sep 2023 14:30:56 +0000 [thread overview] Message-ID: <bug-111521-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111521 Bug ID: 111521 Summary: Polymorphic variable loses information about the actual type assigned when passed as function result Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: dcesari69 at gmail dot com Target Milestone: --- Created attachment 55961 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55961&action=edit Program showing the described behavior Hello, the attached program shows an anomalous behavior since gcc-gfortran version 13, in the previous gfortran versions it worked as expected. gcc version: GNU Fortran (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1) Copyright (C) 2023 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. OS (Fedora 38): Linux trentotto 6.3.8-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 15 02:15:40 UTC 2023 x86_64 GNU/Linux Build command line: gfortran -g -fcheck=all -o testpoli testpoli.f90 Actual program stdout: 1.integer 1.integer 2.unknown type 3.unknown type 8 -1 Expected program stdout (e.g. when compiled with gfortran 12.2.1): 1.integer 2.integer 3.integer 8 8 Description: The unlimited polymorphic derived type member %val is initialised with an integer, but when passed back as a result of a chain of functions, it loses its type. Additionally, the debugging print show that the function link_getval is apparently executed twice, while it is called only once. By executing the commented line `v => this%curr%getval()` instead of `v => this%getcurr()` the program gives the expected result with version 13, however the original code was obviously more complex and this chained function call was necessary. The bug could be somehow related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110415 also appearing in version 13.
next reply other threads:[~2023-09-21 14:30 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-21 14:30 dcesari69 at gmail dot com [this message] 2023-09-21 15:11 ` [Bug fortran/111521] " dcesari69 at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111521-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).