Menu

#1018 Code::Builds v20.03 Project: Build options: GNU Fortran Compiler: Compiler setting policy: Compiler Flags and Other complier options: Override & Append issues

Undefined
open
nobody
Bug_Report
2021-06-27
2020-09-23
Dale
No

Discussion

  • Teodor Petrov

    Teodor Petrov - 2020-09-23

    Can you describe the problem with actual words? Interpreting images is hard. I suppose the order is incorrect, but it is hard to be 100% sure.

    Also posting the exact steps to reproduce the problem might be helpful.

     
  • Dale

    Dale - 2020-09-24

    Teodor Petrov,
    In my effort to migrate to CodeBlock for GNU Fortran Compiler Coding Workbench.
    I was trying to support both file names .for by using Project Build options.. policy "Append target options to project option"
    by using Project complier flags:( -std=legacy -ffixed-form ) and files
    .f90 by using global compiler setting as the default
    Global complier flags:( -std=f2018 -ffree-form -fcheck=bounds -Wimplicit-interface -O2 -s -march=core2 -malign-double -fall-intrinsics ).
    Found bugs in two of the Project Build options.. Policies "Append target options to project option" and "Use target option only"

    1) Set Project Build options.. policy to "Append target options to project option" then ran Rebuild and checked the Build log.
    The result from the Build log was: gfortran.exe -Jobj\Release\ -Wall -std=legacy -ffixed-form -std=f2018 -ffree-form -fcheck=bounds -Wimplicit-interface -O2 -s -march=core2 -malign-double -fall-intrinsics -c...
    The expected result should be: gfortran.exe -Jobj\Release\ -std=f2018 -ffree-form -fcheck=bounds -Wimplicit-interface -O2 -s -march=core2 -malign-double -fall-intrinsics -std=legacy -ffixed-form -c...
    Note: Flag -Wall was not selected in the Global compiler settings Compiler Flags.

    2) Set Project Build options.. policy to "Use target options only" then ran Rebuild and checked the Build log.
    The result from the Build log was: gfortran.exe -Jobj\Release\ -std=legacy -ffixed-form -std=f2018 -ffree-form -fcheck=bounds -Wimplicit-interface -O2 -s -march=core2 -malign-double -fall-intrinsics -c...
    The expected result should be: gfortran.exe -Jobj\Release\ -std=legacy -ffixed-form -c...

    3) Another bug found: Only using Compiler settings "Other compiler options" to set the flags because Compiler settings "Compiler Flags" failed to set -s and -O2 (but for speed -O2 worked)

    Thanks,
    Dale

     
  • Teodor Petrov

    Teodor Petrov - 2020-09-24

    I'm pretty sure these things work fine for C/C++ projects.
    It is still hard to follow your explanations :(
    Can you post a sample project?
    Can you reproduce the same problem with c/c++ project (even if it is some toy)?

    (I don't know/use/have fortran compiler, so this is a bit foreign to me)

     
  • Teodor Petrov

    Teodor Petrov - 2020-09-24
    • labels: --> Compiler, Fortran
     
  • Dale

    Dale - 2020-09-25

    Teodor Petrov,
    Folders #4-5 is the creation and zip of the sample project.
    Also, was able to reproduce the same problem with a C++ project.

    Attatched a zip file containing the following informational folders:
    1) Using Win10 Pro
    2) Installed MinGW-W64 - x86_64-8.1.0-posix-seh-rt_v6-rev0
    3) Install Code_Blocks v20.03
    4) CodeBlocks Test Case - Hello.for
    5) Zip file of the generated Project
    6) C++ flag test (same flag isssues)

    Thanks,
    Dale

     
  • Morten MacFly

    Morten MacFly - 2020-12-29

    Just 2 remarks:
    1.) You are not suing the gfortran compiler in the project you have provided. Are you sure this is what you want?
    2.) The setup of the gfortran compiler as you show it seems really strange and most likely wrong: You are not supposed to link to low.-level executables. gfortran is installed just as any other compilers under [MinGw]\bin. please fix the setup accordingly.

    Once I changed the project to the right compiler it worked for me:
    -------------- Build: Release in CodeBlocks Test Case - Hello.for (compiler: GNU Fortran Compiler)---------------

    gfortran.exe -Jobj\Release\ -Wall -std=legacy -ffixed-form -c "D:\CodeBlocks Test Case - Hello.for\src\hello.for" -o obj\Release\src\hello.o
    gfortran.exe -o "bin\Release\CodeBlocks Test Case - Hello.exe" obj\Release\src\hello.o
    Output file is bin\Release\CodeBlocks Test Case - Hello.exe with size 349.78 KB

     
  • darmar

    darmar - 2021-06-27

    I think I understood what Dale mean: options from the "Global compiler settings" are appended to the compiler command line. Dale expects the global compiler options to be PREpended.
    * In C::B we have:
    compiler.exe -Some_Project_Options -Some_Appended_Target_Options -Some_Global_Compiler_Options ...

    • Dale expects:
      compiler.exe -Some_Global_Compiler_Options -Some_Project_Options -Some_Appended_Target_Options ...

    It is nothing specific to the Gfortran or GCC. The compilation works in such a way in C::B. Perhaps, it would be possible to add an option the "Global compiler settings" letting a user to choose "append" or "prepend" those options. Not sure if it worth the efforts.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.