This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/TM4C1294NCPDT: warning: statement is unreachable

Part Number: TM4C1294NCPDT
Other Parts Discussed in Thread: SYSBIOS

Tool/software: Code Composer Studio

Hi,

I am developing embedded application using following platform: TM4C1294NCPDT, TI-RTOS v2.16, CCS v9.0.1.

I am getting below warning on compilation:

""package/cfg/<project name>_pem4f.c", line xxx: warning: statement is unreachable"

Same project I compiled in CCS v6.2.0, I didn't get any as such warning.

1. What is the reason for this warning in CCS v9.0.1 ?

2. How to resolve this warning in CCS v9.0.1 ?

Thanking you.

Best Regards,

Harshal

  • This happens when the generated <project name>_pem4f.c contains a conditional that evaluates to a constant and the compiler can determine that one of the conditions is always true (or always not true). For example in this code, if  "ti_sysbios_hal_Hwi_Object__count__C"  is a constant that is 0, the last "return" line will never be executed and the compiler can omit it.

    /* Object__get__S */
    xdc_Ptr ti_sysbios_hal_Hwi_Object__get__S(xdc_Ptr oa, xdc_Int i)
    {
        if (oa) {
            return ((ti_sysbios_hal_Hwi_Object__ *)oa) + i;
        }
    
        if (ti_sysbios_hal_Hwi_Object__count__C == 0) {
            return NULL;
        }
    
        return ((ti_sysbios_hal_Hwi_Object__ *)ti_sysbios_hal_Hwi_Object__table__C) + i;
    }
    

    On these files this warning can be ignored. Since you do not modify these files, you should only see this warning during the first build, when you do a CLEAN before a build or change compiler versions. The version of CCS you use does not determine the version of compiler you are using, but when you changed from CCS6 to CC9 you probably changed compiler version too. That is what prompted the rebuild of the _pem4f file.

  • Yes, compiler is changed with CCS v9.0.1.

    How can I resolve this warning in CCS v9.0.1 ?

  • If you don't want that warning you can disable that message or turn it into a comment only adding 112 to the section for "Treat diagnostic<id> as remark" or the section "Suppress diagnostic <id>". You can do that for the whole project by right clicking on the project and selecting "Show Build Settings.." or you can change this for an individual C file by right clicking on that file and selecting "Show Build Settings...".

  • I tried as u suggested. But still warning appears as it was.

    And I can't change settings specific to file because this file is created when I build the project.
  • Not sure why that did not work for you, it worked in my setup. Another option is to edit the variable "COMPILER_FLAGS" and add the string "--diag_remark=112". This variable is used for setting compile options for the XDC generated code.

    Right click on the project, select "Show Build Settings...". Click on "CCS Build". Select the "Variables" tab and check the "Show system variables" check box on the bottom. Scroll down to the variable "COMPILER_FLAGS" and select it. Now click on "Edit". Scroll to the end of the string and add "--diag_remark=112". Select "OK", the "Apply and Close".

    I have also attached my copy of the project extracted into the zip file in the link below:

    /cfs-file/__key/communityserver-discussions-components-files/908/RTOSspiloopback.zip

  • I referred provided project, which is created in CCS v7.3.0 and uses compiler v16.9.6.LTS.

    I am using compiler v18.12.1 LTS.

    I tried as suggested, but still warning continues.

  • I verified that the solution I provided also works using compiler v18.12.1 LTS. Can you export your project to a zip file and send it to me? You can request friendship and send it via private message if you don't want to attach it to this thread.

  • I have not heard back from you so I assume you have resolved this issue. If not, please reply to this thread, or open a new thread by clicking "Ask a related question" if this thread has already closed.

  • Hello Bob,

    Sorry for delay in reply.

    Best Regards,

    Harshal

    Please refer attached file for project I'm using.7271.empty_EK_TM4C1294XL_TI.zip

  • Hello Bob,

    Sorry for delay in reply.

    Best Regards,

    Harshal

    Please refer attached file for project I'm using.4073.empty_EK_TM4C1294XL_TI.zip

  • OK, I added the string "--diag_remark=112" to the variable "COMPILER_FLAGS" as I described above. Now the project builds without the warnings. I have attached the modified project.

    /cfs-file/__key/communityserver-discussions-components-files/908/3005.empty_5F00_EK_5F00_TM4C1294XL_5F00_TI.zip

  • I have not heard back from you. Have you downloaded and imported the project that I posted above?

  • I tried file shared by you.

    I am sending my project in above link.

    Please let me know in case any concern.

    Previously I've updated project in following link

    https://e2e.ti.com/support/microcontrollers/other/f/908/t/806966#pi320995=1

  • harshal patil said:
    I tried file shared by you.

    And what were the results? Did you import the project from the .zip file into your workspace or did you just copy the source files? (You must import the project.) I downloaded your project and saw that the variable "COMPILER_FLAGS" had not been modified as I instructed. I modified that variable, verified that the project compiles using compiler version 18.12.1 without warnings and then zipped and posted the project for you.

    You have posted your project again. I downloaded the zip file and imported the project. Again, the variable COMPILRE_FLAGS does not have "--diag_remark=112" appended to it. 

  • Hi Bob,

    Please find attached file for project which I've created using CCS v9.0.1.

    Please refer build log for attachment.

    **** Build of configuration Debug for project TestApp_warning ****
    
    "C:\\ti\\ccs901\\ccs\\utils\\bin\\gmake" -k -j 8 all -O 
     
    Building file: "../TestApp.cfg"
    Invoking: XDCtools
    "C:/ti/xdctools_3_32_00_06_core/xs" --xdcpath="C:/ti/tirtos_tivac_2_16_00_08/packages;C:/ti/tirtos_tivac_2_16_00_08/products/tidrivers_tivac_2_16_00_08/packages;C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages;C:/ti/tirtos_tivac_2_16_00_08/products/ndk_2_25_00_09/packages;C:/ti/tirtos_tivac_2_16_00_08/products/uia_2_00_05_50/packages;C:/ti/tirtos_tivac_2_16_00_08/products/ns_1_11_00_10/packages;" xdc.tools.configuro -o configPkg -t ti.targets.arm.elf.M4F -p ti.platforms.tiva:TM4C1294NCPDT -r release -c "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS" "../TestApp.cfg"
    making package.mak (because of package.bld) ...
    generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...
    configuring TestApp.xem4f from package/cfg/TestApp_pem4f.cfg ...
    generating custom ti.sysbios library makefile ... 
    Starting build of library sources ...
    making C:/myWorkspace/CCSv9/TestApp_warning/Project/src/sysbios/sysbios.aem4f ...
    gmake[1]: Entering directory `C:/myWorkspace/CCSv9/TestApp_warning/Project/src/sysbios'
    clem4f C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/BIOS.c ...
    asmem4f C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/family/arm/m3/Hwi_asm.sv7M ...
    asmem4f C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/family/arm/m3/Hwi_asm_switch.sv7M ...
    asmem4f C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/family/arm/m3/IntrinsicsSupport_asm.sv7M ...
    asmem4f C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/family/arm/m3/TaskSupport_asm.sv7M ...
    arem4f BIOS.obj m3_Hwi_asm.obj m3_Hwi_asm_switch.obj m3_IntrinsicsSupport_asm.obj m3_TaskSupport_asm.obj ...
    gmake[1]: Leaving directory `C:/myWorkspace/CCSv9/TestApp_warning/Project/src/sysbios'
    Build of libraries done.
    clem4f package/cfg/TestApp_pem4f.c ...
    "package/cfg/TestApp_pem4f.c", line 16519: warning: statement is unreachable
    "package/cfg/TestApp_pem4f.c", line 16771: warning: statement is unreachable
    "package/cfg/TestApp_pem4f.c", line 17257: warning: statement is unreachable
    "package/cfg/TestApp_pem4f.c", line 17492: warning: statement is unreachable
    "package/cfg/TestApp_pem4f.c", line 17712: warning: statement is unreachable
    "package/cfg/TestApp_pem4f.c", line 17911: warning: statement is unreachable
    "package/cfg/TestApp_pem4f.c", line 18092: warning: statement is unreachable
    Finished building: "../TestApp.cfg"
     
            1 file(s) copied.
    making ../src/sysbios/sysbios.aem4f ...
    gmake[1]: Nothing to be done for 'all'.
    Building file: "../test.c"
    Invoking: ARM Compiler
    "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --opt_for_speed=0 --include_path="C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b" --include_path="C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/posix" --include_path="C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/include" --include_path="C:/myWorkspace/CCSv9/TestApp_warning/Project" --include_path="C:/myWorkspace/CCSv9/TestApp_warning" --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE -g --c11 --gcc --diag_remark=112 --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --preproc_with_compile --preproc_dependency="test.d_raw" --cmd_file="configPkg/compiler.opt" "../test.c"
    Finished building: "../test.c"
     
    Building file: "../empty.c"
    Invoking: ARM Compiler
    "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --opt_for_speed=0 --include_path="C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b" --include_path="C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/posix" --include_path="C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/include" --include_path="C:/myWorkspace/CCSv9/TestApp_warning/Project" --include_path="C:/myWorkspace/CCSv9/TestApp_warning" --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE -g --c11 --gcc --diag_remark=112 --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --preproc_with_compile --preproc_dependency="empty.d_raw" --cmd_file="configPkg/compiler.opt" "../empty.c"
    Finished building: "../empty.c"
     
    Building file: "../EK_TM4C1294XL.c"
    Invoking: ARM Compiler
    "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --opt_for_speed=0 --include_path="C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b" --include_path="C:/ti/tirtos_tivac_2_16_00_08/products/bios_6_45_01_29/packages/ti/sysbios/posix" --include_path="C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/include" --include_path="C:/myWorkspace/CCSv9/TestApp_warning/Project" --include_path="C:/myWorkspace/CCSv9/TestApp_warning" --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE -g --c11 --gcc --diag_remark=112 --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi --preproc_with_compile --preproc_dependency="EK_TM4C1294XL.d_raw" --cmd_file="configPkg/compiler.opt" "../EK_TM4C1294XL.c"
    Finished building: "../EK_TM4C1294XL.c"
     
    making ../src/sysbios/sysbios.aem4f ...
    gmake[2]: Nothing to be done for 'all'.
    Building target: "TestApp_warning.out"
    Invoking: ARM Linker
    "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me --opt_for_speed=0 --define=ccs="ccs" --define=PART_TM4C1294NCPDT --define=ccs --define=TIVAWARE -g --c11 --gcc --diag_remark=112 --diag_warning=225 --diag_warning=255 --diag_wrap=off --display_error_number --gen_func_subsections=on --abi=eabi -z -m"TestApp_warning.map" --heap_size=0 --stack_size=512 -i"C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/lib" -i"C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/include" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="TestApp_warning_linkInfo.xml" --rom_model -o "TestApp_warning.out" "./EK_TM4C1294XL.obj" "./empty.obj" "./test.obj" "../ECU_CUSTOM.cmd" -l"configPkg/linker.cmd" -l"C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b/grlib/ccs/Debug/grlib.lib" -l"C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b/usblib/ccs/Debug/usblib.lib" -l"C:/ti/tirtos_tivac_2_16_00_08/products/TivaWare_C_Series-2.1.1.71b/driverlib/ccs/Debug/driverlib.lib" -llibc.a 
    <Linking>
    Finished building target: "TestApp_warning.out"
     
    Building files: "TestApp_warning.out"
    Invoking: ARM Hex Utility
    "C:/ti/ccs901/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armhex" --no_warnings -o "TestApp_warning.hex"  "TestApp_warning.out" 
    Translating to Extended Tektronix format...
       "TestApp_warning.out" .resetVecs ==> .resetVecs
       "TestApp_warning.out" .text ==> .text
       "TestApp_warning.out" .const ==> .const
       "TestApp_warning.out" .cinit ==> .cinit
    Finished building: "TestApp_warning.out"
     
    
    **** Build Finished ****
    

    Thanking you.

    Best Regards,

    Harshal

  • I am referring your question to the compiler team.

  • harshal patil said:

    Please find attached file for project which I've created using CCS v9.0.1.

    Please refer build log for attachment.build_log.txt

    Harshal,

    For this project, you can add the --diag_remark=112 option to the XDCtools option --compileOptions as shown below.