From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A9733882651; Sat, 1 Jun 2024 10:28:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A9733882651 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717237707; bh=/ufY7ocCYskghHBnWlf5crFkZqLLs5RVhuOxmv1H6sk=; h=From:To:Subject:Date:From; b=SDGYQ+SwIoAJPKYBrwXmtlmuvLxzUOhAW4EpF42BVFkG6OXUFftjE63G7fJBO5LLd 38w0S6V8Bp9RZDuRXiAy1fig1o7fft/kEb7fhxu1I8zFRDZEv9Aft+TmHr47HfzH52 vT46ldqv34POZAS6ZTcH1FbPAHOjSGyiGd/W0PW0= From: "dcb314 at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/115315] New: valgrind error in gfc_simplify_expr Date: Sat, 01 Jun 2024 10:28:26 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new 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: dcb314 at hotmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115315 Bug ID: 115315 Summary: valgrind error in gfc_simplify_expr Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Target Milestone: --- For this Fortran source code: ! RUN: %python %S/test_errors.py %s %flang_fc1 ! Test section subscript subroutine p1 real :: a(10,10) real :: b(5,5) real :: c integer :: n n =3D 2 b =3D a(1:10:n,1:n+3) end ! Test substring subroutine p2 type t1(n1,n2) integer,kind :: n1,n2 integer :: c2(iachar('ABCDEFGHIJ'(n1:n1))) end type character :: a(10) character :: b(5) character :: c(0) integer :: n n =3D 3 b =3D a(n:7) b =3D a(n+3:) b =3D a(:n+2) a(n:7) =3D b a(n+3:) =3D b a(:n+2) =3D b n =3D iachar(1_'ABCDEFGHIJ'(1:1)) c =3D 'ABCDEFGHIJ'(1:0) end ! Test pointer assignment with bounds subroutine p3 integer, pointer :: a(:,:) integer, target :: b(2,2) integer :: n n =3D 2 a(n:,n:) =3D> b a(1:n,1:n) =3D> b end ! Test pointer assignment to array element subroutine p4 type :: t real, pointer :: a end type type(t) :: x(10) integer :: i real, target :: y x(i)%a =3D> y end subroutine A recent valgrind version of gfortran does this: test $ ~/gcc/results.20240530.valgrind/bin/gfortran -c -w ./Semantics/resolve49.f90 =3D=3D1331074=3D=3D Invalid read of size 2 =3D=3D1331074=3D=3D at 0x48513A0: memmove (vg_replace_strmem.c:1414) =3D=3D1331074=3D=3D by 0x74F69F: gfc_simplify_expr(gfc_expr*, int) (expr= .cc:2305) =3D=3D1331074=3D=3D by 0x74F4FB: gfc_simplify_expr(gfc_expr*, int) (expr= .cc:2265) The source code file is from the flang testsuite at=20 https://github.com/llvm/llvm-project/tree/main/flang/test=