# Complex addition returns NaN

**URL:** <https://fortran-lang.discourse.group/t/complex-addition-returns-nan/204>\
**Category:** Help\
**Created:** [July 12, 2020, 3:19pm UTC](https://fortran-lang.discourse.group/t/complex-addition-returns-nan/204 "2020-07-12T15:19:26Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![FortranFan](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@FortranFan](https://fortran-lang.discourse.group/u/FortranFan)\
**Post date:** [July 12, 2020, 7:47pm UTC](https://fortran-lang.discourse.group/t/complex-addition-returns-nan/204/3 "2020-07-12T19:47:55Z")

</div>

@ELNS,

You may have noted Fortran as a programming language has a standard and is supported by more than processor with different levels of support and guidance for practitioners. If you were to try Intel Fortran compiler in a “pedantic” mode on the code you show in the original post, you could get a response as follows:

> C:\temp\>ifort /c /warn:errors arithmetic\_mod.f90  
> Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.1.216 Build 20200306  
> Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
> 
> arithmetic\_mod.f90(10): error #6178: The return value of this FUNCTION has not been defined. [INT\_ADD]  
> integer function int\_add(n\_1, n\_2)  
> ---------------------^  
> arithmetic\_mod.f90(16): error #6178: The return value of this FUNCTION has not been defined. [REAL\_ADD]  
> real function real\_add(n\_1, n\_2)  
> ------------------^  
> arithmetic\_mod.f90(22): error #6178: The return value of this FUNCTION has not been defined. [COMPLEX\_ADD]  
> complex function complex\_add(n\_1, n\_2)  
> ---------------------^  
> compilation aborted for arithmetic\_mod.f90 (code 1)
> 
> C:\temp\>

Unfortunately with gfortran even with its “pedantic” settings, the compiler raises no alerts to bring your attention to the issue. Perhaps you can get involved with the GCC gfortran community and contribute toward compiler enhancements that can help you and other future Fortranners like you who may be using gfortran whilst learning the language:

> C:\temp\>gfortran -c -std=f2018 -Wpedantic -pedantic-errors arithmetic\_mod.f90
> 
> C:\temp\>

---

_[View the full topic](https://fortran-lang.discourse.group/t/complex-addition-returns-nan/204)._
