Compiler warnings when running nrnivnmodl on Neuron mod files
sanjayankur31 opened this issue · comments
This also came up during the Fedora review.
On Fedora, the default compiler flags are:
$ echo $CFLAGS
-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection
So, the link time optimiser is also enabled. (The Fedora change is here).
While compiling the mod files in pyNN/neuron/nmodl/
, we get lots of warnings:
Most of them are syntactic warnings, but a few indicate that the code may not be doing what its supposed to:
=> LINKING library x86_64/libnrnmech.so Mod files: adexp.mod alphaisyn.mod alphasyn.mod expisyn.mod gammastim.mod gap.mod gif.mod gsfa_grr.mod hh_traub.mod izhikevich.mod netstim2.mod poisson_stim_refractory.mod quantal_stp.mod refrac.mod reset.mod stdwa_guetig.mod stdwa_softlimits.mod stdwa_songabbott.mod stdwa_symm.mod stdwa_vogels2011.mod stochastic_synapse.mod stochastic_tsodyksmarkram.mod tmgsyn.mod tmisyn.mod tsodyksmarkram.mod vecstim.mod
(cd .. ; g++ -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -std=c++11 -shared -fPIC -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -I /usr/include -o x86_64/libnrnmech.so -Wl,-soname,libnrnmech.so \
x86_64/mod_func.o x86_64/adexp.o x86_64/alphaisyn.o x86_64/alphasyn.o x86_64/expisyn.o x86_64/gammastim.o x86_64/gap.o x86_64/gif.o x86_64/gsfa_grr.o x86_64/hh_traub.o x86_64/izhikevich.o x86_64/netstim2.o x86_64/poisson_stim_refractory.o x86_64/quantal_stp.o x86_64/refrac.o x86_64/reset.o x86_64/stdwa_guetig.o x86_64/stdwa_softlimits.o x86_64/stdwa_songabbott.o x86_64/stdwa_symm.o x86_64/stdwa_vogels2011.o x86_64/stochastic_synapse.o x86_64/stochastic_tsodyksmarkram.o x86_64/tmgsyn.o x86_64/tmisyn.o x86_64/tsodyksmarkram.o x86_64/vecstim.o -L/usr/lib -lnrniv -lreadline -lcurses -lform -lpython3 -lX11 -lXext)
x86_64/quantal_stp.c:324:21: warning: type of ‘nrn_random_pick’ does not match original declaration [-Wlto-type-mismatch]
324 | value = nrn_random_pick(_p_rng);
| ^
x86_64/gif.c:397:8: note: return value type mismatch
397 | double nrn_random_pick(void* r);
| ^
x86_64/gif.c:397:8: note: type ‘double’ should match type ‘int’
x86_64/gif.c:397:8: note: ‘nrn_random_pick’ was previously declared here
x86_64/gif.c:397:8: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
x86_64/quantal_stp.c:298:19: warning: type of ‘nrn_random_arg’ does not match original declaration [-Wlto-type-mismatch]
298 | *pv = nrn_random_arg(1);
| ^
x86_64/gif.c:398:7: note: return value type mismatch
398 | void* nrn_random_arg(int argpos);
| ^
x86_64/gif.c:398:7: note: ‘nrn_random_arg’ was previously declared here
x86_64/gif.c:398:7: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
Could someone please have a quick look to see if these are bugs that need to be fixed?
I think most or all of these warnings were fixed in 297a96b.
Please could you check if everything compiles ok on Fedora now, @sanjayankur31 ?
I think this can be closed. The patch is in 0.10.1 and that's what we have working in Fedora currently.