public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "john.harper at vuw dot ac.nz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/113313] execute_command_line hangs at run time
Date: Thu, 11 Jan 2024 07:03:05 +0000 [thread overview]
Message-ID: <bug-113313-4-15GCxPW5X9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113313-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113313
--- Comment #2 from john.harper at vuw dot ac.nz ---
Thank you! You may wish to know that in my Ubuntu system the program
runs properly if the function iam is used in an assignment statement not a
print statement. (Fortran Discourse gave me the idea.) Revised program:
program test2
! f2008 using execute_command_line and assuming Linux
implicit none
logical foo(2)
foo = [iam('john'),iam('JOHN')]
print "(A,L2)",'I am john',foo(1)
print "(A,L2)",'I am JOHN',foo(2)
contains
logical function iam( name)
character(*),intent(in)::name
integer estat
character(len(name)+38):: cmd
cmd = 'if [ `whoami` != "'//name//'" ]; then exit 1; fi'
call execute_command_line(cmd,exitstat=estat)
iam = (estat==0)
end function iam
end program test2
On Thu, 11 Jan 2024, kargl at gcc dot
gnu.org wrote:
> Date: Thu, 11 Jan 2024 05:49:10 +0000
> From: kargl at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org>
> To: John Harper <john.harper@vuw.ac.nz>
> Subject: [Bug libfortran/113313] execute_command_line hangs at run time
> Resent-Date: Thu, 11 Jan 2024 18:49:26 +1300 (NZDT)
> Resent-From: <john.harper@vuw.ac.nz>
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113313
>
> kargl at gcc dot gnu.org changed:
>
> What |Removed |Added
> ----------------------------------------------------------------------------
> CC| |kargl at gcc dot gnu.org
>
> --- Comment #1 from kargl at gcc dot gnu.org ---
> Created attachment 57034
> --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57034&action=edit
> patch to execute_command_line.c
>
> Code compiles and runs on FreeBSD. That said, I see
>
> % gfcx -o z a.f90 -g && ./z
> I am john F
> I am JOHN F
> % valgrind ./z
> ==18812== Memcheck, a memory error detector
> ==18812== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
> ==18812== Using Valgrind-3.22.0 and LibVEX; rerun with -h for copyright info
> ==18812== Command: ./z
> ==18812==
> ==18812== Conditional jump or move depends on uninitialised value(s)
> ==18812== at 0x4B0AD79: _gfortran_execute_command_line_i4
> (execute_command_line.c:203)
> ==18812== by 0x400B2A: iam.0 (a.f90:15)
> ==18812== by 0x400BE1: MAIN__ (a.f90:5)
> ==18812== by 0x400CEF: main (a.f90:6)
> ==18812==
> I am john F
> ==18812== Conditional jump or move depends on uninitialised value(s)
> ==18812== at 0x4B0AD79: _gfortran_execute_command_line_i4
> (execute_command_line.c:203)
> ==18812== by 0x400B2A: iam.0 (a.f90:15)
> ==18812== by 0x400C8B: MAIN__ (a.f90:6)
> ==18812== by 0x400CEF: main (a.f90:6)
> ==18812==
> I am JOHN F
> ==18812==
> ==18812== HEAP SUMMARY:
> ==18812== in use at exit: 0 bytes in 0 blocks
> ==18812== total heap usage: 26 allocs, 26 frees, 9,873 bytes allocated
>
> Looking at the code around line 203 suggests that there may be some confusion
> with setting the error status. The attached patch allows the code to
> run without the valgrind warnings.
>
> --
> You are receiving this mail because:
> You reported the bug.
>
-- John Harper, School of Mathematics and Statistics
Victoria Univ. of Wellington, PO Box 600, Wellington 6140, New Zealand.
e-mail john.harper@vuw.ac.nz
next prev parent reply other threads:[~2024-01-11 7:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 20:20 [Bug fortran/113313] New: " john.harper at vuw dot ac.nz
2024-01-11 5:49 ` [Bug libfortran/113313] " kargl at gcc dot gnu.org
2024-01-11 7:03 ` john.harper at vuw dot ac.nz [this message]
2024-01-11 7:17 ` john.harper at vuw dot ac.nz
2024-01-11 20:18 ` jvdelisle at gcc dot gnu.org
2024-01-11 20:45 ` kargl at gcc dot gnu.org
2024-01-11 22:40 ` john.harper at vuw dot ac.nz
2024-01-12 20:02 ` sgk at troutmask dot apl.washington.edu
2024-01-13 3:42 ` jvdelisle at gcc dot gnu.org
2024-01-15 20:40 ` john.harper at vuw dot ac.nz
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-113313-4-15GCxPW5X9@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: link
Be 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).