lktsui / carbon_xs_gui

A GUI Front-end to CarbonXS
GNU General Public License v3.0
3 stars 2 forks source link

gcc warnings on Fedora #34

Open alxpl opened 5 years ago

alxpl commented 5 years ago

Hello,

I was interested in packaging CarbonXS GUI for fedora and I started by looking into the compilation of the Fortran code (gcc-gfortran-8.2.1 on Fedora 29). Fedora has a default set of compiler flags for C, C++ and Fortran, which should be used for the compilation of all executables. In the case of F29, these are:

$ rpm --eval %{optflags}
-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection

Using these, the compilation completes, albeit with a bunch of warnings, e.g.:

f951: Warning: Nonconforming tab character in column 1 of line 47 [-Wtabs]
[…]
carbon.cmn:11:14:

  LOGICAL DERIV
              1
Warning: Nonconforming tab character at (1) [-Wtabs]
[…]
CARBONXS.FOR:1176:72:

             PAUSE 'Improper permutation in LISTA'
                                                                        1
Warning: Deleted feature: PAUSE statement at (1)
[…]
CARBONXS.FOR:945:25:

         E1PIL =EXP(CMPLX(0.0D0,1*PI*L))
                         1
Warning: Conversion from REAL(8) to default-kind COMPLEX(4) at (1) might lose precision, consider using the KIND argument [-Wconversion]
[…]
CARBONXS.FOR:1090:21:

         INTEGER N,ILS,IS,I,IU
                     1
Warning: Unused variable ‘ils’ declared at (1) [-Wunused-variable]
[…]
CARBONXS.FOR:849:0:

           DD002=DD002+(DGDL*CS+G*DCSDL)*ET*POC*DLDD

Warning: ‘dldd’ may be used uninitialized in this function [-Wmaybe-uninitialized]

and so on. In addition to the above, when the program is run, this appears at the end of its output: Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO IEEE_OVERFLOW_FLAG IEEE_UNDERFLOW_FLAG IEEE_DENORMAL Now, to be honest, I haven't touched any Fortran code in over a decade, nor have I kept an eye on any developments during this time, so I am the least qualified person to give advice, but I think it would be worth it weeding out the false positives and hardening the code.

Fedora 30 comes with GCC9, which carries a host of new features and modifications and I intend to check what happens there as well.