From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EAAE83939C2B; Wed, 3 Feb 2021 14:56:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EAAE83939C2B From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/98904] valgrind error in gfc_trans_assignment_1 during bootstrap Date: Wed, 03 Feb 2021 14:56:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Feb 2021 14:56:14 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98904 --- Comment #11 from Tobias Burnus --- (In reply to David Binderman from comment #10) > lhs_caf_attr.codimension is uninitialised. It is clear that lhs_caf_attr is uninitialized - if and only if flag_coarray !=3D GFC_FCOARRAY_LIB It might be that some code optimizes converts if (flag_coarray =3D=3D GFC_FCOARRAY_LIB && lhs_caf_attr.codimension) to if (flag_coarray =3D=3D GFC_FCOARRAY_LIB & lhs_caf_attr.codimension) to speed up =E2=80=93 relying that lhs_caf_attr.codimension accesses valid = memory (which may be uninitialized). The replacement would work correctly anywhere where accessing uninitialized memory works. As: if flag_coarray =3D=3D GFC_FCOARRAY_LIB is 0, the value of lhs_caf_attr.codimension does not matte= r =E2=80=93 and if it is not 0, lhs_caf_attr.codimension is properly initialized. It might be that the either the middle end of GCC does this optimization or that valgrind does this internally. In any case, the Fortran-compiler part is perfectly valid C/C++.=