https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62296

--- Comment #6 from Harald Anlauf <anlauf at gmx dot de> ---
(In reply to Dominique d'Humieres from comment #5)
> (In reply to Harald Anlauf from comment #4)
> > (In reply to Harald Anlauf from comment #3)
> > > One might be able to do better on any reasonable Unix/Linux system.
> >
> > Replying to myself: Intel has changed/fixed their implementation of
> > EXECUTE_COMMAND_LINE in version 15.1, and it appears to work
> > reasonably now.
> 
> What does it mean for gfortran?

The remaining issue for cmdstat, reduced from comment #1, can be seen as
follows:

  integer :: stat, cstat
  character(len=255) :: cmdmsg
  stat = 0; cstat = 0; cmdmsg = ""
  call execute_command_line ("/nosuchfile",exitstat=stat, cmdstat=cstat,
cmdmsg=cmdmsg)
  print *, stat, cstat, "'", trim (cmdmsg), "'"
  stat = 0
  call execute_command_line ("/nosuchfile",exitstat=stat)
  print *, stat
end

produces with gfortran:

sh: /nosuchfile: No such file or directory
         127           0 ''
sh: /nosuchfile: No such file or directory
         127

and with ifort:

sh: /nosuchfile: No such file or directory
           0         124 'Invalid command supplied to EXECUTE_COMMAND_LINE'
sh: /nosuchfile: No such file or directory
forrtl: severe (124): Invalid command supplied to EXECUTE_COMMAND_LINE


cmdstat=0 is not a useful return value if the command cannot be executed.
The other cases from comment #0 appear correct.

Reply via email to