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

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

def _print_SysExit(self, expr):
code = ""
if isinstance(expr.status, LiteralInteger):
arg = str(expr.status)
if expr.status.dtype is not NativeInteger() or expr.status.rank > 0:
print_arg = FunctionCallArgument(expr.status)
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)
# Ensure no type specifier is added for NativeInteger
arg = self._print(expr.status)
harsha-mangena marked this conversation as resolved.
Show resolved Hide resolved
# Remove any type specifier from the argument
arg = arg.split('_')[0]
return f'{code}stop {arg}\n'

def _print_NumpyUfuncBase(self, expr):
Expand Down