Commit Graph

6 Commits

Author SHA1 Message Date
Don Cross
054985606e Revert "Use _FORTIFY_SOURCE=3 to improve C/C++ code verification."
This reverts commit a7e747c100.
This broke the GitHub Actions automated tests, because they
are using gcc 11 (which does not support level 3 fortification),
and they already predefine another fortification level.

I realize this would also hinder other contributors who
are not using gcc 12. At least I tried it once on my own
system and didn't find any problems, which is nice.
2023-09-11 15:02:14 -04:00
Don Cross
a7e747c100 Use _FORTIFY_SOURCE=3 to improve C/C++ code verification. 2023-09-11 14:48:44 -04:00
Don Cross
2c787eca8e Refined the problematic optimizations to -ffp-contract=off.
Instead of turning off all "expensive optimizations" in gcc,
I found I can achieve consistent calculation results on
64-bit ARM processors by turning off just the "fp contract"
optimization.

This optimizer is actually supposed to produce *more* accurate
results, but the effect is to produce results that differ
across languages/processors. For the sake of the unit tests,
I have decided it must be turned off in ctest and generate.
2020-07-22 21:30:51 +00:00
Don Cross
82c4c512e8 Removed the optimizations that were causing calculation problems.
It turns out that in gcc 9.3.0 on aarch64, the "expensive optimizations"
were causing incorrect calculations. I resumed using -O3 but with
expensive optimizations turned off. Now all unit tests pass again.
2020-07-22 20:30:44 +00:00
Don Cross
c4442103c4 More fixes for gcc 9.3.0 aarch64 on Raspberry Pi 3.
Fixed some build warnings that occur on various gcc
optimization levels, and only on this version of gcc.

For now, build ctest with fewer optimizations: -O1
instead of -O3. This is because -O3 and -O2 cause
excessive errors in 'ctest diff' of the order
1.0e-9, where I usually get 1.0e-12. I will have to
come back and figure out exactly which optimization(s)
are causing the problem and turn them off specifically.
This also means I need to document the dangerous optimizations
for people who are using the C version of Astronomy Engine.

When 'ctest diff' fails because of excessive numeric error,
print out the two lines of input text that had the worst
numeric error. This really helps on the Raspberry Pi
where memory is at a premium, and it's hard to open the
full output files using vi.
2020-07-22 18:53:13 +00:00
Don Cross
ed2cf7d985 Split out separate script ctbuild for building ctest from source. 2019-07-02 21:24:50 -04:00