Comments (3)
Hi @jschueller , thank you for the feedback. This is very interesting.
What is the exact command of the compilation? Below is what I tried on my computer. Note that my gfortran-11
is also gfortran 11.3
.
cd fortran
gfortran-11 -c -g -Wall -Wextra ./common/consts.F90 ./common/infos.f90 ./common/debug.F90 ./common/inf.F90 ./common/infnan.F90 ./common/memory.F90 ./common/string.f90 ./common/linalg.f90 ./common/univar.f90 ./common/rand.f90 ./common/ratio.f90 ./common/redrho.f90 ./common/xinbd.f90 ./common/history.f90 ./common/selectx.f90 ./common/checkexit.f90 ./common/fprint.f90 ./common/message.f90 ./common/preproc.f90 ./common/pintrf.f90 ./common/evaluate.f90 ./common/powalg.f90 ./common/shiftbase.f90 ./bobyqa/geometry.f90 ./bobyqa/initialize.f90 ./bobyqa/update.f90 ./bobyqa/rescue.f90 ./bobyqa/trustregion.f90 ./bobyqa/bobyqb.f90 ./bobyqa/bobyqa.f90
This does raise the following warning about uninitialized variables, but diact
and xp
are not among them.
bobyqa.f90
./common/string.f90:164:86:
164 | sformat = '(1PE'//int2str(wx)//'.'//int2str(ndgt_loc)//'E'//int2str(nexp_loc)//')'
| ^
Warning: ‘.sformat’ may be used uninitialized [-Wmaybe-uninitialized]
./common/linalg.f90:2121:24:
2121 | direction_loc = 'ascend'
| ^
Warning: ‘.direction_loc’ may be used uninitialized [-Wmaybe-uninitialized]
./common/fprint.f90:83:21:
83 | fname_loc = fname
| ^
Warning: ‘.fname_loc’ may be used uninitialized [-Wmaybe-uninitialized]
./common/fprint.f90:99:23:
99 | position = 'append'
| ^
Warning: ‘.position’ may be used uninitialized [-Wmaybe-uninitialized]
./common/fprint.f90:112:60:
112 | fstat = merge(tsource='old', fsource='new', mask=fexist)
| ^
Warning: ‘.fstat’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:382:14:
382 | fname = ''
| ^
Warning: ‘.fname’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:403:70:
403 | delta_message = newline//state//' step with radius = '//num2str(delta)
| ^
Warning: ‘.delta_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:407:63:
407 | & spaces//'Constraint violation = '//num2str(cstrv_loc)
| ^
Warning: ‘.nf_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:413:86:
413 | x_message = newline//'The corresponding X is: '//num2str(x) ! Printed in one line
| ^
Warning: ‘.x_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:420:101:
420 | constr_message = newline//'The constraint value is: '//num2str(constr) ! Printed in one line
| ^
Warning: ‘.constr_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:429:62:
429 | message = delta_message//nf_message//x_message//constr_message
| ^
Warning: ‘.message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:315:14:
315 | fname = ''
| ^
Warning: ‘.fname’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:322:52:
322 | message = newline//'Set CPEN to '//num2str(cpen)
| ^
Warning: ‘.message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:216:14:
216 | fname = ''
| ^
Warning: ‘.fname’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:239:34:
239 | & 'CPEN = '//num2str(cpen)
| ^
Warning: ‘.rho_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:245:86:
245 | x_message = newline//'The corresponding X is: '//num2str(x) ! Printed in one line
| ^
Warning: ‘.x_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:252:98:
252 | & 'Least value of F = '//num2str(f)//spaces//'Constraint violation = '//num2str(cstrv_loc)
| ^
Warning: ‘.nf_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:259:101:
259 | constr_message = newline//'The constraint value is: '//num2str(constr) ! Printed in one line
| ^
Warning: ‘.constr_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:269:73:
269 | message = newline//rho_message//nf_message//x_message//constr_message
| ^
Warning: ‘.message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:82:14:
82 | fname = ''
| ^
Warning: ‘.fname’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:106:53:
106 | reason = 'the target function value is achieved.'
| ^
Warning: ‘.reason’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:130:73:
130 | ret_message = newline//'Return from '//solver//' because '//strip(reason)
| ^
Warning: ‘.ret_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:133:86:
133 | x_message = newline//'The corresponding X is: '//num2str(x) ! Printed in one line
| ^
Warning: ‘.x_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:140:98:
140 | & 'Least value of F = '//num2str(f)//spaces//'Constraint violation = '//num2str(cstrv_loc)
| ^
Warning: ‘.nf_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:147:101:
147 | constr_message = newline//'The constraint value is: '//num2str(constr) ! Printed in one line
| ^
Warning: ‘.constr_message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/message.f90:157:82:
157 | message = newline//ret_message//nf_message//x_message//constr_message//newline
| ^
Warning: ‘.message’ may be used uninitialized [-Wmaybe-uninitialized]
./common/preproc.f90:134:39:
134 | min_maxfun_str = '(N+1)(N+2)/2 + 1'
| ^
Warning: ‘.min_maxfun_str’ may be used uninitialized [-Wmaybe-uninitialized]
The warnings are due to a known bug of gfortran
: https://fortran-lang.discourse.group/t/warning-str-may-be-used-uninitialized . It has been fixed in gfortran-12
. So no warning is emitted if I use gfortran-12
instead of gfortran-11
.
Note that the warnings depend on the optimization level of the compilation. Indeed, if I replace gfortran-11
with gfortran-12 -Og
, then the following warning about diact
will be raised:
./bobyqa/trustregion.f90:540:111:
540 | xbdi(iact) = nint(sign(ONE, d(iact) - diact), kind(xbdi)) !!MATLAB: xbdi(iact) = sign(d(iact) - diact)
| ^
Warning: ‘diact’ may be used uninitialized [-Wmaybe-uninitialized]
./bobyqa/trustregion.f90:100:17:
100 | real(RP) :: diact
| ^
note: ‘diact’ was declared here
But there is still no warning about xp
.
What do you think?
Thanks.
Zaikun
from prima.
oh, I also had "-fcheck=all", here is the full command:
[ 28%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/rescue.f90.o
cd /home/schueller/projects/prima/build/fortran && /usr/bin/gfortran -Dprimaf_EXPORTS -Wall -fcheck=all -O2 -g -DNDEBUG -fPIC -c /home/schueller/projects/prima/fortran/bobyqa/rescue.f90 -o CMakeFiles/primaf.dir/bobyqa/rescue.f90.o
/home/schueller/projects/prima/fortran/bobyqa/rescue.f90:504:52:
504 | xxpt = xp * xpt(ip, :) + xq * xpt(iq, :)
| ^
Warning: ‘xq’ may be used uninitialized in this function [-Wmaybe-uninitialized]
/home/schueller/projects/prima/fortran/bobyqa/rescue.f90:504:52: Warning: ‘xp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
/usr/bin/cmake -E cmake_copy_f90_mod fortran/rescue_mod.mod fortran/CMakeFiles/primaf.dir/rescue_mod.mod.stamp GNU
from prima.
Hello @jschueller , I think this has been fixed by dd2821f . You may verify it. Thanks.
from prima.
Related Issues (20)
- Mexification fails on macOS with Xcode 15 and Intel oneAPI 2023
- The C example on README does not work HOT 1
- cobyla fails CMake test with flang family compilers HOT 1
- Support Function Call Parallelization in MATLAB Interface HOT 1
- Support "OutputFcn" option in MATLAB interface HOT 2
- Enable reverse communication?
- LINCOA doesn't adhere to upper and lower bounds HOT 5
- BOBYQA recursion problem HOT 3
- Rhobeg and rhoend arrays HOT 1
- Improve the scaling
- `PRIMA_INTEGER_KIND` slightly affects the result when compiled with `-Ofast -fno-stack-arrays`
- The behavior of COBYLA is slightly different when `infnan_mod` is broken and the code is compiled with `-Ofast -fno-stack-arrays`
- Should `prima_get_rc_string` be exposed in the C public API?
- CMake test fails with strict diagnostic options for Intel compilers HOT 3
- Add options.ctol to `prima_is_success` HOT 1
- `tracebackqq` in `matlab/mex_gateways/debug.F90` trigers a SEGFAULT when it is called HOT 1
- Get ` PRIMA_PROBLEM_SOLVER_MISMATCH_XXX` back
- Why the versions of OS and gcc in build_python.yml are old? HOT 2
- Python wheel testing fails on macOS 14 (ARM64)
- LINCOA in multiple threads odd results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prima.