From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B9BAB3858D39; Fri, 2 Dec 2022 18:45:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B9BAB3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1670006713; bh=uzh+DSSfhjE/3tFAjL3505x51CoSuEybSHPIaFZypng=; h=From:To:Subject:Date:From; b=M/0zIv4hDXlLA5GbSygtIjBCE0gMUN6Rsq0409Mb48BBDzqSUktX0dFYdAne0C/q1 foRbRVkWLAMpSwhojT75owOppiwElVG4UZfsKMQd+qZlrIbBPVfoXjlWzlky1Wj7F7 KYuftsewa83sT50yrDDaZNjQ5nRqdAAwZayeKivM= From: "emr-gnu at hev dot psu.edu" To: gdb-prs@sourceware.org Subject: [Bug fortran/29842] New: Debugging variables with ALLOCATABLE attribute fails to read variable properties correctly Date: Fri, 02 Dec 2022 18:45:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: fortran X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: emr-gnu at hev dot psu.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot 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 attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29842 Bug ID: 29842 Summary: Debugging variables with ALLOCATABLE attribute fails to read variable properties correctly Product: gdb Version: HEAD Status: UNCONFIRMED Severity: normal Priority: P2 Component: fortran Assignee: unassigned at sourceware dot org Reporter: emr-gnu at hev dot psu.edu Target Milestone: --- Created attachment 14476 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14476&action=3Ded= it Reproducer In the attached program, gdb version ac57bf55 (current HEAD as of this writing), GDB fails to debug the contents (or even the size/address) of For= tran variables marked with the ALLOCATABLE attribute when built with the Intel i= fort compiler. I have not checked LLVM (gfortran-12.1 works fine). ---------------- gfortran-12.1 -ffixed-line-length-none -g -O0 -o main main.for ifort -g -O0 -o main main.for Expected behavior (correct with gfortran): (gdb) b 29 (gdb) r (gdb) whatis string1 type =3D PTR TO -> ( character*(*) ) (gdb) p string1 $1 =3D (PTR TO -> ( character*(*) )) 0x0 (gdb) n (gdb) p string1 $2 =3D (PTR TO -> ( character*(*) )) 0x55555555c680 (gdb) p *string1 $3 =3D '\000' ---------------- Incorrect behavior (as experienced with ifort-generated executable): (gdb) b 29 (gdb) r (gdb) whatis string1 type =3D character*(*) (gdb) p string1 Location address is not set. (gdb) n (gdb) whatis string1 type =3D character (0) (gdb) p string1 $1 =3D '' (gdb) n (gdb) whatis string1 type =3D character (5053124857890819657) (gdb) p string1 value requires 5053124857890819657 bytes, which is more than max-value-size ---------------- Based on the above, it looks like gdb is possibly not interpreting variables with the ALLOCATABLE attribute as being a pointer, so any gdb operations on that variable are going to be incorrect. And this seems to be limited to o= nly code generated with ifort; code generated with IFX and gfortran is correctly interpreted. I am unable to test LLVM at this time. --=20 You are receiving this mail because: You are on the CC list for the bug.=