Opened 3 years ago
Closed 3 years ago
#21705 closed enhancement (fixed)
Fix GCC warnings in PARI interface
Reported by: | jdemeyer | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-7.5 |
Component: | cython | Keywords: | |
Cc: | defeo | Merged in: | |
Authors: | Jeroen Demeyer | Reviewers: | Luca De Feo |
Report Upstream: | N/A | Work issues: | |
Branch: | eaf5abf (Commits) | Commit: | eaf5abf1607df49d8247a29f1ab799b5bf3cdde9 |
Dependencies: | #20241 | Stopgaps: |
Description (last modified by )
Several compiler warnings show up when compiling the Cython files in src/sage/libs/pari
. These can easily be fixed, except for some spurious -Wmaybe-uninitialized
warnings which come from the sig_on()
statements.
Attachments (2)
Change History (13)
comment:1 Changed 3 years ago by
- Description modified (diff)
comment:2 Changed 3 years ago by
- Branch set to u/jdemeyer/ticket/21705
comment:3 Changed 3 years ago by
- Commit set to eaf5abf1607df49d8247a29f1ab799b5bf3cdde9
- Status changed from new to needs_review
comment:4 Changed 3 years ago by
Weird. This removes the warnings, but adds some more:
[15/59] gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC -I/data/dfl/sage/local/lib/python2.7/site-packages/cysignals -I/data/dfl/sage/local/include -I/data/dfl/sage/local/include/python2.7 -I/data/dfl/sage/local/lib/python2.7/site-packages/numpy/core/include -I/data/dfl/sage/src -I/data/dfl/sage/src/sage/ext -I/data/dfl/sage/src/build/cythonized -I/data/dfl/sage/src/build/cythonized/sage/ext -I/data/dfl/sage/local/include/python2.7 -c /data/dfl/sage/src/build/cythonized/sage/libs/pari/convert_sage.c -o build/temp.linux-x86_64-2.7/data/dfl/sage/src/build/cythonized/sage/libs/pari/convert_sage.o -fno-strict-aliasing /data/dfl/sage/local/include/libLfunction/Lvalue.h: In member function 'Complex L_function<ttype>::value_via_Riemann_sum(Complex, const char*) [with ttype = std::complex<double>; Complex = std::complex<double>]': /data/dfl/sage/local/include/libLfunction/Lvalue.h:489:5: warning: control reaches end of non-void function [-Wreturn-type] } ^ /data/dfl/sage/local/include/libLfunction/Lvalue.h: In member function 'Complex L_function<ttype>::value_via_Riemann_sum(Complex, const char*) [with ttype = int; Complex = std::complex<double>]': /data/dfl/sage/local/include/libLfunction/Lvalue.h:489:5: warning: control reaches end of non-void function [-Wreturn-type] } ^ /data/dfl/sage/local/include/libLfunction/Lvalue.h: In member function 'Complex L_function<ttype>::value_via_Riemann_sum(Complex, const char*) [with ttype = double; Complex = std::complex<double>]': /data/dfl/sage/local/include/libLfunction/Lvalue.h:489:5: warning: control reaches end of non-void function [-Wreturn-type] } ^
[38/59] gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC -DUSE_THREADS=1 -DTHREAD_STACK_SIZE=4096 -I/data/dfl/sage/local/lib/python2.7/site-packages/cysignals -I/data/dfl/sage/local/include -I/data/dfl/sage/local/include/python2.7 -I/data/dfl/sage/local/lib/python2.7/site-packages/numpy/core/include -I/data/dfl/sage/src -I/data/dfl/sage/src/sage/ext -I/data/dfl/sage/src/build/cythonized -I/data/dfl/sage/src/build/cythonized/sage/ext -I/data/dfl/sage/local/include/python2.7 -c /data/dfl/sage/src/build/cythonized/sage/rings/bernmm.cpp -o build/temp.linux-x86_64-2.7/data/dfl/sage/src/build/cythonized/sage/rings/bernmm.o -fno-strict-aliasing gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC -DUSE_THREADS=1 -DTHREAD_STACK_SIZE=4096 -I/data/dfl/sage/local/lib/python2.7/site-packages/cysignals -I/data/dfl/sage/local/include -I/data/dfl/sage/local/include/python2.7 -I/data/dfl/sage/local/lib/python2.7/site-packages/numpy/core/include -I/data/dfl/sage/src -I/data/dfl/sage/src/sage/ext -I/data/dfl/sage/src/build/cythonized -I/data/dfl/sage/src/build/cythonized/sage/ext -I/data/dfl/sage/local/include/python2.7 -c sage/rings/bernmm/bern_modp.cpp -o build/temp.linux-x86_64-2.7/sage/rings/bernmm/bern_modp.o -fno-strict-aliasing gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC -I/data/dfl/sage/local/lib/python2.7/site-packages/cysignals -I/data/dfl/sage/local/include -I/data/dfl/sage/local/include/python2.7 -I/data/dfl/sage/local/lib/python2.7/site-packages/numpy/core/include -I/data/dfl/sage/src -I/data/dfl/sage/src/sage/ext -I/data/dfl/sage/src/build/cythonized -I/data/dfl/sage/src/build/cythonized/sage/ext -I/data/dfl/sage/local/include/python2.7 -c sage/modular/arithgroup/sl2z.cpp -o build/temp.linux-x86_64-2.7/sage/modular/arithgroup/sl2z.o -fno-strict-aliasing sage/rings/bernmm/bern_modp.cpp: In function 'long int bernmm::bernsum_pow2(long int, NTL::mulmod_t, long int, long int, long int)': sage/rings/bernmm/bern_modp.cpp:401:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (long i = 0; i < TABLE_SIZE; i++) ^ sage/rings/bernmm/bern_modp.cpp: In function 'long int bernmm::bernsum_pow2_redc(long int, NTL::mulmod_t, long int, long int, long int)': sage/rings/bernmm/bern_modp.cpp:624:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (long i = 0; i < TABLE_SIZE; i++) ^
[41/59] gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wno-unused -fPIC -I/data/dfl/sage/local/include -I/data/dfl/sage/local/include/python2.7 -I/data/dfl/sage/local/lib/python2.7/site-packages/numpy/core/include -I/data/dfl/sage/src -I/data/dfl/sage/src/sage/ext -I/data/dfl/sage/src/build/cythonized -I/data/dfl/sage/src/build/cythonized/sage/ext -I/data/dfl/sage/local/include/python2.7 -c /data/dfl/sage/src/build/cythonized/sage/rings/fast_arith.c -o build/temp.linux-x86_64-2.7/data/dfl/sage/src/build/cythonized/sage/rings/fast_arith.o -fno-strict-aliasing In file included from /data/dfl/sage/local/lib/python2.7/site-packages/cysignals/pxi.h:8:0, from /data/dfl/sage/src/build/cythonized/sage/rings/integer.c:343: /data/dfl/sage/src/build/cythonized/sage/rings/integer.c: In function '__pyx_f_4sage_5rings_7integer_set_from_pari_gen': /data/dfl/sage/local/lib/python2.7/site-packages/cysignals/macros.h:96:86: warning: '({anonymous})' may be used uninitialized in this function [-Wmaybe-uninitialized] #define _sig_on_(message) ( unlikely(_sig_on_prejmp(message, __FILE__, __LINE__)) || _sig_on_postjmp(sigsetjmp(cysigs.env,0)) ) ^ /data/dfl/sage/local/lib/python2.7/site-packages/cysignals/macros.h:96:86: note: '({anonymous})' was declared here #define _sig_on_(message) ( unlikely(_sig_on_prejmp(message, __FILE__, __LINE__)) || _sig_on_postjmp(sigsetjmp(cysigs.env,0)) ) ^ /data/dfl/sage/local/lib/python2.7/site-packages/cysignals/macros.h:184:28: note: in expansion of macro '_sig_on_' #define sig_on() _sig_on_(NULL) ^ /data/dfl/sage/src/build/cythonized/sage/rings/integer.c:4275:19: note: in expansion of macro 'sig_on' __pyx_t_7 = sig_on(); if (unlikely(__pyx_t_7 == 0)) __PYX_ERR(0, 232, __pyx_L1_error) ^
What am I doing wrong?
comment:5 Changed 3 years ago by
I am only dealing with warnings inside src/sage/libs/pari
. Are you saying that this branch adds new warnings in files like sage/rings/bernmm/bern_modp.cpp
?
comment:6 Changed 3 years ago by
To be sure, test like this:
./sage -b # Make sure that everything is up-to-date before testing this branch touch src/sage/libs/pari/*.pyx ./sage -b # Recompile only the PARI files
comment:7 follow-up: ↓ 8 Changed 3 years ago by
I'm saying that the head commit adds those three warnings. I did
git checkout HEAD^ make build git checkout t/21705/ticket/21705 make build
and looked at the diff between the two logs. Oddly enough, many more things (59 modules) got recompiled this way, then by just touching.
comment:8 in reply to: ↑ 7 ; follow-up: ↓ 10 Changed 3 years ago by
Replying to defeo:
I'm saying that the head commit adds those three warnings. I did
git checkout HEAD^ make build git checkout t/21705/ticket/21705 make buildand looked at the diff between the two logs.
You really need to start from a known state, so you omitted an important part: what happened before the git checkout HEAD^
?
If you really want to diff logs, you should do:
export MAKE="make -j1" # Build serially to have reproducible logs git checkout t/21705/ticket/21705 make build # Put the build in a known state, ignore this log git checkout HEAD^ make build &>log1 git checkout t/21705/ticket/21705 make build &>log2
and then compare log1
and log2
.
Changed 3 years ago by
Changed 3 years ago by
comment:9 Changed 3 years ago by
I just did that, you will see that no new warnings appear.
comment:10 in reply to: ↑ 8 Changed 3 years ago by
- Dependencies set to #20241
- Reviewers set to Luca De Feo
- Status changed from needs_review to positive_review
Replying to jdemeyer:
You really need to start from a known state, so you omitted an important part: what happened before the
git checkout HEAD^
?
I had made this branch, yes. But you are right, I forgot about -j1
. I did what you just suggested, and I confirm there are no new warnings.
comment:11 Changed 3 years ago by
- Branch changed from u/jdemeyer/ticket/21705 to eaf5abf1607df49d8247a29f1ab799b5bf3cdde9
- Resolution set to fixed
- Status changed from positive_review to closed
New commits:
Merge commit '343131a9951dc842c462809b9366b13416382dfc'; commit '91c436752ba82d512efdf67e2890d5ecbe0b7234'; commit '74041f30d8de4c15055345f14340a4f443236ffa' into HEAD
Separate Sage-specific components from generic C-interface in PariInstance
Simplify module_list
Cleanup imports; add __future__ statements
Fixed broken doctest in auto-generationy
Merge tag '7.4.rc0' into t/20241/ticket/20241
Fix some compiler warnings in PARI interface