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.

"#112-D statement is unreachable" warning



I'm running a fully updated CCS 6.1.2.00015 and a MSP432 project. 

I get this warning during compile and then while debugging the code if I pause and inspect line 48:

if (diode_sensor_read_result(&samples[readingNo]) == true) {

I see  "error: cannot load from non-primitive location". I'm not sure if they're related but I can't seem to find any help for either of them. I've attached the project files.

If anyone has any helpful advice on how to solve these I would greatly appreciate the help!

Thanks,
George

Cheese.zip

  • Hello George,

    The two messages are unrelated. The #112-D compiler warning is in regards to a statement in your code that will not be executed, like some code after a never-ending loop.

    As for the message in your screenshot, see Darian's response in the below thread:

    https://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/3325/1739560#1739560

    Thanks

    ki

  • Thanks for looking at this. I didn't think the compiler warning was related but I thought I'd put it out there just in case. I've gone through the code more than a few times and I can't see why that warning appears but I guess I'm obviously still missing something.

    I read Darian's post but unfortunately I'm not quite following it in my case. If you could help nudge me a long that would be great.

    Thanks again,
    George
  • Regarding Darian's post, basically the "hover over" feature in the editor is trying to dereference it. Looks like diode_sensor_read_result is a function and functions cannot be dereferenced, hence the error you see in the pop-up. There is an existing enhancement request to avoid having the editor trying to automatically dereference functions.
  • I feel dumb but I figured out that the warning was there because once we get into the while(1) loop we'll never exit it and therefore the statements outside of the while(1) loop will never happen.

    Now the "non-primitive location" error is really causing me to scratch my head.
  • Looks like our posts crossed. So this isn't necessarily an error just a compiler/debugger anomaly. If so, I'll ignore it for now and go back to trying to figure out why the code doesn't work.
  • The cryptic wording is probably causing confusion. Ignore that and focus on Darian's statement:

    "but it looks like you are hovering over a function. Functions have a value (where they are located in memory), but cannot be dereferenced, even though their type is a pointer type. Dereferencing them would be equivalent to calling them. "

    Note that an enhancement request has been filed to avoid such confusion. Tracking ID: SDSCM00052653. Basically the eidtor should only auto-expand pointers/references that are not functions (pointers to pointers to functions should be fine).
  • George Ioakimedes said:
    So this isn't necessarily an error just a compiler/debugger anomaly

    It's actually more of an editor anomaly. But yes, you can ignore that non-primitve location message as it is not impacting your debug or code execution