Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exit statement in Fortran with Intel compiler #1624

14 changes: 8 additions & 6 deletions pyccel/codegen/printing/fcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2626,15 +2626,17 @@ def _print_Header(self, expr):

def _print_SysExit(self, expr):
code = ""
if expr.status.dtype is not NativeInteger() or expr.status.rank > 0:
print_arg = FunctionCallArgument(expr.status)
exit_code = expr.status
if isinstance(exit_code, LiteralInteger):
arg = exit_code.python_value
elif exit_code.dtype is not NativeInteger() or exit_code.rank > 0:
print_arg = FunctionCallArgument(exit_code)
EmilyBourne marked this conversation as resolved.
Show resolved Hide resolved
code = self._print(PythonPrint((print_arg, ), file="stderr"))
arg = "1"
else:
arg = expr.status
if arg.precision != 4:
arg = NumpyInt32(arg)
arg = self._print(arg)
if exit_code.precision != 4:
exit_code = NumpyInt32(exit_code)
arg = self._print(exit_code)
return f'{code}stop {arg}\n'

def _print_NumpyUfuncBase(self, expr):
Expand Down